Left: | ||
Right: |
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 |
(...skipping 15 matching lines...) Expand all Loading... | |
26 let {FilterNotifier} = require("filterNotifier"); | 26 let {FilterNotifier} = require("filterNotifier"); |
27 let {RequestNotifier} = require("requestNotifier"); | 27 let {RequestNotifier} = require("requestNotifier"); |
28 let {Filter} = require("filterClasses"); | 28 let {Filter} = require("filterClasses"); |
29 let {Subscription, SpecialSubscription, DownloadableSubscription} = require("sub scriptionClasses"); | 29 let {Subscription, SpecialSubscription, DownloadableSubscription} = require("sub scriptionClasses"); |
30 let {Synchronizer} = require("synchronizer"); | 30 let {Synchronizer} = require("synchronizer"); |
31 let {KeySelector} = require("keySelector"); | 31 let {KeySelector} = require("keySelector"); |
32 let {Notification} = require("notification"); | 32 let {Notification} = require("notification"); |
33 let {initAntiAdblockNotification} = require("antiadblockInit"); | 33 let {initAntiAdblockNotification} = require("antiadblockInit"); |
34 | 34 |
35 let CustomizableUI; | 35 let CustomizableUI; |
36 try | |
37 { | |
38 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", null) ; | |
39 } | |
40 catch (e) | |
41 { | |
42 // No built-in CustomizableUI API, use our own implementation. | |
43 ({CustomizableUI}) = require("customizableUI"); | |
44 } | |
45 | 36 |
46 /** | 37 /** |
47 * Filter corresponding with "disable on site" menu item (set in fillIconMent()) . | 38 * Filter corresponding with "disable on site" menu item (set in fillIconMent()) . |
48 * @type Filter | 39 * @type Filter |
49 */ | 40 */ |
50 let siteWhitelist = null; | 41 let siteWhitelist = null; |
51 /** | 42 /** |
52 * Filter corresponding with "disable on site" menu item (set in fillIconMenu()) . | 43 * Filter corresponding with "disable on site" menu item (set in fillIconMenu()) . |
53 * @type Filter | 44 * @type Filter |
54 */ | 45 */ |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 { | 132 { |
142 this.value = UI.toggleAcceptableAds(); | 133 this.value = UI.toggleAcceptableAds(); |
143 }); | 134 }); |
144 | 135 |
145 setChecked("adblockplus-sync", syncEngine && syncEngine.enabled); | 136 setChecked("adblockplus-sync", syncEngine && syncEngine.enabled); |
146 addCommandHandler("adblockplus-sync", function() | 137 addCommandHandler("adblockplus-sync", function() |
147 { | 138 { |
148 this.value = UI.toggleSync(); | 139 this.value = UI.toggleSync(); |
149 }); | 140 }); |
150 | 141 |
151 setChecked("adblockplus-showintoolbar", UI.isToolbarIconVisible()); | 142 if (hasToolbar) |
152 addCommandHandler("adblockplus-showintoolbar", function() | |
153 { | 143 { |
154 UI.toggleToolbarIcon(); | 144 setChecked("adblockplus-showintoolbar", UI.isToolbarIconVisible()); |
155 this.value = UI.isToolbarIconVisible(); | 145 addCommandHandler("adblockplus-showintoolbar", function() |
156 }); | 146 { |
147 UI.toggleToolbarIcon(); | |
148 this.value = UI.isToolbarIconVisible(); | |
149 }); | |
150 } | |
Wladimir Palant
2014/04/25 14:32:19
Same change would have to be done in fillIconMenu(
saroyanm
2014/04/25 15:10:22
Good point, thanks.
| |
157 | 151 |
158 let list = doc.getElementById("adblockplus-subscription-list"); | 152 let list = doc.getElementById("adblockplus-subscription-list"); |
159 if (list) | 153 if (list) |
160 { | 154 { |
161 // Load subscriptions data | 155 // Load subscriptions data |
162 let request = new XMLHttpRequest(); | 156 let request = new XMLHttpRequest(); |
163 request.mozBackgroundRequest = true; | 157 request.mozBackgroundRequest = true; |
164 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml") ; | 158 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml") ; |
165 request.addEventListener("load", function() | 159 request.addEventListener("load", function() |
166 { | 160 { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 */ | 399 */ |
406 initDone: function() | 400 initDone: function() |
407 { | 401 { |
408 let {WindowObserver} = require("windowObserver"); | 402 let {WindowObserver} = require("windowObserver"); |
409 new WindowObserver(this); | 403 new WindowObserver(this); |
410 | 404 |
411 // Add toolbar icon | 405 // Add toolbar icon |
412 let {defaultToolbarPosition} = require("appSupport"); | 406 let {defaultToolbarPosition} = require("appSupport"); |
413 if ("abp-toolbarbutton" in this.overlay && defaultToolbarPosition) | 407 if ("abp-toolbarbutton" in this.overlay && defaultToolbarPosition) |
414 { | 408 { |
409 try | |
410 { | |
411 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", null); | |
412 } | |
413 catch (e) | |
414 { | |
415 // No built-in CustomizableUI API, use our own implementation. | |
416 ({CustomizableUI}) = require("customizableUI"); | |
417 } | |
418 | |
415 CustomizableUI.createWidget({ | 419 CustomizableUI.createWidget({ |
416 id: "abp-toolbarbutton", | 420 id: "abp-toolbarbutton", |
417 type: "custom", | 421 type: "custom", |
418 positionAttribute: "abp-iconposition", // For emulation only | 422 positionAttribute: "abp-iconposition", // For emulation only |
419 defaultArea: defaultToolbarPosition.parent, | 423 defaultArea: defaultToolbarPosition.parent, |
420 defaultBefore: defaultToolbarPosition.before, // For emulation only | 424 defaultBefore: defaultToolbarPosition.before, // For emulation only |
421 defaultAfter: defaultToolbarPosition.after, // For emulation only | 425 defaultAfter: defaultToolbarPosition.after, // For emulation only |
422 removable: true, | 426 removable: true, |
423 onBuild: function(document) | 427 onBuild: function(document) |
424 { | 428 { |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1912 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 1916 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
1913 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 1917 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] |
1914 ]; | 1918 ]; |
1915 | 1919 |
1916 onShutdown.add(function() | 1920 onShutdown.add(function() |
1917 { | 1921 { |
1918 for (let window in UI.applicationWindows) | 1922 for (let window in UI.applicationWindows) |
1919 if (UI.isBottombarOpen(window)) | 1923 if (UI.isBottombarOpen(window)) |
1920 UI.toggleBottombar(window); | 1924 UI.toggleBottombar(window); |
1921 }); | 1925 }); |
OLD | NEW |