| OLD | NEW | 
|     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 | 
|    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|    12  * GNU General Public License for more details. |    12  * GNU General Public License for more details. | 
|    13  * |    13  * | 
|    14  * You should have received a copy of the GNU General Public License |    14  * You should have received a copy of the GNU General Public License | 
|    15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. |    15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
|    16  */ |    16  */ | 
|    17  |    17  | 
|    18 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |    18 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | 
|    19 Cu.import("resource://gre/modules/Services.jsm"); |    19 Cu.import("resource://gre/modules/Services.jsm"); | 
|    20  |    20  | 
|    21 let {Utils} = require("utils"); |    21 let {Utils} = require("utils"); | 
|    22 let {Prefs} = require("prefs"); |    22 let {Prefs} = require("prefs"); | 
|    23 let {Policy} = require("contentPolicy"); |    23 let {Policy} = require("contentPolicy"); | 
|    24 let {FilterListener} = require("filterListener"); |    24 let {FilterListener} = require("filterListener"); | 
|    25 let {FilterStorage} = require("filterStorage"); |    25 let {FilterStorage} = require("filterStorage"); | 
|    26 let {FilterNotifier} = require("filterNotifier"); |    26 let {FilterNotifier} = require("filterNotifier"); | 
 |    27 let {FilterHits} = require("filterHits"); | 
|    27 let {RequestNotifier} = require("requestNotifier"); |    28 let {RequestNotifier} = require("requestNotifier"); | 
|    28 let {Filter} = require("filterClasses"); |    29 let {Filter} = require("filterClasses"); | 
|    29 let {Subscription, SpecialSubscription, DownloadableSubscription} = require("sub
      scriptionClasses"); |    30 let {Subscription, SpecialSubscription, DownloadableSubscription} = require("sub
      scriptionClasses"); | 
|    30 let {Synchronizer} = require("synchronizer"); |    31 let {Synchronizer} = require("synchronizer"); | 
|    31 let {KeySelector} = require("keySelector"); |    32 let {KeySelector} = require("keySelector"); | 
|    32 let {Notification} = require("notification"); |    33 let {Notification} = require("notification"); | 
|    33 let {initAntiAdblockNotification} = require("antiadblockInit"); |    34 let {initAntiAdblockNotification} = require("antiadblockInit"); | 
|    34  |    35  | 
|    35 let CustomizableUI; |    36 let CustomizableUI; | 
|    36 try |    37 try | 
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1147    * Toggles "Count filter hits" option. |  1148    * Toggles "Count filter hits" option. | 
|  1148    */ |  1149    */ | 
|  1149   toggleSaveStats: function(window) |  1150   toggleSaveStats: function(window) | 
|  1150   { |  1151   { | 
|  1151     if (Prefs.savestats) |  1152     if (Prefs.savestats) | 
|  1152     { |  1153     { | 
|  1153       if (!Utils.confirm(window, Utils.getString("clearStats_warning"))) |  1154       if (!Utils.confirm(window, Utils.getString("clearStats_warning"))) | 
|  1154         return; |  1155         return; | 
|  1155  |  1156  | 
|  1156       FilterStorage.resetHitCounts(); |  1157       FilterStorage.resetHitCounts(); | 
 |  1158       Prefs.savestats = false; | 
 |  1159       if(Prefs.sendstats) | 
 |  1160       { | 
 |  1161         this.toggleSendStats(); | 
 |  1162         return; | 
 |  1163       } | 
 |  1164        | 
|  1157       FilterListener.setDirty(0);   // Force saving to disk |  1165       FilterListener.setDirty(0);   // Force saving to disk | 
|  1158       Prefs.savestats = false; |  | 
|  1159     } |  1166     } | 
|  1160     else |  1167     else | 
|  1161       Prefs.savestats = true; |  1168       Prefs.savestats = true; | 
|  1162   }, |  1169   }, | 
 |  1170    | 
 |  1171   /** | 
 |  1172    * Toggles "Send stats" option. | 
 |  1173    */ | 
 |  1174   toggleSendStats: function(window) | 
 |  1175   { | 
 |  1176     if (Prefs.sendstats) | 
 |  1177     { | 
 |  1178       FilterHits.resetFilterHits(); | 
 |  1179       FilterListener.setDirty(0);   // Force saving to disk | 
 |  1180       Prefs.sendstats = false; | 
 |  1181     } | 
 |  1182     else | 
 |  1183       Prefs.sendstats = true; | 
 |  1184   }, | 
|  1163  |  1185  | 
|  1164   /** |  1186   /** | 
|  1165    * Sets the current filter subscription in a single-subscription scenario, |  1187    * Sets the current filter subscription in a single-subscription scenario, | 
|  1166    * all other subscriptions will be removed. |  1188    * all other subscriptions will be removed. | 
|  1167    */ |  1189    */ | 
|  1168   setSubscription: function(url, title) |  1190   setSubscription: function(url, title) | 
|  1169   { |  1191   { | 
|  1170     let subscription = Subscription.fromURL(url); |  1192     let subscription = Subscription.fromURL(url); | 
|  1171     let currentSubscriptions = FilterStorage.subscriptions.filter( |  1193     let currentSubscriptions = FilterStorage.subscriptions.filter( | 
|  1172       function(subscription) subscription instanceof DownloadableSubscription &&
       subscription.url != Prefs.subscriptions_exceptionsurl |  1194       function(subscription) subscription instanceof DownloadableSubscription &&
       subscription.url != Prefs.subscriptions_exceptionsurl | 
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1493         hideElement(prefix + "whitelistsite", false); |  1515         hideElement(prefix + "whitelistsite", false); | 
|  1494       } |  1516       } | 
|  1495     } |  1517     } | 
|  1496  |  1518  | 
|  1497     setDisabled("abp-command-sendReport", !location || !Policy.isBlockableScheme
      (location) || location.scheme == "mailto"); |  1519     setDisabled("abp-command-sendReport", !location || !Policy.isBlockableScheme
      (location) || location.scheme == "mailto"); | 
|  1498  |  1520  | 
|  1499     setChecked(prefix + "disabled", !Prefs.enabled); |  1521     setChecked(prefix + "disabled", !Prefs.enabled); | 
|  1500     setChecked(prefix + "frameobjects", Prefs.frameobjects); |  1522     setChecked(prefix + "frameobjects", Prefs.frameobjects); | 
|  1501     setChecked(prefix + "slowcollapse", !Prefs.fastcollapse); |  1523     setChecked(prefix + "slowcollapse", !Prefs.fastcollapse); | 
|  1502     setChecked(prefix + "savestats", Prefs.savestats); |  1524     setChecked(prefix + "savestats", Prefs.savestats); | 
 |  1525     setChecked(prefix + "sendstats", Prefs.sendstats); | 
|  1503  |  1526  | 
|  1504     let {defaultToolbarPosition, statusbarPosition} = require("appSupport"); |  1527     let {defaultToolbarPosition, statusbarPosition} = require("appSupport"); | 
|  1505     let hasToolbar = defaultToolbarPosition; |  1528     let hasToolbar = defaultToolbarPosition; | 
|  1506     let hasStatusBar = statusbarPosition; |  1529     let hasStatusBar = statusbarPosition; | 
|  1507     hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar-
      "); |  1530     hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar-
      "); | 
|  1508     hideElement(prefix + "showinstatusbar", !hasStatusBar); |  1531     hideElement(prefix + "showinstatusbar", !hasStatusBar); | 
|  1509     hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || !
      hasToolbar) && !hasStatusBar); |  1532     hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || !
      hasToolbar) && !hasStatusBar); | 
|  1510  |  1533  | 
|  1511     setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); |  1534     setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); | 
|  1512     setChecked(prefix + "showinstatusbar", Prefs.showinstatusbar); |  1535     setChecked(prefix + "showinstatusbar", Prefs.showinstatusbar); | 
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1898  */ |  1921  */ | 
|  1899 let eventHandlers = [ |  1922 let eventHandlers = [ | 
|  1900   ["abp-command-sendReport", "command", UI.openReportDialog.bind(UI)], |  1923   ["abp-command-sendReport", "command", UI.openReportDialog.bind(UI)], | 
|  1901   ["abp-command-filters", "command", UI.openFiltersDialog.bind(UI)], |  1924   ["abp-command-filters", "command", UI.openFiltersDialog.bind(UI)], | 
|  1902   ["abp-command-sidebar", "command", UI.toggleBottombar.bind(UI)], |  1925   ["abp-command-sidebar", "command", UI.toggleBottombar.bind(UI)], | 
|  1903   ["abp-command-togglesitewhitelist", "command", function() { UI.toggleFilter(si
      teWhitelist); }], |  1926   ["abp-command-togglesitewhitelist", "command", function() { UI.toggleFilter(si
      teWhitelist); }], | 
|  1904   ["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pa
      geWhitelist); }], |  1927   ["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pa
      geWhitelist); }], | 
|  1905   ["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects"
      )], |  1928   ["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects"
      )], | 
|  1906   ["abp-command-togglecollapse", "command", UI.togglePref.bind(UI, "fastcollapse
      ")], |  1929   ["abp-command-togglecollapse", "command", UI.togglePref.bind(UI, "fastcollapse
      ")], | 
|  1907   ["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)], |  1930   ["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)], | 
 |  1931   ["abp-command-togglesendstats", "command", UI.toggleSendStats.bind(UI)], | 
|  1908   ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], |  1932   ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], | 
|  1909   ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], |  1933   ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], | 
|  1910   ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi
      nstatusbar")], |  1934   ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi
      nstatusbar")], | 
|  1911   ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], |  1935   ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], | 
|  1912   ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |  1936   ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 
|  1913   ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] |  1937   ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 
|  1914 ]; |  1938 ]; | 
|  1915  |  1939  | 
|  1916 onShutdown.add(function() |  1940 onShutdown.add(function() | 
|  1917 { |  1941 { | 
|  1918   for (let window in UI.applicationWindows) |  1942   for (let window in UI.applicationWindows) | 
|  1919     if (UI.isBottombarOpen(window)) |  1943     if (UI.isBottombarOpen(window)) | 
|  1920       UI.toggleBottombar(window); |  1944       UI.toggleBottombar(window); | 
|  1921 }); |  1945 }); | 
| OLD | NEW |