Notification on Windows(can use render-process-based notification)

This commit is contained in:
cutls 2019-10-08 23:26:21 +09:00
parent de40e0e22a
commit 8140e56cbc
4 changed files with 7 additions and 70 deletions

View File

@ -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), body: toot.user.name + "(" + toot.user.username + ")" + what + "\n\n" + $.strip_tagstemp(toot.note.text),
icon: toot.user.avatarUrl icon: toot.user.avatarUrl
}; };
if (os == "darwin") { var n = new Notification('TheDesk:' + domain, options);
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], "*")
}
} }
if (localStorage.getItem("hasNotfC_" + acct_id) != "true") { if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
$(".notf-icon_" + acct_id).addClass("red-text"); $(".notf-icon_" + acct_id).addClass("red-text");
@ -917,19 +905,7 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) {
icon: toot.avatar icon: toot.avatar
}; };
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
if (os == "darwin") { var n = new Notification('TheDesk:' + domain, options);
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], "*")
}
} }
} }
if (toot.name) { if (toot.name) {

View File

@ -63,12 +63,7 @@ function notfColumn(acct_id, tlid, sys) {
body: ct + lang.lang_notf_new, body: ct + lang.lang_notf_new,
icon: localStorage.getItem("prof_" + acct_id) icon: localStorage.getItem("prof_" + acct_id)
}; };
if (os == "darwin") { var n = new Notification('TheDesk:' + domain, options);
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], "*")
}
} }
if (localStorage.getItem("filter_" + acct_id) != "undefined") { if (localStorage.getItem("filter_" + acct_id) != "undefined") {
@ -178,12 +173,7 @@ function notfCommon(acct_id, tlid, sys) {
body: ct + lang.lang_notf_new, body: ct + lang.lang_notf_new,
icon: localStorage.getItem("prof_" + acct_id) icon: localStorage.getItem("prof_" + acct_id)
}; };
if (os == "darwin") { var n = new Notification('TheDesk:' + domain, options);
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], "*")
}
} }
if (localStorage.getItem("filter_" + acct_id) != "undefined") { if (localStorage.getItem("filter_" + acct_id) != "undefined") {

View File

@ -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), body: toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content),
icon: toot.account.avatar icon: toot.account.avatar
}; };
if (os == "darwin") { var n = new Notification('TheDesk:' + domain, options);
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], "*")
}
} }
if (localStorage.getItem("hasNotfC_" + acct_id) != "true") { if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
$(".notf-icon_" + acct_id).addClass("red-text"); $(".notf-icon_" + acct_id).addClass("red-text");
@ -972,19 +960,7 @@ function userparse(obj, auth, acct_id, tlid, popup) {
icon: toot.avatar icon: toot.avatar
}; };
var domain = localStorage.getItem("domain_" + acct_id); var domain = localStorage.getItem("domain_" + acct_id);
if (os == "darwin") { var n = new Notification('TheDesk:' + domain, options);
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], "*")
}
} }
} }
if (toot.display_name) { if (toot.display_name) {

View File

@ -258,12 +258,7 @@ function notftest() {
body: lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')', body: lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')',
icon: localStorage.getItem("prof_0") icon: localStorage.getItem("prof_0")
}; };
if (os == "darwin") { var n = new Notification('TheDesk' + lang.lang_setting_notftest, options);
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], "*")
}
} }
function oks(no) { function oks(no) {