| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 | 120 |
| 121 setChecked("adblockplus-savestats", Prefs.savestats); | 121 setChecked("adblockplus-savestats", Prefs.savestats); |
| 122 addCommandHandler("adblockplus-savestats", function() | 122 addCommandHandler("adblockplus-savestats", function() |
| 123 { | 123 { |
| 124 UI.toggleSaveStats(doc.defaultView); | 124 UI.toggleSaveStats(doc.defaultView); |
| 125 this.value = Prefs.savestats; | 125 this.value = Prefs.savestats; |
| 126 }); | 126 }); |
| 127 | 127 |
| 128 hideElement("adblockplus-shownotifications", !Prefs.notifications_showui); |
| 129 setChecked("adblockplus-shownotifications", Prefs.notifications_ignoredcat
egories.indexOf("*") == -1); |
| 130 addCommandHandler("adblockplus-shownotifications", function() |
| 131 { |
| 132 Notification.toggleIgnoreCategory("*"); |
| 133 this.value = (Prefs.notifications_ignoredcategories.indexOf("*") == -1); |
| 134 }); |
| 135 |
| 128 let hasAcceptableAds = FilterStorage.subscriptions.some((subscription) =>
subscription instanceof DownloadableSubscription && | 136 let hasAcceptableAds = FilterStorage.subscriptions.some((subscription) =>
subscription instanceof DownloadableSubscription && |
| 129 subscription.url == Prefs.subscriptions_exceptionsurl); | 137 subscription.url == Prefs.subscriptions_exceptionsurl); |
| 130 setChecked("adblockplus-acceptableAds", hasAcceptableAds); | 138 setChecked("adblockplus-acceptableAds", hasAcceptableAds); |
| 131 addCommandHandler("adblockplus-acceptableAds", function() | 139 addCommandHandler("adblockplus-acceptableAds", function() |
| 132 { | 140 { |
| 133 this.value = UI.toggleAcceptableAds(); | 141 this.value = UI.toggleAcceptableAds(); |
| 134 }); | 142 }); |
| 135 | 143 |
| 136 setChecked("adblockplus-sync", syncEngine && syncEngine.enabled); | 144 setChecked("adblockplus-sync", syncEngine && syncEngine.enabled); |
| 137 addCommandHandler("adblockplus-sync", function() | 145 addCommandHandler("adblockplus-sync", function() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 152 // Load subscriptions data | 160 // Load subscriptions data |
| 153 let request = new XMLHttpRequest(); | 161 let request = new XMLHttpRequest(); |
| 154 request.mozBackgroundRequest = true; | 162 request.mozBackgroundRequest = true; |
| 155 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml")
; | 163 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml")
; |
| 156 request.addEventListener("load", function() | 164 request.addEventListener("load", function() |
| 157 { | 165 { |
| 158 if (onShutdown.done) | 166 if (onShutdown.done) |
| 159 return; | 167 return; |
| 160 | 168 |
| 161 let currentSubscription = FilterStorage.subscriptions.filter((subscrip
tion) => subscription instanceof DownloadableSubscription && | 169 let currentSubscription = FilterStorage.subscriptions.filter((subscrip
tion) => subscription instanceof DownloadableSubscription && |
| 162 subscription.url != Prefs.subscriptions_exceptionsurl && | 170 subscription.url != Prefs.subscriptions_exceptionsurl && |
| 163 subscription.url != Prefs.subscriptions_antiadblockurl); | 171 subscription.url != Prefs.subscriptions_antiadblockurl); |
| 164 currentSubscription = (currentSubscription.length ? currentSubscriptio
n[0] : null); | 172 currentSubscription = (currentSubscription.length ? currentSubscriptio
n[0] : null); |
| 165 | 173 |
| 166 let subscriptions =request.responseXML.getElementsByTagName("subscript
ion"); | 174 let subscriptions =request.responseXML.getElementsByTagName("subscript
ion"); |
| 167 for (let i = 0; i < subscriptions.length; i++) | 175 for (let i = 0; i < subscriptions.length; i++) |
| 168 { | 176 { |
| 169 let item = subscriptions[i]; | 177 let item = subscriptions[i]; |
| 170 let url = item.getAttribute("url"); | 178 let url = item.getAttribute("url"); |
| 171 if (!url) | 179 if (!url) |
| 172 continue; | 180 continue; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 // The icon might be added already, make sure its state is correct | 410 // The icon might be added already, make sure its state is correct |
| 403 this.updateState(); | 411 this.updateState(); |
| 404 | 412 |
| 405 // Listen for pref and filters changes | 413 // Listen for pref and filters changes |
| 406 Prefs.addListener(function(name) | 414 Prefs.addListener(function(name) |
| 407 { | 415 { |
| 408 if (name == "enabled" || name == "defaulttoolbaraction" || name == "defaul
tstatusbaraction") | 416 if (name == "enabled" || name == "defaulttoolbaraction" || name == "defaul
tstatusbaraction") |
| 409 this.updateState(); | 417 this.updateState(); |
| 410 else if (name == "showinstatusbar") | 418 else if (name == "showinstatusbar") |
| 411 { | 419 { |
| 412 for (let window in this.applicationWindows) | 420 for (let window of this.applicationWindows) |
| 413 this.updateStatusbarIcon(window); | 421 this.updateStatusbarIcon(window); |
| 414 } | 422 } |
| 415 }.bind(this)); | 423 }.bind(this)); |
| 416 FilterNotifier.addListener(function(action) | 424 FilterNotifier.addListener(function(action) |
| 417 { | 425 { |
| 418 if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(actio
n) || action == "load") | 426 if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(actio
n) || action == "load") |
| 419 this.updateState(); | 427 this.updateState(); |
| 420 }.bind(this)); | 428 }.bind(this)); |
| 421 | 429 |
| 422 notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); | 430 Notification.addShowListener(notification => |
| 423 notificationTimer.initWithCallback(this.showNextNotification.bind(this), | 431 { |
| 424 3 * 60 * 1000, Ci.nsITimer.TYPE_ONE_SHOT)
; | 432 let window = this.currentWindow; |
| 425 onShutdown.add(() => notificationTimer.cancel()); | 433 if (!window) |
| 434 return; |
| 435 |
| 436 let button = window.document.getElementById("abp-toolbarbutton") |
| 437 || window.document.getElementById("abp-status"); |
| 438 if (!button) |
| 439 return; |
| 440 |
| 441 this._showNotification(window, button, notification); |
| 442 }); |
| 426 | 443 |
| 427 // Add "anti-adblock messages" notification | 444 // Add "anti-adblock messages" notification |
| 428 initAntiAdblockNotification(); | 445 initAntiAdblockNotification(); |
| 429 | 446 |
| 430 let documentCreationObserver = { | 447 let documentCreationObserver = { |
| 431 observe: function(subject, topic, data) | 448 observe: function(subject, topic, data) |
| 432 { | 449 { |
| 433 if (!(subject instanceof Ci.nsIDOMWindow)) | 450 if (!(subject instanceof Ci.nsIDOMWindow)) |
| 434 return; | 451 return; |
| 435 | 452 |
| 436 this.showNextNotification(subject.location.href); | 453 Notification.showNext(subject.location.href); |
| 437 }.bind(UI) | 454 }.bind(UI) |
| 438 }; | 455 }; |
| 439 Services.obs.addObserver(documentCreationObserver, "content-document-global-
created", false); | 456 Services.obs.addObserver(documentCreationObserver, "content-document-global-
created", false); |
| 440 onShutdown.add(function() | 457 onShutdown.add(function() |
| 441 { | 458 { |
| 442 Services.obs.removeObserver(documentCreationObserver, "content-document-gl
obal-created", false); | 459 Services.obs.removeObserver(documentCreationObserver, "content-document-gl
obal-created", false); |
| 443 }); | 460 }); |
| 444 | 461 |
| 445 // Execute first-run actions if a window is open already, otherwise it | 462 // Execute first-run actions if a window is open already, otherwise it |
| 446 // will happen in applyToWindow() when a window is opened. | 463 // will happen in applyToWindow() when a window is opened. |
| 447 this.firstRunActions(this.currentWindow); | 464 this.firstRunActions(this.currentWindow); |
| 448 }, | 465 }, |
| 449 | 466 |
| 450 addToolbarButton: function() | 467 addToolbarButton: function() |
| 451 { | 468 { |
| 452 let {WindowObserver} = require("windowObserver"); | 469 let {WindowObserver} = require("windowObserver"); |
| 453 new WindowObserver(this); | 470 new WindowObserver(this); |
| 454 | 471 |
| 455 let {defaultToolbarPosition} = require("appSupport"); | 472 let {defaultToolbarPosition} = require("appSupport"); |
| 456 if ("abp-toolbarbutton" in this.overlay && defaultToolbarPosition) | 473 if ("abp-toolbarbutton" in this.overlay && defaultToolbarPosition) |
| 457 { | 474 { |
| 458 try | 475 try |
| 459 { | 476 { |
| 460 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm",
null); | 477 ({CustomizableUI} = Cu.import("resource:///modules/CustomizableUI.jsm",
null)); |
| 461 } | 478 } |
| 462 catch (e) | 479 catch (e) |
| 463 { | 480 { |
| 464 // No built-in CustomizableUI API, use our own implementation. | 481 // No built-in CustomizableUI API, use our own implementation. |
| 465 ({CustomizableUI}) = require("customizableUI"); | 482 ({CustomizableUI} = require("customizableUI")); |
| 466 } | 483 } |
| 467 | 484 |
| 468 CustomizableUI.createWidget({ | 485 CustomizableUI.createWidget({ |
| 469 id: "abp-toolbarbutton", | 486 id: "abp-toolbarbutton", |
| 470 type: "custom", | 487 type: "custom", |
| 471 positionAttribute: "abp-iconposition", // For emulation only | 488 positionAttribute: "abp-iconposition", // For emulation only |
| 472 defaultArea: defaultToolbarPosition.parent, | 489 defaultArea: defaultToolbarPosition.parent, |
| 473 defaultBefore: defaultToolbarPosition.before, // For emulation only | 490 defaultBefore: defaultToolbarPosition.before, // For emulation only |
| 474 defaultAfter: defaultToolbarPosition.after, // For emulation only | 491 defaultAfter: defaultToolbarPosition.after, // For emulation only |
| 475 removable: true, | 492 removable: true, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 window.addEventListener("popupshowing", this.onPopupShowing, false); | 588 window.addEventListener("popupshowing", this.onPopupShowing, false); |
| 572 window.addEventListener("keypress", this.onKeyPress, false); | 589 window.addEventListener("keypress", this.onKeyPress, false); |
| 573 | 590 |
| 574 addBrowserLocationListener(window, function() | 591 addBrowserLocationListener(window, function() |
| 575 { | 592 { |
| 576 this.updateIconState(window, window.document.getElementById("abp-status"))
; | 593 this.updateIconState(window, window.document.getElementById("abp-status"))
; |
| 577 this.updateIconState(window, window.document.getElementById("abp-toolbarbu
tton")); | 594 this.updateIconState(window, window.document.getElementById("abp-toolbarbu
tton")); |
| 578 }.bind(this)); | 595 }.bind(this)); |
| 579 addBrowserClickListener(window, this.onBrowserClick.bind(this, window)); | 596 addBrowserClickListener(window, this.onBrowserClick.bind(this, window)); |
| 580 | 597 |
| 581 window.document.getElementById("abp-notification-close").addEventListener("c
ommand", function(event) | 598 let notificationPanel = window.document.getElementById("abp-notification"); |
| 582 { | 599 notificationPanel.addEventListener("command", function(event) |
| 583 window.document.getElementById("abp-notification").hidePopup(); | 600 { |
| 601 switch (event.target.id) |
| 602 { |
| 603 case "abp-notification-close": |
| 604 notificationPanel.classList.add("abp-closing"); |
| 605 break; |
| 606 case "abp-notification-optout": |
| 607 Notification.toggleIgnoreCategory("*", true); |
| 608 /* FALL THROUGH */ |
| 609 case "abp-notification-hide": |
| 610 notificationPanel.hidePopup(); |
| 611 break; |
| 612 } |
| 584 }, false); | 613 }, false); |
| 585 | 614 |
| 586 // First-run actions? | 615 // First-run actions? |
| 587 this.firstRunActions(window); | 616 this.firstRunActions(window); |
| 588 | 617 |
| 589 // Some people actually switch off browser.frames.enabled and are surprised | 618 // Some people actually switch off browser.frames.enabled and are surprised |
| 590 // that things stop working... | 619 // that things stop working... |
| 591 window.QueryInterface(Ci.nsIInterfaceRequestor) | 620 window.QueryInterface(Ci.nsIInterfaceRequestor) |
| 592 .getInterface(Ci.nsIWebNavigation) | 621 .getInterface(Ci.nsIWebNavigation) |
| 593 .QueryInterface(Ci.nsIDocShell) | 622 .QueryInterface(Ci.nsIDocShell) |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 let {defaultToolbarPosition} = require("appSupport"); | 1117 let {defaultToolbarPosition} = require("appSupport"); |
| 1089 CustomizableUI.addWidgetToArea("abp-toolbarbutton", defaultToolbarPosition
.parent); | 1118 CustomizableUI.addWidgetToArea("abp-toolbarbutton", defaultToolbarPosition
.parent); |
| 1090 } | 1119 } |
| 1091 }, | 1120 }, |
| 1092 | 1121 |
| 1093 /** | 1122 /** |
| 1094 * Updates Adblock Plus icon state for all windows. | 1123 * Updates Adblock Plus icon state for all windows. |
| 1095 */ | 1124 */ |
| 1096 updateState: function() | 1125 updateState: function() |
| 1097 { | 1126 { |
| 1098 for (let window in this.applicationWindows) | 1127 for (let window of this.applicationWindows) |
| 1099 { | 1128 { |
| 1100 this.updateIconState(window, window.document.getElementById("abp-status"))
; | 1129 this.updateIconState(window, window.document.getElementById("abp-status"))
; |
| 1101 this.updateIconState(window, window.document.getElementById("abp-toolbarbu
tton")); | 1130 this.updateIconState(window, window.document.getElementById("abp-toolbarbu
tton")); |
| 1102 } | 1131 } |
| 1103 }, | 1132 }, |
| 1104 | 1133 |
| 1105 /** | 1134 /** |
| 1106 * Updates Adblock Plus icon state for a single application window. | 1135 * Updates Adblock Plus icon state for a single application window. |
| 1107 */ | 1136 */ |
| 1108 updateIconState: function(/**Window*/ window, /**Element*/ icon) | 1137 updateIconState: function(/**Window*/ window, /**Element*/ icon) |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 | 1586 |
| 1558 setChecked(prefix + "disabled", !Prefs.enabled); | 1587 setChecked(prefix + "disabled", !Prefs.enabled); |
| 1559 setChecked(prefix + "frameobjects", Prefs.frameobjects); | 1588 setChecked(prefix + "frameobjects", Prefs.frameobjects); |
| 1560 setChecked(prefix + "savestats", Prefs.savestats); | 1589 setChecked(prefix + "savestats", Prefs.savestats); |
| 1561 | 1590 |
| 1562 let {defaultToolbarPosition, statusbarPosition} = require("appSupport"); | 1591 let {defaultToolbarPosition, statusbarPosition} = require("appSupport"); |
| 1563 let hasToolbar = defaultToolbarPosition; | 1592 let hasToolbar = defaultToolbarPosition; |
| 1564 let hasStatusBar = statusbarPosition; | 1593 let hasStatusBar = statusbarPosition; |
| 1565 hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar-
"); | 1594 hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar-
"); |
| 1566 hideElement(prefix + "showinstatusbar", !hasStatusBar); | 1595 hideElement(prefix + "showinstatusbar", !hasStatusBar); |
| 1596 hideElement(prefix + "shownotifications", !Prefs.notifications_showui); |
| 1567 hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || !
hasToolbar) && !hasStatusBar); | 1597 hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || !
hasToolbar) && !hasStatusBar); |
| 1568 | 1598 |
| 1569 setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); | 1599 setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); |
| 1570 setChecked(prefix + "showinstatusbar", Prefs.showinstatusbar); | 1600 setChecked(prefix + "showinstatusbar", Prefs.showinstatusbar); |
| 1601 setChecked(prefix + "shownotifications", Prefs.notifications_ignoredcategori
es.indexOf("*") == -1); |
| 1571 | 1602 |
| 1572 let {Sync} = require("sync"); | 1603 let {Sync} = require("sync"); |
| 1573 let syncEngine = Sync.getEngine(); | 1604 let syncEngine = Sync.getEngine(); |
| 1574 hideElement(prefix + "sync", !syncEngine); | 1605 hideElement(prefix + "sync", !syncEngine); |
| 1575 setChecked(prefix + "sync", syncEngine && syncEngine.enabled); | 1606 setChecked(prefix + "sync", syncEngine && syncEngine.enabled); |
| 1576 | 1607 |
| 1577 let defAction = (!window.document.popupNode || window.document.popupNode.id
== "abp-toolbarbutton" ? | 1608 let defAction = (!window.document.popupNode || window.document.popupNode.id
== "abp-toolbarbutton" ? |
| 1578 Prefs.defaulttoolbaraction : | 1609 Prefs.defaulttoolbaraction : |
| 1579 Prefs.defaultstatusbaraction); | 1610 Prefs.defaultstatusbaraction); |
| 1580 setDefault(prefix + "openbottombar", defAction == 1); | 1611 setDefault(prefix + "openbottombar", defAction == 1); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 Prefs.hideContributeButton = true; | 1883 Prefs.hideContributeButton = true; |
| 1853 | 1884 |
| 1854 for (let id of ["abp-status-contributebutton", "abp-toolbar-contributebutton
", "abp-menuitem-contributebutton"]) | 1885 for (let id of ["abp-status-contributebutton", "abp-toolbar-contributebutton
", "abp-menuitem-contributebutton"]) |
| 1855 { | 1886 { |
| 1856 let button = window.document.getElementById(id); | 1887 let button = window.document.getElementById(id); |
| 1857 if (button) | 1888 if (button) |
| 1858 button.hidden = true; | 1889 button.hidden = true; |
| 1859 } | 1890 } |
| 1860 }, | 1891 }, |
| 1861 | 1892 |
| 1862 showNextNotification: function(url) | |
| 1863 { | |
| 1864 let window = this.currentWindow; | |
| 1865 if (!window) | |
| 1866 return; | |
| 1867 | |
| 1868 let button = window.document.getElementById("abp-toolbarbutton") | |
| 1869 || window.document.getElementById("abp-status"); | |
| 1870 if (!button) | |
| 1871 return; | |
| 1872 | |
| 1873 let notification = Notification.getNextToShow(url); | |
| 1874 if (!notification) | |
| 1875 return; | |
| 1876 | |
| 1877 this._showNotification(window, button, notification); | |
| 1878 }, | |
| 1879 | |
| 1880 _showNotification: function(window, button, notification) | 1893 _showNotification: function(window, button, notification) |
| 1881 { | 1894 { |
| 1882 let panel = window.document.getElementById("abp-notification"); | 1895 let panel = window.document.getElementById("abp-notification"); |
| 1883 if (panel.state !== "closed") | 1896 if (panel.state !== "closed") |
| 1884 return; | 1897 return; |
| 1885 | 1898 |
| 1886 function insertMessage(element, text, links) | 1899 function insertMessage(element, text, links) |
| 1887 { | 1900 { |
| 1888 let match = /^(.*?)<(a|strong)>(.*?)<\/\2>(.*)$/.exec(text); | 1901 let match = /^(.*?)<(a|strong)>(.*?)<\/\2>(.*)$/.exec(text); |
| 1889 if (!match) | 1902 if (!match) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 { | 1948 { |
| 1936 event.preventDefault(); | 1949 event.preventDefault(); |
| 1937 event.stopPropagation(); | 1950 event.stopPropagation(); |
| 1938 panel.hidePopup(); | 1951 panel.hidePopup(); |
| 1939 Notification.triggerQuestionListeners(notification.id, approved) | 1952 Notification.triggerQuestionListeners(notification.id, approved) |
| 1940 Notification.markAsShown(notification.id); | 1953 Notification.markAsShown(notification.id); |
| 1941 } | 1954 } |
| 1942 window.document.getElementById("abp-notification-yes").onclick = buttonHan
dler.bind(null, true); | 1955 window.document.getElementById("abp-notification-yes").onclick = buttonHan
dler.bind(null, true); |
| 1943 window.document.getElementById("abp-notification-no").onclick = buttonHand
ler.bind(null, false); | 1956 window.document.getElementById("abp-notification-no").onclick = buttonHand
ler.bind(null, false); |
| 1944 } | 1957 } |
| 1958 else |
| 1959 Notification.markAsShown(notification.id); |
| 1945 | 1960 |
| 1946 panel.setAttribute("class", "abp-" + notification.type); | 1961 panel.setAttribute("class", "abp-" + notification.type); |
| 1947 panel.setAttribute("noautohide", notification.type === "question"); | 1962 panel.setAttribute("noautohide", notification.type === "question"); |
| 1948 panel.openPopup(button, "bottomcenter topcenter", 0, 0, false, false, null); | 1963 panel.openPopup(button, "bottomcenter topcenter", 0, 0, false, false, null); |
| 1949 } | 1964 } |
| 1950 }; | 1965 }; |
| 1951 UI.onPopupShowing = UI.onPopupShowing.bind(UI); | 1966 UI.onPopupShowing = UI.onPopupShowing.bind(UI); |
| 1952 UI.onKeyPress = UI.onKeyPress.bind(UI); | 1967 UI.onKeyPress = UI.onKeyPress.bind(UI); |
| 1953 UI.onIconClick = UI.onIconClick.bind(UI); | 1968 UI.onIconClick = UI.onIconClick.bind(UI); |
| 1954 UI.init(); | 1969 UI.init(); |
| 1955 | 1970 |
| 1956 /** | 1971 /** |
| 1957 * List of event handers to be registered for each window. For each event | 1972 * List of event handers to be registered for each window. For each event |
| 1958 * handler the element ID, event and the actual event handler are listed. | 1973 * handler the element ID, event and the actual event handler are listed. |
| 1959 * @type Array | 1974 * @type Array |
| 1960 */ | 1975 */ |
| 1961 let eventHandlers = [ | 1976 let eventHandlers = [ |
| 1962 ["abp-command-sendReport", "command", UI.openReportDialog.bind(UI)], | 1977 ["abp-command-sendReport", "command", UI.openReportDialog.bind(UI)], |
| 1963 ["abp-command-filters", "command", UI.openFiltersDialog.bind(UI)], | 1978 ["abp-command-filters", "command", UI.openFiltersDialog.bind(UI)], |
| 1964 ["abp-command-sidebar", "command", UI.toggleBottombar.bind(UI)], | 1979 ["abp-command-sidebar", "command", UI.toggleBottombar.bind(UI)], |
| 1965 ["abp-command-togglesitewhitelist", "command", function() { UI.toggleFilter(si
teWhitelist); }], | 1980 ["abp-command-togglesitewhitelist", "command", function() { UI.toggleFilter(si
teWhitelist); }], |
| 1966 ["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pa
geWhitelist); }], | 1981 ["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pa
geWhitelist); }], |
| 1967 ["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects"
)], | 1982 ["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects"
)], |
| 1968 ["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)], | 1983 ["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)], |
| 1969 ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], | 1984 ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], |
| 1970 ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], | 1985 ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], |
| 1971 ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi
nstatusbar")], | 1986 ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi
nstatusbar")], |
| 1972 ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], | 1987 ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], |
| 1973 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 1988 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
| 1974 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 1989 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], |
| 1990 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa
tegory.bind(Notification, "*", null)] |
| 1975 ]; | 1991 ]; |
| 1976 | 1992 |
| 1977 onShutdown.add(function() | 1993 onShutdown.add(function() |
| 1978 { | 1994 { |
| 1979 for (let window in UI.applicationWindows) | 1995 for (let window of UI.applicationWindows) |
| 1980 if (UI.isBottombarOpen(window)) | 1996 if (UI.isBottombarOpen(window)) |
| 1981 UI.toggleBottombar(window); | 1997 UI.toggleBottombar(window); |
| 1982 }); | 1998 }); |
| LEFT | RIGHT |