| OLD | NEW |
| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 window.addEventListener("popupshowing", this.onPopupShowing, false); | 579 window.addEventListener("popupshowing", this.onPopupShowing, false); |
| 572 window.addEventListener("keypress", this.onKeyPress, false); | 580 window.addEventListener("keypress", this.onKeyPress, false); |
| 573 | 581 |
| 574 addBrowserLocationListener(window, function() | 582 addBrowserLocationListener(window, function() |
| 575 { | 583 { |
| 576 this.updateIconState(window, window.document.getElementById("abp-status"))
; | 584 this.updateIconState(window, window.document.getElementById("abp-status"))
; |
| 577 this.updateIconState(window, window.document.getElementById("abp-toolbarbu
tton")); | 585 this.updateIconState(window, window.document.getElementById("abp-toolbarbu
tton")); |
| 578 }.bind(this)); | 586 }.bind(this)); |
| 579 addBrowserClickListener(window, this.onBrowserClick.bind(this, window)); | 587 addBrowserClickListener(window, this.onBrowserClick.bind(this, window)); |
| 580 | 588 |
| 581 window.document.getElementById("abp-notification-close").addEventListener("c
ommand", function(event) | 589 let notificationPanel = window.document.getElementById("abp-notification"); |
| 590 notificationPanel.addEventListener("command", function(event) |
| 582 { | 591 { |
| 583 window.document.getElementById("abp-notification").hidePopup(); | 592 switch (event.target.id) |
| 584 }, false); | 593 { |
| 594 case "abp-notification-close": |
| 595 notificationPanel.classList.add("abp-closing"); |
| 596 break; |
| 597 case "abp-notification-optout": |
| 598 Notification.toggleIgnoreCategory("*", true); |
| 599 case "abp-notification-hide": |
| 600 notificationPanel.hidePopup(); |
| 601 break; |
| 602 } |
| 603 }, true); |
| 585 | 604 |
| 586 // First-run actions? | 605 // First-run actions? |
| 587 this.firstRunActions(window); | 606 this.firstRunActions(window); |
| 588 | 607 |
| 589 // Some people actually switch off browser.frames.enabled and are surprised | 608 // Some people actually switch off browser.frames.enabled and are surprised |
| 590 // that things stop working... | 609 // that things stop working... |
| 591 window.QueryInterface(Ci.nsIInterfaceRequestor) | 610 window.QueryInterface(Ci.nsIInterfaceRequestor) |
| 592 .getInterface(Ci.nsIWebNavigation) | 611 .getInterface(Ci.nsIWebNavigation) |
| 593 .QueryInterface(Ci.nsIDocShell) | 612 .QueryInterface(Ci.nsIDocShell) |
| 594 .allowSubframes = true; | 613 .allowSubframes = true; |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 | 1566 |
| 1548 setChecked(prefix + "disabled", !Prefs.enabled); | 1567 setChecked(prefix + "disabled", !Prefs.enabled); |
| 1549 setChecked(prefix + "frameobjects", Prefs.frameobjects); | 1568 setChecked(prefix + "frameobjects", Prefs.frameobjects); |
| 1550 setChecked(prefix + "savestats", Prefs.savestats); | 1569 setChecked(prefix + "savestats", Prefs.savestats); |
| 1551 | 1570 |
| 1552 let {defaultToolbarPosition, statusbarPosition} = require("appSupport"); | 1571 let {defaultToolbarPosition, statusbarPosition} = require("appSupport"); |
| 1553 let hasToolbar = defaultToolbarPosition; | 1572 let hasToolbar = defaultToolbarPosition; |
| 1554 let hasStatusBar = statusbarPosition; | 1573 let hasStatusBar = statusbarPosition; |
| 1555 hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar-
"); | 1574 hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar-
"); |
| 1556 hideElement(prefix + "showinstatusbar", !hasStatusBar); | 1575 hideElement(prefix + "showinstatusbar", !hasStatusBar); |
| 1576 hideElement(prefix + "shownotifications", !Prefs.notifications_showui); |
| 1557 hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || !
hasToolbar) && !hasStatusBar); | 1577 hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || !
hasToolbar) && !hasStatusBar); |
| 1558 | 1578 |
| 1559 setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); | 1579 setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); |
| 1560 setChecked(prefix + "showinstatusbar", Prefs.showinstatusbar); | 1580 setChecked(prefix + "showinstatusbar", Prefs.showinstatusbar); |
| 1581 setChecked(prefix + "shownotifications", Prefs.notifications_ignoredcategori
es.indexOf("*") == -1); |
| 1561 | 1582 |
| 1562 let {Sync} = require("sync"); | 1583 let {Sync} = require("sync"); |
| 1563 let syncEngine = Sync.getEngine(); | 1584 let syncEngine = Sync.getEngine(); |
| 1564 hideElement(prefix + "sync", !syncEngine); | 1585 hideElement(prefix + "sync", !syncEngine); |
| 1565 setChecked(prefix + "sync", syncEngine && syncEngine.enabled); | 1586 setChecked(prefix + "sync", syncEngine && syncEngine.enabled); |
| 1566 | 1587 |
| 1567 let defAction = (!window.document.popupNode || window.document.popupNode.id
== "abp-toolbarbutton" ? | 1588 let defAction = (!window.document.popupNode || window.document.popupNode.id
== "abp-toolbarbutton" ? |
| 1568 Prefs.defaulttoolbaraction : | 1589 Prefs.defaulttoolbaraction : |
| 1569 Prefs.defaultstatusbaraction); | 1590 Prefs.defaultstatusbaraction); |
| 1570 setDefault(prefix + "openbottombar", defAction == 1); | 1591 setDefault(prefix + "openbottombar", defAction == 1); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1954 ["abp-command-sidebar", "command", UI.toggleBottombar.bind(UI)], | 1975 ["abp-command-sidebar", "command", UI.toggleBottombar.bind(UI)], |
| 1955 ["abp-command-togglesitewhitelist", "command", function() { UI.toggleFilter(si
teWhitelist); }], | 1976 ["abp-command-togglesitewhitelist", "command", function() { UI.toggleFilter(si
teWhitelist); }], |
| 1956 ["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pa
geWhitelist); }], | 1977 ["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pa
geWhitelist); }], |
| 1957 ["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects"
)], | 1978 ["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects"
)], |
| 1958 ["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)], | 1979 ["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)], |
| 1959 ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], | 1980 ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], |
| 1960 ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], | 1981 ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], |
| 1961 ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi
nstatusbar")], | 1982 ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi
nstatusbar")], |
| 1962 ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], | 1983 ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], |
| 1963 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 1984 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
| 1964 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 1985 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], |
| 1986 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa
tegory.bind(Notification, "*", null)] |
| 1965 ]; | 1987 ]; |
| 1966 | 1988 |
| 1967 onShutdown.add(function() | 1989 onShutdown.add(function() |
| 1968 { | 1990 { |
| 1969 for (let window of UI.applicationWindows) | 1991 for (let window of UI.applicationWindows) |
| 1970 if (UI.isBottombarOpen(window)) | 1992 if (UI.isBottombarOpen(window)) |
| 1971 UI.toggleBottombar(window); | 1993 UI.toggleBottombar(window); |
| 1972 }); | 1994 }); |
| OLD | NEW |