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

@ -170,10 +170,10 @@ function parseColumn(dontclose) {
'<input type="checkbox" class="filled-in" id="exc-follow-' + key + '" ' + excludeCk(key, "follow") + ' /><label for="exc-follow-' + key + '" class="exc-chb" ><i class="fas fa-users exc-icons"></i></label> ' + '<input type="checkbox" class="filled-in" id="exc-follow-' + key + '" ' + excludeCk(key, "follow") + ' /><label for="exc-follow-' + key + '" class="exc-chb" ><i class="fas fa-users exc-icons"></i></label> ' +
'<input type="checkbox" class="filled-in" id="exc-poll-' + key + '" ' + excludeCk(key, "poll") + ' /><label for="exc-poll-' + key + '" class="exc-chb" ><i class="fas fa-tasks exc-icons"></i></label> ' + '<input type="checkbox" class="filled-in" id="exc-poll-' + key + '" ' + excludeCk(key, "poll") + ' /><label for="exc-poll-' + key + '" class="exc-chb" ><i class="fas fa-tasks exc-icons"></i></label> ' +
'<button class="btn waves-effect" style="width:60px; padding:0;" onclick="exclude(' + key + ')">Filter</button>'; '<button class="btn waves-effect" style="width:60px; padding:0;" onclick="exclude(' + key + ')">Filter</button>';
if(checkNotfFilter(key)){ if (checkNotfFilter(key)) {
exclude=exclude+'<button class="btn red waves-effect" style="width:60px; padding:0;" onclick="resetNotfFilter(' + key + ')">Clear all</button>' exclude = exclude + '<button class="btn red waves-effect" style="width:60px; padding:0;" onclick="resetNotfFilter(' + key + ')">Clear all</button>'
} }
exclude=exclude+"<br>"; exclude = exclude + "<br>";
} else if (acct.type == "home") { } else if (acct.type == "home") {
var exclude = '<a onclick="ebtToggle(' + key + var exclude = '<a onclick="ebtToggle(' + key +
')" class="setting nex"><i class="fas fa-retweet waves-effect nex" title="' + lang.lang_layout_excludingbt + '" style="font-size:24px"></i><span id="sta-bt-' + ')" class="setting nex"><i class="fas fa-retweet waves-effect nex" title="' + lang.lang_layout_excludingbt + '" style="font-size:24px"></i><span id="sta-bt-' +
@ -308,7 +308,7 @@ function secvis(set) {
//カラム追加 //カラム追加
function addColumn() { function addColumn() {
var acct = $("#add-acct-sel").val(); var acct = $("#add-acct-sel").val();
if(acct != "webview" && acct != "noauth"){ if (acct != "webview" && acct != "noauth") {
localStorage.setItem("last-use", acct); localStorage.setItem("last-use", acct);
} }
var type = $("#type-sel").val(); var type = $("#type-sel").val();
@ -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

@ -73,7 +73,7 @@ function system(mainWindow, dir, lang) {
e.sender.webContents.send('dialogClientRender', arg); e.sender.webContents.send('dialogClientRender', arg);
}); });
}) })
//ハードウェアアクセラレーションの無効化 //ハードウェアアクセラレーションの無効化
ipc.on('ha', function (e, arg) { ipc.on('ha', function (e, arg) {
@ -100,7 +100,7 @@ function system(mainWindow, dir, lang) {
var ver = app.getVersion() var ver = app.getVersion()
var window = new BrowserWindow({ var window = new BrowserWindow({
webPreferences: { webPreferences: {
nodeIntegration:true nodeIntegration: true
}, },
width: 300, width: 300,
height: 480, height: 480,
@ -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) {
@ -131,7 +131,7 @@ function system(mainWindow, dir, lang) {
} }
var nanowindow = new BrowserWindow({ var nanowindow = new BrowserWindow({
webPreferences: { webPreferences: {
nodeIntegration:true nodeIntegration: true
}, },
width: 350, width: 350,
height: 200, height: 200,
@ -165,7 +165,7 @@ function system(mainWindow, dir, lang) {
} }
}); });
ipc.on('export', (e, args) => { ipc.on('export', (e, args) => {
fs.writeFileSync(args[0], args[1]); fs.writeFileSync(args[0], args[1]);
}); });