| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 | 121 |
| 122 setChecked("adblockplus-savestats", Prefs.savestats); | 122 setChecked("adblockplus-savestats", Prefs.savestats); |
| 123 addCommandHandler("adblockplus-savestats", function() | 123 addCommandHandler("adblockplus-savestats", function() |
| 124 { | 124 { |
| 125 UI.toggleSaveStats(doc.defaultView); | 125 UI.toggleSaveStats(doc.defaultView); |
| 126 this.value = Prefs.savestats; | 126 this.value = Prefs.savestats; |
| 127 }); | 127 }); |
| 128 | 128 |
| 129 let hasAcceptableAds = FilterStorage.subscriptions.some(function(subscript
ion) { | 129 let hasAcceptableAds = FilterStorage.subscriptions.some((subscription) =>
subscription instanceof DownloadableSubscription && |
| 130 return (subscription instanceof DownloadableSubscription && | 130 subscription.url == Prefs.subscriptions_exceptionsurl); |
| 131 subscription.url == Prefs.subscriptions_exceptionsurl); | |
| 132 }); | |
| 133 setChecked("adblockplus-acceptableAds", hasAcceptableAds); | 131 setChecked("adblockplus-acceptableAds", hasAcceptableAds); |
| 134 addCommandHandler("adblockplus-acceptableAds", function() | 132 addCommandHandler("adblockplus-acceptableAds", function() |
| 135 { | 133 { |
| 136 this.value = UI.toggleAcceptableAds(); | 134 this.value = UI.toggleAcceptableAds(); |
| 137 }); | 135 }); |
| 138 | 136 |
| 139 setChecked("adblockplus-sync", syncEngine && syncEngine.enabled); | 137 setChecked("adblockplus-sync", syncEngine && syncEngine.enabled); |
| 140 addCommandHandler("adblockplus-sync", function() | 138 addCommandHandler("adblockplus-sync", function() |
| 141 { | 139 { |
| 142 this.value = UI.toggleSync(); | 140 this.value = UI.toggleSync(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 154 { | 152 { |
| 155 // Load subscriptions data | 153 // Load subscriptions data |
| 156 let request = new XMLHttpRequest(); | 154 let request = new XMLHttpRequest(); |
| 157 request.mozBackgroundRequest = true; | 155 request.mozBackgroundRequest = true; |
| 158 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml")
; | 156 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml")
; |
| 159 request.addEventListener("load", function() | 157 request.addEventListener("load", function() |
| 160 { | 158 { |
| 161 if (onShutdown.done) | 159 if (onShutdown.done) |
| 162 return; | 160 return; |
| 163 | 161 |
| 164 let currentSubscription = FilterStorage.subscriptions.filter(function(
subscription) { | 162 let currentSubscription = FilterStorage.subscriptions.filter((subscrip
tion) => subscription instanceof DownloadableSubscription && |
| 165 return (subscription instanceof DownloadableSubscription && | 163 subscription.url != Prefs.subscriptions_exceptionsurl); |
| 166 subscription.url != Prefs.subscriptions_exceptionsurl); | |
| 167 }); | |
| 168 currentSubscription = (currentSubscription.length ? currentSubscriptio
n[0] : null); | 164 currentSubscription = (currentSubscription.length ? currentSubscriptio
n[0] : null); |
| 169 | 165 |
| 170 let subscriptions =request.responseXML.getElementsByTagName("subscript
ion"); | 166 let subscriptions =request.responseXML.getElementsByTagName("subscript
ion"); |
| 171 for (let i = 0; i < subscriptions.length; i++) | 167 for (let i = 0; i < subscriptions.length; i++) |
| 172 { | 168 { |
| 173 let item = subscriptions[i]; | 169 let item = subscriptions[i]; |
| 174 let url = item.getAttribute("url"); | 170 let url = item.getAttribute("url"); |
| 175 if (!url) | 171 if (!url) |
| 176 continue; | 172 continue; |
| 177 | 173 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 { | 332 { |
| 337 Utils.splitAllLabels(root); | 333 Utils.splitAllLabels(root); |
| 338 | 334 |
| 339 let specialElements = {"abp-status-popup": true, "abp-status": true, "abp-to
olbarbutton": true, "abp-menuitem": true, "abp-bottombar-container": true}; | 335 let specialElements = {"abp-status-popup": true, "abp-status": true, "abp-to
olbarbutton": true, "abp-menuitem": true, "abp-bottombar-container": true}; |
| 340 | 336 |
| 341 this.overlay = {all: []}; | 337 this.overlay = {all: []}; |
| 342 | 338 |
| 343 // Remove whitespace text nodes | 339 // Remove whitespace text nodes |
| 344 let walker = root.ownerDocument.createTreeWalker( | 340 let walker = root.ownerDocument.createTreeWalker( |
| 345 root, Ci.nsIDOMNodeFilter.SHOW_TEXT, | 341 root, Ci.nsIDOMNodeFilter.SHOW_TEXT, |
| 346 function(node) { return !/\S/.test(node.nodeValue) }, false | 342 (node) => !/\S/.test(node.nodeValue), false |
| 347 ); | 343 ); |
| 348 let whitespaceNodes = []; | 344 let whitespaceNodes = []; |
| 349 while (walker.nextNode()) | 345 while (walker.nextNode()) |
| 350 whitespaceNodes.push(walker.currentNode); | 346 whitespaceNodes.push(walker.currentNode); |
| 351 | 347 |
| 352 for (let i = 0; i < whitespaceNodes.length; i++) | 348 for (let i = 0; i < whitespaceNodes.length; i++) |
| 353 whitespaceNodes[i].parentNode.removeChild(whitespaceNodes[i]); | 349 whitespaceNodes[i].parentNode.removeChild(whitespaceNodes[i]); |
| 354 | 350 |
| 355 // Put overlay elements into appropriate fields | 351 // Put overlay elements into appropriate fields |
| 356 while (root.firstElementChild) | 352 while (root.firstElementChild) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 }.bind(this)); | 452 }.bind(this)); |
| 457 FilterNotifier.addListener(function(action) | 453 FilterNotifier.addListener(function(action) |
| 458 { | 454 { |
| 459 if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(actio
n) || action == "load") | 455 if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(actio
n) || action == "load") |
| 460 this.updateState(); | 456 this.updateState(); |
| 461 }.bind(this)); | 457 }.bind(this)); |
| 462 | 458 |
| 463 notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); | 459 notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); |
| 464 notificationTimer.initWithCallback(this.showNextNotification.bind(this), | 460 notificationTimer.initWithCallback(this.showNextNotification.bind(this), |
| 465 3 * 60 * 1000, Ci.nsITimer.TYPE_ONE_SHOT)
; | 461 3 * 60 * 1000, Ci.nsITimer.TYPE_ONE_SHOT)
; |
| 466 onShutdown.add(function() { notificationTimer.cancel(); }); | 462 onShutdown.add(() => notificationTimer.cancel()); |
| 467 | 463 |
| 468 // Add "anti-adblock messages" notification | 464 // Add "anti-adblock messages" notification |
| 469 initAntiAdblockNotification(); | 465 initAntiAdblockNotification(); |
| 470 | 466 |
| 471 let documentCreationObserver = { | 467 let documentCreationObserver = { |
| 472 observe: function(subject, topic, data) | 468 observe: function(subject, topic, data) |
| 473 { | 469 { |
| 474 if (!(subject instanceof Ci.nsIDOMWindow)) | 470 if (!(subject instanceof Ci.nsIDOMWindow)) |
| 475 return; | 471 return; |
| 476 | 472 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 let addAcceptable = (Services.vc.compare(prevVersion, "2.0") < 0); | 758 let addAcceptable = (Services.vc.compare(prevVersion, "2.0") < 0); |
| 763 let privacySubscriptions = { | 759 let privacySubscriptions = { |
| 764 "https://easylist-downloads.adblockplus.org/easyprivacy+easylist.txt": tru
e, | 760 "https://easylist-downloads.adblockplus.org/easyprivacy+easylist.txt": tru
e, |
| 765 "https://easylist-downloads.adblockplus.org/easyprivacy.txt": true, | 761 "https://easylist-downloads.adblockplus.org/easyprivacy.txt": true, |
| 766 "https://secure.fanboy.co.nz/fanboy-tracking.txt": true, | 762 "https://secure.fanboy.co.nz/fanboy-tracking.txt": true, |
| 767 "https://fanboy-adblock-list.googlecode.com/hg/fanboy-adblocklist-stats.tx
t": true, | 763 "https://fanboy-adblock-list.googlecode.com/hg/fanboy-adblocklist-stats.tx
t": true, |
| 768 "https://bitbucket.org/fanboy/fanboyadblock/raw/tip/fanboy-adblocklist-sta
ts.txt": true, | 764 "https://bitbucket.org/fanboy/fanboyadblock/raw/tip/fanboy-adblocklist-sta
ts.txt": true, |
| 769 "https://hg01.codeplex.com/fanboyadblock/raw-file/tip/fanboy-adblocklist-s
tats.txt": true, | 765 "https://hg01.codeplex.com/fanboyadblock/raw-file/tip/fanboy-adblocklist-s
tats.txt": true, |
| 770 "https://adversity.googlecode.com/hg/Adversity-Tracking.txt": true | 766 "https://adversity.googlecode.com/hg/Adversity-Tracking.txt": true |
| 771 }; | 767 }; |
| 772 if (FilterStorage.subscriptions.some(function(subscription) { | 768 if (FilterStorage.subscriptions.some((subscription) => subscription.url == P
refs.subscriptions_exceptionsurl || subscription.url in privacySubscriptions)) |
| 773 return (subscription.url == Prefs.subscriptions_exceptionsurl || | |
| 774 subscription.url in privacySubscriptions); | |
| 775 })) | |
| 776 addAcceptable = false; | 769 addAcceptable = false; |
| 777 | 770 |
| 778 // Don't add subscription if the user has a subscription already | 771 // Don't add subscription if the user has a subscription already |
| 779 let addSubscription = true; | 772 let addSubscription = true; |
| 780 if (FilterStorage.subscriptions.some(function(subscription) { | 773 if (FilterStorage.subscriptions.some((subscription) => subscription instance
of DownloadableSubscription && subscription.url != Prefs.subscriptions_exception
surl)) |
| 781 return (subscription instanceof DownloadableSubscription && | |
| 782 subscription.url != Prefs.subscriptions_exceptionsurl); | |
| 783 })) | |
| 784 addSubscription = false; | 774 addSubscription = false; |
| 785 | 775 |
| 786 // If this isn't the first run, only add subscription if the user has no cus
tom filters | 776 // If this isn't the first run, only add subscription if the user has no cus
tom filters |
| 787 if (addSubscription && Services.vc.compare(prevVersion, "0.0") > 0) | 777 if (addSubscription && Services.vc.compare(prevVersion, "0.0") > 0) |
| 788 { | 778 { |
| 789 if (FilterStorage.subscriptions.some(function(subscription) { | 779 if (FilterStorage.subscriptions.some((subscription) => subscription.url !=
Prefs.subscriptions_exceptionsurl && subscription.filters.length)) |
| 790 return (subscription.url != Prefs.subscriptions_exceptionsurl && | |
| 791 subscription.filters.length); | |
| 792 })) | |
| 793 addSubscription = false; | 780 addSubscription = false; |
| 794 } | 781 } |
| 795 | 782 |
| 796 // Add "acceptable ads" subscription | 783 // Add "acceptable ads" subscription |
| 797 if (addAcceptable) | 784 if (addAcceptable) |
| 798 { | 785 { |
| 799 let subscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl)
; | 786 let subscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl)
; |
| 800 if (subscription) | 787 if (subscription) |
| 801 { | 788 { |
| 802 subscription.title = "Allow non-intrusive advertising"; | 789 subscription.title = "Allow non-intrusive advertising"; |
| 803 FilterStorage.addSubscription(subscription); | 790 FilterStorage.addSubscription(subscription); |
| 804 if (subscription instanceof DownloadableSubscription && !subscription.la
stDownload) | 791 if (subscription instanceof DownloadableSubscription && !subscription.la
stDownload) |
| 805 Synchronizer.execute(subscription); | 792 Synchronizer.execute(subscription); |
| 806 } | 793 } |
| 807 else | 794 else |
| 808 addAcceptable = false; | 795 addAcceptable = false; |
| 809 } | 796 } |
| 810 | 797 |
| 811 // Add "anti-adblock messages" subscription | 798 // Add "anti-adblock messages" subscription for new users and users updating
from old ABP versions |
| 812 let subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl); | 799 if (Services.vc.compare(prevVersion, "2.5") < 0) |
| 813 if (subscription) | 800 { |
| 814 { | 801 let subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl
); |
| 815 subscription.disabled = true; | 802 if (subscription && !(subscription.url in FilterStorage.knownSubscriptions
)) |
| 816 FilterStorage.addSubscription(subscription); | 803 { |
| 817 if (subscription instanceof DownloadableSubscription && !subscription.last
Download) | 804 subscription.disabled = true; |
| 818 Synchronizer.execute(subscription); | 805 FilterStorage.addSubscription(subscription); |
| 806 if (subscription instanceof DownloadableSubscription && !subscription.la
stDownload) |
| 807 Synchronizer.execute(subscription); |
| 808 } |
| 819 } | 809 } |
| 820 | 810 |
| 821 if (!addSubscription && !addAcceptable) | 811 if (!addSubscription && !addAcceptable) |
| 822 return; | 812 return; |
| 823 | 813 |
| 824 function notifyUser() | 814 function notifyUser() |
| 825 { | 815 { |
| 826 let {addTab} = require("appSupport"); | 816 let {addTab} = require("appSupport"); |
| 827 if (addTab) | 817 if (addTab) |
| 828 { | 818 { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 if (!icon) | 1069 if (!icon) |
| 1080 return; | 1070 return; |
| 1081 | 1071 |
| 1082 let state = (Prefs.enabled ? "active" : "disabled"); | 1072 let state = (Prefs.enabled ? "active" : "disabled"); |
| 1083 if (state == "active") | 1073 if (state == "active") |
| 1084 { | 1074 { |
| 1085 let location = this.getCurrentLocation(window); | 1075 let location = this.getCurrentLocation(window); |
| 1086 if (location && Policy.isWhitelisted(location.spec)) | 1076 if (location && Policy.isWhitelisted(location.spec)) |
| 1087 state = "whitelisted"; | 1077 state = "whitelisted"; |
| 1088 } | 1078 } |
| 1089 | 1079 |
| 1080 let popupId = "abp-status-popup"; |
| 1090 if (icon.localName == "statusbarpanel") | 1081 if (icon.localName == "statusbarpanel") |
| 1091 { | 1082 { |
| 1092 if (Prefs.defaultstatusbaraction == 0) | 1083 if (Prefs.defaultstatusbaraction == 0) |
| 1093 icon.setAttribute("popup", icon.getAttribute("context")); | 1084 { |
| 1085 icon.setAttribute("popup", popupId); |
| 1086 icon.removeAttribute("context"); |
| 1087 } |
| 1094 else | 1088 else |
| 1089 { |
| 1095 icon.removeAttribute("popup"); | 1090 icon.removeAttribute("popup"); |
| 1091 icon.setAttribute("context", popupId); |
| 1092 } |
| 1096 } | 1093 } |
| 1097 else | 1094 else |
| 1098 { | 1095 { |
| 1099 if (Prefs.defaulttoolbaraction == 0) | 1096 if (Prefs.defaulttoolbaraction == 0) |
| 1097 { |
| 1100 icon.setAttribute("type", "menu"); | 1098 icon.setAttribute("type", "menu"); |
| 1099 icon.removeAttribute("context"); |
| 1100 } |
| 1101 else | 1101 else |
| 1102 { |
| 1102 icon.setAttribute("type", "menu-button"); | 1103 icon.setAttribute("type", "menu-button"); |
| 1104 icon.setAttribute("context", popupId); |
| 1105 } |
| 1103 } | 1106 } |
| 1104 | 1107 |
| 1105 icon.setAttribute("abpstate", state); | 1108 icon.setAttribute("abpstate", state); |
| 1106 }, | 1109 }, |
| 1107 | 1110 |
| 1108 /** | 1111 /** |
| 1109 * Shows or hides status bar icons in all windows, according to pref. | 1112 * Shows or hides status bar icons in all windows, according to pref. |
| 1110 */ | 1113 */ |
| 1111 updateStatusbarIcon: function(/**Window*/ window) | 1114 updateStatusbarIcon: function(/**Window*/ window) |
| 1112 { | 1115 { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1142 Prefs[pref] = !Prefs[pref]; | 1145 Prefs[pref] = !Prefs[pref]; |
| 1143 }, | 1146 }, |
| 1144 | 1147 |
| 1145 /** | 1148 /** |
| 1146 * If the given filter is already in user's list, removes it from the list. Ot
herwise adds it. | 1149 * If the given filter is already in user's list, removes it from the list. Ot
herwise adds it. |
| 1147 */ | 1150 */ |
| 1148 toggleFilter: function(/**Filter*/ filter) | 1151 toggleFilter: function(/**Filter*/ filter) |
| 1149 { | 1152 { |
| 1150 if (filter.subscriptions.length) | 1153 if (filter.subscriptions.length) |
| 1151 { | 1154 { |
| 1152 if (filter.disabled || filter.subscriptions.some(function(subscription) { | 1155 if (filter.disabled || filter.subscriptions.some((subscription) => !(subsc
ription instanceof SpecialSubscription))) |
| 1153 return !(subscription instanceof SpecialSubscription); | |
| 1154 })) | |
| 1155 filter.disabled = !filter.disabled; | 1156 filter.disabled = !filter.disabled; |
| 1156 else | 1157 else |
| 1157 FilterStorage.removeFilter(filter); | 1158 FilterStorage.removeFilter(filter); |
| 1158 } | 1159 } |
| 1159 else | 1160 else |
| 1160 FilterStorage.addFilter(filter); | 1161 FilterStorage.addFilter(filter); |
| 1161 }, | 1162 }, |
| 1162 | 1163 |
| 1163 | 1164 |
| 1164 /** | 1165 /** |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1179 Prefs.savestats = true; | 1180 Prefs.savestats = true; |
| 1180 }, | 1181 }, |
| 1181 | 1182 |
| 1182 /** | 1183 /** |
| 1183 * Sets the current filter subscription in a single-subscription scenario, | 1184 * Sets the current filter subscription in a single-subscription scenario, |
| 1184 * all other subscriptions will be removed. | 1185 * all other subscriptions will be removed. |
| 1185 */ | 1186 */ |
| 1186 setSubscription: function(url, title) | 1187 setSubscription: function(url, title) |
| 1187 { | 1188 { |
| 1188 let subscription = Subscription.fromURL(url); | 1189 let subscription = Subscription.fromURL(url); |
| 1189 let currentSubscriptions = FilterStorage.subscriptions.filter(function(subsc
ription) { | 1190 let currentSubscriptions = FilterStorage.subscriptions.filter( |
| 1190 return (subscription instanceof DownloadableSubscription && | 1191 ((subscription) => subscription instanceof DownloadableSubscription && sub
scription.url != Prefs.subscriptions_exceptionsurl |
| 1191 subscription.url != Prefs.subscriptions_exceptionsurl); | 1192 ); |
| 1192 }); | |
| 1193 if (!subscription || currentSubscriptions.indexOf(subscription) >= 0) | 1193 if (!subscription || currentSubscriptions.indexOf(subscription) >= 0) |
| 1194 return; | 1194 return; |
| 1195 | 1195 |
| 1196 for (let i = 0; i < currentSubscriptions.length; i++) | 1196 for (let i = 0; i < currentSubscriptions.length; i++) |
| 1197 FilterStorage.removeSubscription(currentSubscriptions[i]); | 1197 FilterStorage.removeSubscription(currentSubscriptions[i]); |
| 1198 | 1198 |
| 1199 subscription.title = title; | 1199 subscription.title = title; |
| 1200 FilterStorage.addSubscription(subscription); | 1200 FilterStorage.addSubscription(subscription); |
| 1201 if (subscription instanceof DownloadableSubscription && !subscription.lastDo
wnload) | 1201 if (subscription instanceof DownloadableSubscription && !subscription.lastDo
wnload) |
| 1202 Synchronizer.execute(subscription); | 1202 Synchronizer.execute(subscription); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 return true; | 1325 return true; |
| 1326 } | 1326 } |
| 1327 return false; | 1327 return false; |
| 1328 }, | 1328 }, |
| 1329 | 1329 |
| 1330 /** | 1330 /** |
| 1331 * Updates state of the icon tooltip. | 1331 * Updates state of the icon tooltip. |
| 1332 */ | 1332 */ |
| 1333 fillIconTooltip: function(/**Event*/ event, /**Window*/ window) | 1333 fillIconTooltip: function(/**Event*/ event, /**Window*/ window) |
| 1334 { | 1334 { |
| 1335 function E(id) { | 1335 let E = (id) => window.document.getElementById(id); |
| 1336 return window.document.getElementById(id); | |
| 1337 } | |
| 1338 | 1336 |
| 1339 let node = window.document.tooltipNode; | 1337 let node = window.document.tooltipNode; |
| 1340 if (!node || !node.hasAttribute("tooltip")) | 1338 if (!node || !node.hasAttribute("tooltip")) |
| 1341 { | 1339 { |
| 1342 event.preventDefault(); | 1340 event.preventDefault(); |
| 1343 return; | 1341 return; |
| 1344 } | 1342 } |
| 1345 | 1343 |
| 1346 // Prevent tooltip from overlapping menu | 1344 // Prevent tooltip from overlapping menu |
| 1347 for (let id of ["abp-toolbar-popup", "abp-status-popup"]) | 1345 for (let id of ["abp-toolbar-popup", "abp-status-popup"]) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1365 actionDescr.setAttribute("value", Utils.getString("action" + action + "_to
oltip")); | 1363 actionDescr.setAttribute("value", Utils.getString("action" + action + "_to
oltip")); |
| 1366 | 1364 |
| 1367 let statusDescr = E("abp-tooltip-status"); | 1365 let statusDescr = E("abp-tooltip-status"); |
| 1368 let state = node.getAttribute("abpstate"); | 1366 let state = node.getAttribute("abpstate"); |
| 1369 let statusStr = Utils.getString(state + "_tooltip"); | 1367 let statusStr = Utils.getString(state + "_tooltip"); |
| 1370 if (state == "active") | 1368 if (state == "active") |
| 1371 { | 1369 { |
| 1372 let [activeSubscriptions, activeFilters] = FilterStorage.subscriptions.red
uce(function([subscriptions, filters], current) | 1370 let [activeSubscriptions, activeFilters] = FilterStorage.subscriptions.red
uce(function([subscriptions, filters], current) |
| 1373 { | 1371 { |
| 1374 if (current instanceof SpecialSubscription) | 1372 if (current instanceof SpecialSubscription) |
| 1375 return [subscriptions, filters + current.filters.filter(function(filte
r) { return !filter.disabled; }).length]; | 1373 return [subscriptions, filters + current.filters.filter((filter) => !f
ilter.disabled).length]; |
| 1376 else if (!current.disabled && !(Prefs.subscriptions_exceptionscheckbox &
& current.url == Prefs.subscriptions_exceptionsurl)) | 1374 else if (!current.disabled && !(Prefs.subscriptions_exceptionscheckbox &
& current.url == Prefs.subscriptions_exceptionsurl)) |
| 1377 return [subscriptions + 1, filters]; | 1375 return [subscriptions + 1, filters]; |
| 1378 else | 1376 else |
| 1379 return [subscriptions, filters] | 1377 return [subscriptions, filters] |
| 1380 }, [0, 0]); | 1378 }, [0, 0]); |
| 1381 | 1379 |
| 1382 statusStr = statusStr.replace(/\?1\?/, activeSubscriptions).replace(/\?2\?
/, activeFilters); | 1380 statusStr = statusStr.replace(/\?1\?/, activeSubscriptions).replace(/\?2\?
/, activeFilters); |
| 1383 } | 1381 } |
| 1384 statusDescr.setAttribute("value", statusStr); | 1382 statusDescr.setAttribute("value", statusStr); |
| 1385 | 1383 |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 1933 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
| 1936 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 1934 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] |
| 1937 ]; | 1935 ]; |
| 1938 | 1936 |
| 1939 onShutdown.add(function() | 1937 onShutdown.add(function() |
| 1940 { | 1938 { |
| 1941 for (let window in UI.applicationWindows) | 1939 for (let window in UI.applicationWindows) |
| 1942 if (UI.isBottombarOpen(window)) | 1940 if (UI.isBottombarOpen(window)) |
| 1943 UI.toggleBottombar(window); | 1941 UI.toggleBottombar(window); |
| 1944 }); | 1942 }); |
| LEFT | RIGHT |