From 8140e56cbc384149264db56d1e522c62733c4737 Mon Sep 17 00:00:00 2001 From: cutls Date: Tue, 8 Oct 2019 23:26:21 +0900 Subject: [PATCH] Notification on Windows(can use render-process-based notification) --- app/js/tl/misskeyparse.js | 28 ++-------------------------- app/js/tl/notification.js | 14 ++------------ app/js/tl/parse.js | 28 ++-------------------------- app/js/ui/settings.js | 7 +------ 4 files changed, 7 insertions(+), 70 deletions(-) diff --git a/app/js/tl/misskeyparse.js b/app/js/tl/misskeyparse.js index a8aec42b..34f3d1b4 100644 --- a/app/js/tl/misskeyparse.js +++ b/app/js/tl/misskeyparse.js @@ -268,19 +268,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { body: toot.user.name + "(" + toot.user.username + ")" + what + "\n\n" + $.strip_tagstemp(toot.note.text), icon: toot.user.avatarUrl }; - if (os == "darwin") { - var n = new Notification('TheDesk:' + domain, options); - } else { - 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], "*") - } + var n = new Notification('TheDesk:' + domain, options); } if (localStorage.getItem("hasNotfC_" + acct_id) != "true") { $(".notf-icon_" + acct_id).addClass("red-text"); @@ -917,19 +905,7 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) { icon: toot.avatar }; var domain = localStorage.getItem("domain_" + acct_id); - if (os == "darwin") { - var n = new Notification('TheDesk:' + domain, options); - } else { - var nativeNotfOpt = [ - 'TheDesk:' + domain, - toot.display_name + "(" + toot.acct + ")" + ftxt, - toot.avatar, - "userdata", - acct_id, - toot.id - ] - postMessage(["nativeNotf", nativeNotfOpt], "*") - } + var n = new Notification('TheDesk:' + domain, options); } } if (toot.name) { diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js index c59f93c4..37af46b5 100644 --- a/app/js/tl/notification.js +++ b/app/js/tl/notification.js @@ -63,12 +63,7 @@ function notfColumn(acct_id, tlid, sys) { body: ct + lang.lang_notf_new, icon: localStorage.getItem("prof_" + acct_id) }; - if (os == "darwin") { - var n = new Notification('TheDesk:' + domain, options); - } else { - var nativeNotfOpt = ['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)] - postMessage(["nativeNotf", nativeNotfOpt], "*") - } + var n = new Notification('TheDesk:' + domain, options); } if (localStorage.getItem("filter_" + acct_id) != "undefined") { @@ -178,12 +173,7 @@ function notfCommon(acct_id, tlid, sys) { body: ct + lang.lang_notf_new, icon: localStorage.getItem("prof_" + acct_id) }; - if (os == "darwin") { - var n = new Notification('TheDesk:' + domain, options); - } else { - var nativeNotfOpt = ['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)] - postMessage(["nativeNotf", nativeNotfOpt], "*") - } + var n = new Notification('TheDesk:' + domain, options); } if (localStorage.getItem("filter_" + acct_id) != "undefined") { diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index c4dad209..f929d9a1 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -320,19 +320,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { body: toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content), icon: toot.account.avatar }; - if (os == "darwin") { - var n = new Notification('TheDesk:' + domain, options); - } else { - 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], "*") - } + var n = new Notification('TheDesk:' + domain, options); } if (localStorage.getItem("hasNotfC_" + acct_id) != "true") { $(".notf-icon_" + acct_id).addClass("red-text"); @@ -972,19 +960,7 @@ function userparse(obj, auth, acct_id, tlid, popup) { icon: toot.avatar }; var domain = localStorage.getItem("domain_" + acct_id); - if (os == "darwin") { - var n = new Notification('TheDesk:' + domain, options); - } else { - var nativeNotfOpt = [ - 'TheDesk:' + domain, - toot.display_name + "(" + toot.acct + ")" + ftxt, - toot.avatar, - "userdata", - acct_id, - toot.id - ] - postMessage(["nativeNotf", nativeNotfOpt], "*") - } + var n = new Notification('TheDesk:' + domain, options); } } if (toot.display_name) { diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index ef74c749..7beb8bd1 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -258,12 +258,7 @@ function notftest() { body: lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')', icon: localStorage.getItem("prof_0") }; - if (os == "darwin") { - var n = new Notification('TheDesk' + lang.lang_setting_notftest, options); - } else { - var nativeNotfOpt = ['TheDesk' + lang.lang_setting_notftest, lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')', localStorage.getItem('prof_0'), "", ""] - postMessage(["nativeNotf", nativeNotfOpt], "*") - } + var n = new Notification('TheDesk' + lang.lang_setting_notftest, options); } function oks(no) {