From 772a5438aaeafe7c8e20ee56a557b97dc02d787c Mon Sep 17 00:00:00 2001 From: Cutls Date: Sat, 15 Jun 2019 01:20:12 +0900 Subject: [PATCH] Remove: node on details/misskeyparse.js #86 --- app/js/platform/preload.js | 2 ++ app/js/tl/datails.js | 12 ++---------- app/js/tl/misskeyparse.js | 24 +++++++++--------------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index 6b173359..19f30b2e 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -15,6 +15,8 @@ onmessage = function (e) { ipc.send('bmp-image', e.data[1]); } else if (e.data[0] == "dialogCW") { ipc.send("dialogCW", e.data[1]) + } else if (e.data[0] == "nativeNotf") { + ipc.send('native-notf', e.data[1]); } } //version.js diff --git a/app/js/tl/datails.js b/app/js/tl/datails.js index 86c61a34..29397c72 100644 --- a/app/js/tl/datails.js +++ b/app/js/tl/datails.js @@ -519,11 +519,7 @@ function trans(tar, to) { //ブラウザで開く function brws() { var url = $("#tootmodal").attr("data-url"); - const { - shell - } = require('electron'); - - shell.openExternal(url); + postMessage(["openUrl", url], "*") } //外部からトゥート開く function detEx(url, acct_id) { @@ -546,11 +542,7 @@ function detEx(url, acct_id) { console.error(error); }).then(function (json) { if (!json.statuses) { - const { - shell - } = require('electron'); - - shell.openExternal(url); + postMessage(["openUrl", url], "*") } else { var id = json.statuses[0].id; $(".loadp").text($(".loadp").attr("href")); diff --git a/app/js/tl/misskeyparse.js b/app/js/tl/misskeyparse.js index f3d8c7bd..aca9f5e9 100644 --- a/app/js/tl/misskeyparse.js +++ b/app/js/tl/misskeyparse.js @@ -257,9 +257,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { M.toast({ html: "[" + domain + "]" + escapeHTMLtemp(toot.user.name) + what, displayLength: popup * 1000 }) } 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.user.name + "(" + toot.user.username + ")" + what + "\n\n" + $.strip_tagstemp(toot.note.text), icon: toot.user.avatarUrl @@ -267,14 +265,15 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { if (os == "darwin") { var n = new Notification('TheDesk:' + domain, options); } else { - ipc.send('native-notf', [ + var nativeNotfOpt=[ 'TheDesk:' + domain, toot.user.name + "(" + toot.user.username + ")" + what + "\n\n" + $.strip_tagstemp(toot.note.text), toot.user.avatarUrl, "toot", acct_id, toot.note.id - ]); + ] + postMessage(["nativeNotf", nativeNotfOpt], "*") } } if (localStorage.getItem("hasNotfC_" + acct_id) != "true") { @@ -902,9 +901,7 @@ function misskeyUserparse(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 @@ -913,14 +910,15 @@ function misskeyUserparse(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], "*") } } } @@ -967,11 +965,7 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) { function goGoogle(id) { var val = $("#srcbox_" + id).val(); var url = "https://google.com/search?q=" + val; - const { - shell - } = require('electron'); - - shell.openExternal(url); + postMessage(["openUrl", url], "*") } var misskeyws = [] var misskeywsstate = []