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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Load subscriptions data | 152 // Load subscriptions data |
153 let request = new XMLHttpRequest(); | 153 let request = new XMLHttpRequest(); |
154 request.mozBackgroundRequest = true; | 154 request.mozBackgroundRequest = true; |
155 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml")
; | 155 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml")
; |
156 request.addEventListener("load", function() | 156 request.addEventListener("load", function() |
157 { | 157 { |
158 if (onShutdown.done) | 158 if (onShutdown.done) |
159 return; | 159 return; |
160 | 160 |
161 let currentSubscription = FilterStorage.subscriptions.filter((subscrip
tion) => subscription instanceof DownloadableSubscription && | 161 let currentSubscription = FilterStorage.subscriptions.filter((subscrip
tion) => subscription instanceof DownloadableSubscription && |
162 subscription.url != Prefs.subscriptions_exceptionsurl && | 162 subscription.url != Prefs.subscriptions_exceptionsurl && |
163 subscription.url != Prefs.subscriptions_antiadblockurl); | 163 subscription.url != Prefs.subscriptions_antiadblockurl); |
164 currentSubscription = (currentSubscription.length ? currentSubscriptio
n[0] : null); | 164 currentSubscription = (currentSubscription.length ? currentSubscriptio
n[0] : null); |
165 | 165 |
166 let subscriptions =request.responseXML.getElementsByTagName("subscript
ion"); | 166 let subscriptions =request.responseXML.getElementsByTagName("subscript
ion"); |
167 for (let i = 0; i < subscriptions.length; i++) | 167 for (let i = 0; i < subscriptions.length; i++) |
168 { | 168 { |
169 let item = subscriptions[i]; | 169 let item = subscriptions[i]; |
170 let url = item.getAttribute("url"); | 170 let url = item.getAttribute("url"); |
171 if (!url) | 171 if (!url) |
172 continue; | 172 continue; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 addToolbarButton: function() | 459 addToolbarButton: function() |
460 { | 460 { |
461 let {WindowObserver} = require("windowObserver"); | 461 let {WindowObserver} = require("windowObserver"); |
462 new WindowObserver(this); | 462 new WindowObserver(this); |
463 | 463 |
464 let {defaultToolbarPosition} = require("appSupport"); | 464 let {defaultToolbarPosition} = require("appSupport"); |
465 if ("abp-toolbarbutton" in this.overlay && defaultToolbarPosition) | 465 if ("abp-toolbarbutton" in this.overlay && defaultToolbarPosition) |
466 { | 466 { |
467 try | 467 try |
468 { | 468 { |
469 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm",
null); | 469 ({CustomizableUI} = Cu.import("resource:///modules/CustomizableUI.jsm",
null)); |
470 } | 470 } |
471 catch (e) | 471 catch (e) |
472 { | 472 { |
473 // No built-in CustomizableUI API, use our own implementation. | 473 // No built-in CustomizableUI API, use our own implementation. |
474 ({CustomizableUI}) = require("customizableUI"); | 474 ({CustomizableUI} = require("customizableUI")); |
475 } | 475 } |
476 | 476 |
477 CustomizableUI.createWidget({ | 477 CustomizableUI.createWidget({ |
478 id: "abp-toolbarbutton", | 478 id: "abp-toolbarbutton", |
479 type: "custom", | 479 type: "custom", |
480 positionAttribute: "abp-iconposition", // For emulation only | 480 positionAttribute: "abp-iconposition", // For emulation only |
481 defaultArea: defaultToolbarPosition.parent, | 481 defaultArea: defaultToolbarPosition.parent, |
482 defaultBefore: defaultToolbarPosition.before, // For emulation only | 482 defaultBefore: defaultToolbarPosition.before, // For emulation only |
483 defaultAfter: defaultToolbarPosition.after, // For emulation only | 483 defaultAfter: defaultToolbarPosition.after, // For emulation only |
484 removable: true, | 484 removable: true, |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 1956 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
1957 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 1957 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] |
1958 ]; | 1958 ]; |
1959 | 1959 |
1960 onShutdown.add(function() | 1960 onShutdown.add(function() |
1961 { | 1961 { |
1962 for (let window of UI.applicationWindows) | 1962 for (let window of UI.applicationWindows) |
1963 if (UI.isBottombarOpen(window)) | 1963 if (UI.isBottombarOpen(window)) |
1964 UI.toggleBottombar(window); | 1964 UI.toggleBottombar(window); |
1965 }); | 1965 }); |
OLD | NEW |