Remove: node on ui/img/layout.js #86

This commit is contained in:
Cutls 2019-06-15 01:32:59 +09:00
parent 725f0f789a
commit 7b46145114
4 changed files with 44 additions and 39 deletions

View File

@ -19,6 +19,12 @@ onmessage = function (e) {
ipc.send('native-notf', e.data[1]); ipc.send('native-notf', e.data[1]);
} else if (e.data[0] == "dialogClient") { } else if (e.data[0] == "dialogClient") {
ipc.send("dialogClient", e.data[1]) 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 //version.js
@ -134,6 +140,29 @@ ipc.on('dialogClientRender', function (event, arg) {
} }
parseColumn(); 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 + '<button class="btn-flat toast-action" onclick="openFinder(\'' + argC + '\')">Show</button>', 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'); var webviewDom = document.getElementById('webview');
const { const {

View File

@ -271,22 +271,14 @@ function detFromImg() {
//画像保存 //画像保存
function dlImg() { function dlImg() {
var url = $("#imgmodal").attr("src"); var url = $("#imgmodal").attr("src");
var electron = require("electron");
var ipc = electron.ipcRenderer;
if (localStorage.getItem("savefolder")) { if (localStorage.getItem("savefolder")) {
var save = localStorage.getItem("savefolder"); var save = localStorage.getItem("savefolder");
} else { } else {
var save = ""; var save = "";
} }
ipc.send('general-dl', [url, save, false]); postMessage(["generalDL", [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 + '<button class="btn-flat toast-action" onclick="openFinder(\'' + argC + '\')">Show</button>', displayLength: 5000 })
})
} }
function openFinder(dir) { function openFinder(dir) {
ipc.send('open-finder', dir); postMessage(["openFinder", dir], "*")
} }

View File

@ -367,23 +367,7 @@ function removeColumn(tlid) {
var multi = localStorage.getItem("column"); var multi = localStorage.getItem("column");
var obj = JSON.parse(multi); var obj = JSON.parse(multi);
//聞く //聞く
var electron = require("electron"); postMessage(["columnDel", tlid], "*")
var ipc = electron.ipcRenderer;
ipc.send('column-del', "");
ipc.on('column-del-reply', function (event, arg) {
if (arg === 1) {
localStorage.removeItem("card_" + tlid);
obj.splice(tlid, 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()
}
})
} }
//設定トグル //設定トグル

View File

@ -111,12 +111,12 @@ function system(mainWindow, dir, lang) {
window.loadURL(dir + '/about.html?ver=' + ver); window.loadURL(dir + '/about.html?ver=' + ver);
return "true" return "true"
} }
ipc.on('column-del', (e, args) => { ipc.on('column-del', (e, tlid) => {
console.log(lang); console.log(lang);
var options = language.delsel(lang) var options = language.delsel(lang)
dialog.showMessageBox(options, function (index) { 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) { ipc.on('nano', function (e, x, y) {