| Index: lib/ui.js |
| =================================================================== |
| --- a/lib/ui.js |
| +++ b/lib/ui.js |
| @@ -419,10 +419,19 @@ |
| this.updateState(); |
| }.bind(this)); |
| - notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); |
| - notificationTimer.initWithCallback(this.showNextNotification.bind(this), |
| - 3 * 60 * 1000, Ci.nsITimer.TYPE_ONE_SHOT); |
| - onShutdown.add(() => notificationTimer.cancel()); |
| + Notification.addShowListener(notification => |
| + { |
| + let window = this.currentWindow; |
| + if (!window) |
| + return; |
| + |
| + let button = window.document.getElementById("abp-toolbarbutton") |
| + || window.document.getElementById("abp-status"); |
| + if (!button) |
| + return; |
| + |
| + this._showNotification(window, button, notification); |
| + }); |
| // Add "anti-adblock messages" notification |
| initAntiAdblockNotification(); |
| @@ -433,7 +442,7 @@ |
| if (!(subject instanceof Ci.nsIDOMWindow)) |
| return; |
| - this.showNextNotification(subject.location.href); |
| + Notification.showNext(subject.location.href); |
| }.bind(UI) |
| }; |
| Services.obs.addObserver(documentCreationObserver, "content-document-global-created", false); |
| @@ -1849,24 +1858,6 @@ |
| } |
| }, |
| - showNextNotification: function(url) |
| - { |
| - let window = this.currentWindow; |
| - if (!window) |
| - return; |
| - |
| - let button = window.document.getElementById("abp-toolbarbutton") |
| - || window.document.getElementById("abp-status"); |
| - if (!button) |
| - return; |
| - |
| - let notification = Notification.getNextToShow(url); |
| - if (!notification) |
| - return; |
| - |
| - this._showNotification(window, button, notification); |
| - }, |
| - |
| _showNotification: function(window, button, notification) |
| { |
| let panel = window.document.getElementById("abp-notification"); |
| @@ -1932,6 +1923,8 @@ |
| window.document.getElementById("abp-notification-yes").onclick = buttonHandler.bind(null, true); |
| window.document.getElementById("abp-notification-no").onclick = buttonHandler.bind(null, false); |
| } |
| + else |
| + Notification.markAsShown(notification.id); |
| panel.setAttribute("class", "abp-" + notification.type); |
| panel.setAttribute("noautohide", notification.type === "question"); |