From 4a46877de7de3ebfe93713349446ff9dfb2d3123 Mon Sep 17 00:00:00 2001
From: unknown <1371033826@qq.com>
Date: Thu, 26 Jun 2025 14:54:06 +0800
Subject: [PATCH] remove-dollar-and-add-preview-toolbar
---
js/projects.js | 138 ++++++++++++++++++++++++++++++++++++++++++++-----
mixio.js | 8 +--
2 files changed, 130 insertions(+), 16 deletions(-)
diff --git a/js/projects.js b/js/projects.js
index e146507..c803960 100644
--- a/js/projects.js
+++ b/js/projects.js
@@ -4468,15 +4468,43 @@ function prepare_storDia(){
if (isText) {
let viewBtn = $('');
viewBtn.click(function() {
+ let contentDiv = $('
')
$.ajax({
url: url,
success: function(content) {
+ contentDiv.append($('' + content + '
'))
+ let bottomDiv = $('')
+ let closeBtn2 = $('');
+ let deleteBtn2 = $('');
+ let downloadBtn2 = $('');
+ let fileNameSpan = $('' + filename + '')
+ bottomDiv.append(fileNameSpan);
+ bottomDiv.append(downloadBtn2);
+ bottomDiv.append(deleteBtn2);
+ bottomDiv.append(closeBtn2);
+ contentDiv.append(bottomDiv);
let textDialog = dialog({
- content: $('')[0],
- cancel: true,
- cancelValue: '关闭'
+ content: contentDiv[0]
});
textDialog.showModal();
+ closeBtn2.click(function(){
+ textDialog.close().remove()
+ })
+ deleteBtn2.click(function() {
+ if(confirm('确定要删除此文件吗?')) {
+ $.getJSON('deleteImgStore', {
+ 'projectName': globalProjectName,
+ 'filename': filename,
+ 'isMixly': isMixly
+ }, function() {
+ textDialog.close().remove()
+ sync_stor();
+ });
+ }
+ });
+ downloadBtn2.click(function() {
+ downloadFile(filename);
+ });
}
});
});
@@ -4484,12 +4512,41 @@ function prepare_storDia(){
} else {
let viewBtn = $('');
viewBtn.click(function() {
+ let contentDiv = $('')
+ contentDiv.append($('
'))
+ let bottomDiv = $('')
+ let closeBtn2 = $('');
+ let deleteBtn2 = $('');
+ let downloadBtn2 = $('');
+ let fileNameSpan = $('' + filename + '')
+ bottomDiv.append(fileNameSpan);
+ bottomDiv.append(downloadBtn2);
+ bottomDiv.append(deleteBtn2);
+ bottomDiv.append(closeBtn2);
+ contentDiv.append(bottomDiv);
let fullDialog = dialog({
- content: $('')[0],
- cancel: true,
- cancelValue: '关闭'
+ content: contentDiv[0],
+ padding:0
});
fullDialog.showModal();
+ closeBtn2.click(function(){
+ fullDialog.close().remove()
+ })
+ deleteBtn2.click(function() {
+ if(confirm('确定要删除此文件吗?')) {
+ $.getJSON('deleteImgStore', {
+ 'projectName': globalProjectName,
+ 'filename': filename,
+ 'isMixly': isMixly
+ }, function() {
+ fullDialog.close().remove()
+ sync_stor();
+ });
+ }
+ });
+ downloadBtn2.click(function() {
+ downloadFile(filename);
+ });
});
actionCell.append(viewBtn);
}
@@ -4525,24 +4582,81 @@ function prepare_storDia(){
previewDiv.click(function() {
if (isText) {
+ let contentDiv = $('')
$.ajax({
url: url,
success: function(content) {
+ contentDiv.append($('' + content + '
'))
+ let bottomDiv = $('')
+ let closeBtn2 = $('');
+ let deleteBtn2 = $('');
+ let downloadBtn2 = $('');
+ let fileNameSpan = $('' + filename + '')
+ bottomDiv.append(fileNameSpan);
+ bottomDiv.append(downloadBtn2);
+ bottomDiv.append(deleteBtn2);
+ bottomDiv.append(closeBtn2);
+ contentDiv.append(bottomDiv);
let textDialog = dialog({
- content: $('')[0],
- cancel: true,
- cancelValue: '关闭'
+ content: contentDiv[0]
});
textDialog.showModal();
+ closeBtn2.click(function(){
+ textDialog.close().remove()
+ })
+ deleteBtn2.click(function() {
+ if(confirm('确定要删除此文件吗?')) {
+ $.getJSON('deleteImgStore', {
+ 'projectName': globalProjectName,
+ 'filename': filename,
+ 'isMixly': isMixly
+ }, function() {
+ textDialog.close().remove()
+ sync_stor();
+ });
+ }
+ });
+ downloadBtn2.click(function() {
+ downloadFile(filename);
+ });
}
});
} else {
+ let contentDiv = $('')
+ contentDiv.append($('
'))
+ let bottomDiv = $('')
+ let closeBtn2 = $('');
+ let deleteBtn2 = $('');
+ let downloadBtn2 = $('');
+ let fileNameSpan = $('' + filename + '')
+ bottomDiv.append(fileNameSpan);
+ bottomDiv.append(downloadBtn2);
+ bottomDiv.append(deleteBtn2);
+ bottomDiv.append(closeBtn2);
+ contentDiv.append(bottomDiv);
let fullDialog = dialog({
- content: $('')[0],
- cancel: true,
- cancelValue: '关闭'
+ content: contentDiv[0],
+ padding:0
});
fullDialog.showModal();
+ closeBtn2.click(function(){
+ fullDialog.close().remove()
+ })
+ deleteBtn2.click(function() {
+ if(confirm('确定要删除此文件吗?')) {
+ $.getJSON('deleteImgStore', {
+ 'projectName': globalProjectName,
+ 'filename': filename,
+ 'isMixly': isMixly
+ }, function() {
+ fullDialog.close().remove()
+ sync_stor();
+ });
+ }
+ });
+ downloadBtn2.click(function() {
+ downloadFile(filename);
+ });
}
});
diff --git a/mixio.js b/mixio.js
index be63d0c..d62dc24 100644
--- a/mixio.js
+++ b/mixio.js
@@ -843,7 +843,7 @@ var mixioServer = async function() {
const format = match[1];
const currentDate = new Date();
const timeStamp = `${currentDate.getFullYear()}_${(currentDate.getMonth() + 1).toString().padStart(2, '0')}_${currentDate.getDate().toString().padStart(2, '0')}_${currentDate.getHours().toString().padStart(2, '0')}_${currentDate.getMinutes().toString().padStart(2, '0')}_${currentDate.getSeconds().toString().padStart(2, '0')}`;
- const fileName = topic[3] + '_' + `${timeStamp}.${format}`;
+ const fileName = topic[3].substr(1) + '_' + `${timeStamp}.${format}`;
const filePath = path.join('store', topic[0], topic[1], topic[2], fileName);
const base64Data = payload.replace(base64Reg, '');
const buffer = Buffer.from(base64Data, 'base64');
@@ -853,7 +853,7 @@ var mixioServer = async function() {
// 全部明文存为txt
const currentDate = new Date();
const timeStamp = `${currentDate.getFullYear()}_${(currentDate.getMonth() + 1).toString().padStart(2, '0')}_${currentDate.getDate().toString().padStart(2, '0')}_${currentDate.getHours().toString().padStart(2, '0')}_${currentDate.getMinutes().toString().padStart(2, '0')}_${currentDate.getSeconds().toString().padStart(2, '0')}`;
- const fileName = topic[3] + '_' + `${timeStamp}.txt`;
+ const fileName = topic[3].substr(1) + '_' + `${timeStamp}.txt`;
const filePath = path.join('store', topic[0], topic[1], topic[2], fileName);
fs.mkdirSync(path.dirname(filePath), { recursive: true});
fs.writeFileSync(filePath, payload);
@@ -872,7 +872,7 @@ var mixioServer = async function() {
const format = match[1];
const currentDate = new Date();
const timeStamp = `${currentDate.getFullYear()}_${(currentDate.getMonth() + 1).toString().padStart(2, '0')}_${currentDate.getDate().toString().padStart(2, '0')}_${currentDate.getHours().toString().padStart(2, '0')}_${currentDate.getMinutes().toString().padStart(2, '0')}_${currentDate.getSeconds().toString().padStart(2, '0')}`;
- const fileName = topic[2] + '_' + `${timeStamp}.${format}`;
+ const fileName = topic[2].substr(1) + '_' + `${timeStamp}.${format}`;
const filePath = path.join('store', topic[0], topic[1], fileName);
const base64Data = payload.replace(base64Reg, '');
const buffer = Buffer.from(base64Data, 'base64');
@@ -882,7 +882,7 @@ var mixioServer = async function() {
// 全部明文存为txt
const currentDate = new Date();
const timeStamp = `${currentDate.getFullYear()}_${(currentDate.getMonth() + 1).toString().padStart(2, '0')}_${currentDate.getDate().toString().padStart(2, '0')}_${currentDate.getHours().toString().padStart(2, '0')}_${currentDate.getMinutes().toString().padStart(2, '0')}_${currentDate.getSeconds().toString().padStart(2, '0')}`;
- const fileName = topic[2] + '_' + `${timeStamp}.txt`;
+ const fileName = topic[2].substr(1) + '_' + `${timeStamp}.txt`;
const filePath = path.join('store', topic[0], topic[1], fileName);
fs.mkdirSync(path.dirname(filePath), { recursive: true});
fs.writeFileSync(filePath, payload);