Remove: node on notification/parse.js #86

This commit is contained in:
Cutls 2019-06-15 01:25:51 +09:00
parent 772a5438aa
commit 725f0f789a
4 changed files with 68 additions and 65 deletions

View File

@ -17,6 +17,8 @@ onmessage = function (e) {
ipc.send("dialogCW", e.data[1])
} else if (e.data[0] == "nativeNotf") {
ipc.send('native-notf', e.data[1]);
} else if (e.data[0] == "dialogClient") {
ipc.send("dialogClient", e.data[1])
}
}
//version.js
@ -87,6 +89,51 @@ ipc.on('dialogCWRender', function (event, arg) {
post("pass");
}
});
//parse.js
ipc.on('dialogClientRender', function (event, arg) {
if (arg === 1) {
var cli = localStorage.getItem("client_emp");
var obj = JSON.parse(cli);
if (!obj) {
var obj = [];
obj.push(name);
M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 })
} else {
var can;
Object.keys(obj).forEach(function (key) {
var cliT = obj[key];
if (cliT != name && !can) {
can = false;
} else {
can = true;
obj.splice(key, 1);
M.toast({ html: escapeHTML(name) + lang.lang_status_unemphas, displayLength: 2000 })
}
});
if (!can) {
obj.push(name);
M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 })
} else {
}
}
var json = JSON.stringify(obj);
localStorage.setItem("client_emp", json);
} else if (arg === 2) {
var cli = localStorage.getItem("client_mute");
var obj = JSON.parse(cli);
if (!obj) {
obj = [];
}
obj.push(name);
var json = JSON.stringify(obj);
localStorage.setItem("client_mute", json);
M.toast({ html: escapeHTML(name) + lang.lang_parse_mute, displayLength: 2000 })
} else {
return;
}
parseColumn();
});
/*
var webviewDom = document.getElementById('webview');
const {

View File

@ -58,9 +58,7 @@ function notfColumn(acct_id, tlid, sys) {
if (key > 14) {
ct = "15+";
}
var electron = require("electron");
var ipc = electron.ipcRenderer;
var os = electron.remote.process.platform;
var os = localStorage.getItem("platform");
var options = {
body: ct + lang.lang_notf_new,
icon: localStorage.getItem("prof_" + acct_id)
@ -68,7 +66,8 @@ function notfColumn(acct_id, tlid, sys) {
if (os == "darwin") {
var n = new Notification('TheDesk:' + domain, options);
} else {
ipc.send('native-notf', ['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]);
var nativeNotfOpt=['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]
postMessage(["nativeNotf", nativeNotfOpt], "*")
}
}
@ -164,9 +163,7 @@ function notfCommon(acct_id, tlid, sys) {
if (key > 14) {
ct = "15+";
}
var electron = require("electron");
var ipc = electron.ipcRenderer;
var os = electron.remote.process.platform;
var os = localStorage.getItem("platform");
var options = {
body: ct + lang.lang_notf_new,
icon: localStorage.getItem("prof_" + acct_id)
@ -174,7 +171,8 @@ function notfCommon(acct_id, tlid, sys) {
if (os == "darwin") {
var n = new Notification('TheDesk:' + domain, options);
} else {
ipc.send('native-notf', ['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]);
var nativeNotfOpt=['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]
postMessage(["nativeNotf", nativeNotfOpt], "*")
}
}

View File

@ -304,9 +304,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
request.send();
}
if (native == "yes") {
var electron = require("electron");
var ipc = electron.ipcRenderer;
var os = electron.remote.process.platform;
var os = localStorage.getItem("platform");
var options = {
body: toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content),
icon: toot.account.avatar
@ -314,14 +312,15 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
if (os == "darwin") {
var n = new Notification('TheDesk:' + domain, options);
} else {
ipc.send('native-notf', [
var nativeNotfOpt = [
'TheDesk:' + domain,
toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content),
toot.account.avatar,
"toot",
acct_id,
toot.status.id
]);
]
postMessage(["nativeNotf", nativeNotfOpt], "*")
}
}
if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
@ -929,9 +928,7 @@ function userparse(obj, auth, acct_id, tlid, popup) {
native = "yes";
}
if (native == "yes") {
var electron = require("electron");
var ipc = electron.ipcRenderer;
var os = electron.remote.process.platform;
var os = localStorage.getItem("platform");
var options = {
body: toot.display_name + "(" + toot.acct + ")" + ftxt,
icon: toot.avatar
@ -940,14 +937,15 @@ function userparse(obj, auth, acct_id, tlid, popup) {
if (os == "darwin") {
var n = new Notification('TheDesk:' + domain, options);
} else {
ipc.send('native-notf', [
var nativeNotfOpt = [
'TheDesk:' + domain,
toot.display_name + "(" + toot.acct + ")" + ftxt,
toot.avatar,
"userdata",
acct_id,
toot.id
]);
]
postMessage(["nativeNotf", nativeNotfOpt], "*")
}
}
}
@ -1011,59 +1009,13 @@ function userparse(obj, auth, acct_id, tlid, popup) {
function client(name) {
if (name != "Unknown") {
//聞く
var electron = require("electron");
var remote = electron.remote;
var dialog = remote.dialog;
const options = {
type: 'info',
title: lang.lang_parse_clientop,
message: name + lang.lang_parse_clienttxt,
buttons: [lang.lang_parse_clientno, lang.lang_parse_clientemp, lang.lang_parse_clientmute]
}
dialog.showMessageBox(options, function (arg) {
if (arg === 1) {
var cli = localStorage.getItem("client_emp");
var obj = JSON.parse(cli);
if (!obj) {
var obj = [];
obj.push(name);
M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 })
} else {
var can;
Object.keys(obj).forEach(function (key) {
var cliT = obj[key];
if (cliT != name && !can) {
can = false;
} else {
can = true;
obj.splice(key, 1);
M.toast({ html: escapeHTML(name) + lang.lang_status_unemphas, displayLength: 2000 })
}
});
if (!can) {
obj.push(name);
M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 })
} else {
}
}
var json = JSON.stringify(obj);
localStorage.setItem("client_emp", json);
} else if (arg === 2) {
var cli = localStorage.getItem("client_mute");
var obj = JSON.parse(cli);
if (!obj) {
obj = [];
}
obj.push(name);
var json = JSON.stringify(obj);
localStorage.setItem("client_mute", json);
M.toast({ html: escapeHTML(name) + lang.lang_parse_mute, displayLength: 2000 })
} else {
return;
}
parseColumn();
})
postMessage(["dialogClient", options], "*")
}
}

View File

@ -67,6 +67,12 @@ function system(mainWindow, dir, lang) {
e.sender.webContents.send('dialogCWRender', arg);
});
})
//クライアントのダイアログ
ipc.on('dialogClient', function (e, args) {
dialog.showMessageBox(args, function (arg) {
e.sender.webContents.send('dialogClientRender', arg);
});
})
//ハードウェアアクセラレーションの無効化
ipc.on('ha', function (e, arg) {