Skip to content

Instantly share code, notes, and snippets.

@asm256
Created April 3, 2016 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asm256/cb77c1ef3c926321268b9e0c6087f1d3 to your computer and use it in GitHub Desktop.
Save asm256/cb77c1ef3c926321268b9e0c6087f1d3 to your computer and use it in GitHub Desktop.
通知アラートをクリックすると艦これタブを開く
utils.jsm: open KancolleTab when notify click
通知アラートをクリックすると艦これタブを開く
diff --git a/chrome/content/utils.jsm b/chrome/content/utils.jsm
index 613336e..a8aa46f 100644
--- a/chrome/content/utils.jsm
+++ b/chrome/content/utils.jsm
@@ -33,7 +33,20 @@ var KanColleTimerUtils = {
},
},
alert: {
+ _notify: {
+ observe: function(subject, topic, data) {
+ if(topic == "alertclickcallback"){
+ if(!KanColleTimerUtils.window.selectTab(KanColleUtils.URL))
+ KanColleTimerUtils.window.openTab(KanColleUtils.URL, true)
+ }
+ }
+ },
show: function(imageURL, title, text, clickable, cookie, listener) {
+ // 通知をクリックすると艦これタブを開く
+ if(listener == null){
+ clickable = true;
+ listener = this._notify;
+ }
try {
let alertserv = Cc['@mozilla.org/alerts-service;1']
.getService(Ci.nsIAlertsService);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment