diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index 2c7718d3..cc30121e 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -19,6 +19,12 @@ onmessage = function (e) { ipc.send('native-notf', e.data[1]); } else if (e.data[0] == "dialogClient") { ipc.send("dialogClient", e.data[1]) + } else if (e.data[0] == "generalDL") { + ipc.send('general-dl', e.data[1]); + } else if (e.data[0] == "openFinder") { + ipc.send('open-finder', e.data[1]); + } else if (e.data[0] == "columnDel") { + ipc.send('column-del', e.data[1]); } } //version.js @@ -134,6 +140,29 @@ ipc.on('dialogClientRender', function (event, arg) { } parseColumn(); }); +//ui,img.js +ipc.on('general-dl-prog', function (event, arg) { + console.log("Progress: " + arg); +}) +ipc.on('general-dl-message', function (event, arg) { + var argC = arg.replace(/\\/g, "\\\\") + "\\\\."; + M.toast({ html: lang.lang_img_DLDone + arg + '', displayLength: 5000 }) +}) +//layout.js +ipc.on('column-del-reply', function (event, args) { + if (args[0] === 1) { + localStorage.removeItem("card_" + args[1]); + obj.splice(args[1], 1); + for (var i = 0; i < obj.length; i++) { + localStorage.setItem("card_" + i, "true"); + localStorage.removeItem("catch_" + i); + } + var json = JSON.stringify(obj); + localStorage.setItem("column", json); + parseColumn(); + sortload() + } +}) /* var webviewDom = document.getElementById('webview'); const { diff --git a/app/js/ui/img.js b/app/js/ui/img.js index eb452a2e..7bc247ba 100644 --- a/app/js/ui/img.js +++ b/app/js/ui/img.js @@ -271,22 +271,14 @@ function detFromImg() { //画像保存 function dlImg() { var url = $("#imgmodal").attr("src"); - var electron = require("electron"); - var ipc = electron.ipcRenderer; if (localStorage.getItem("savefolder")) { var save = localStorage.getItem("savefolder"); } else { var save = ""; } - ipc.send('general-dl', [url, save, false]); - ipc.on('general-dl-prog', function (event, arg) { - console.log("Progress: " + arg); - }) - ipc.on('general-dl-message', function (event, arg) { - var argC = arg.replace(/\\/g, "\\\\") + "\\\\."; - M.toast({ html: lang.lang_img_DLDone + arg + '', displayLength: 5000 }) - }) + postMessage(["generalDL", [url, save, false]], "*") + } function openFinder(dir) { - ipc.send('open-finder', dir); + postMessage(["openFinder", dir], "*") } \ No newline at end of file diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index 922b429e..29d21f01 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -170,10 +170,10 @@ function parseColumn(dontclose) { ' ' + ' ' + ''; - if(checkNotfFilter(key)){ - exclude=exclude+'' - } - exclude=exclude+"
"; + if (checkNotfFilter(key)) { + exclude = exclude + '' + } + exclude = exclude + "
"; } else if (acct.type == "home") { var exclude = ' { + ipc.on('column-del', (e, tlid) => { console.log(lang); var options = language.delsel(lang) dialog.showMessageBox(options, function (index) { - e.sender.webContents.send('column-del-reply', index); + e.sender.webContents.send('column-del-reply', [index, tlid]); }) }); ipc.on('nano', function (e, x, y) { @@ -131,7 +131,7 @@ function system(mainWindow, dir, lang) { } var nanowindow = new BrowserWindow({ webPreferences: { - nodeIntegration:true + nodeIntegration: true }, width: 350, height: 200, @@ -165,7 +165,7 @@ function system(mainWindow, dir, lang) { } }); - + ipc.on('export', (e, args) => { fs.writeFileSync(args[0], args[1]); });