| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
| 3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 let parent = window.document.getElementById("messagepanebox"); | 478 let parent = window.document.getElementById("messagepanebox"); |
| 479 if (!parent || !(parent.compareDocumentPosition(browser) & Ci.nsIDOMNode.D
OCUMENT_POSITION_CONTAINED_BY)) | 479 if (!parent || !(parent.compareDocumentPosition(browser) & Ci.nsIDOMNode.D
OCUMENT_POSITION_CONTAINED_BY)) |
| 480 parent = browser.parentNode; | 480 parent = browser.parentNode; |
| 481 | 481 |
| 482 _addBottomBar(window, parent, element); | 482 _addBottomBar(window, parent, element); |
| 483 }; | 483 }; |
| 484 | 484 |
| 485 exports.removeBottomBar = _removeBottomBar; | 485 exports.removeBottomBar = _removeBottomBar; |
| 486 | 486 |
| 487 function BrowserChangeListener(window, callback) | 487 let BrowserChangeListener = function(window, callback) |
| 488 { | 488 { |
| 489 this.window = window; | 489 this.window = window; |
| 490 this.callback = callback; | 490 this.callback = callback; |
| 491 this.onSelect = this.onSelect.bind(this); | 491 this.onSelect = this.onSelect.bind(this); |
| 492 this.attach(); | 492 this.attach(); |
| 493 }; | 493 }; |
| 494 BrowserChangeListener.prototype = { | 494 BrowserChangeListener.prototype = { |
| 495 window: null, | 495 window: null, |
| 496 callback: null, | 496 callback: null, |
| 497 currentBrowser: null, | 497 currentBrowser: null, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } | 684 } |
| 685 | 685 |
| 686 case "fennec2": | 686 case "fennec2": |
| 687 { | 687 { |
| 688 exports.isKnownWindow = function fmn_isKnownWindow(/**Window*/ window) windo
w.document.documentElement.id == "main-window"; | 688 exports.isKnownWindow = function fmn_isKnownWindow(/**Window*/ window) windo
w.document.documentElement.id == "main-window"; |
| 689 | 689 |
| 690 exports.getBrowser = function fmn_getBrowser(window) window.BrowserApp.selec
tedBrowser; | 690 exports.getBrowser = function fmn_getBrowser(window) window.BrowserApp.selec
tedBrowser; |
| 691 | 691 |
| 692 exports.addTab = function fmn_addTab(window, url, event) window.BrowserApp.a
ddTab(url, {selected: true}); | 692 exports.addTab = function fmn_addTab(window, url, event) window.BrowserApp.a
ddTab(url, {selected: true}); |
| 693 | 693 |
| 694 function BrowserChangeListener(window, callback) | 694 let BrowserChangeListener = function(window, callback) |
| 695 { | 695 { |
| 696 this.window = window; | 696 this.window = window; |
| 697 this.callback = callback; | 697 this.callback = callback; |
| 698 this.onSelect = this.onSelect.bind(this); | 698 this.onSelect = this.onSelect.bind(this); |
| 699 this.attach(); | 699 this.attach(); |
| 700 }; | 700 }; |
| 701 BrowserChangeListener.prototype = { | 701 BrowserChangeListener.prototype = { |
| 702 window: null, | 702 window: null, |
| 703 callback: null, | 703 callback: null, |
| 704 currentBrowser: null, | 704 currentBrowser: null, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 | 828 |
| 829 clickListeners.delete(window); | 829 clickListeners.delete(window); |
| 830 }; | 830 }; |
| 831 | 831 |
| 832 let {Filter} = require("filterClasses"); | 832 let {Filter} = require("filterClasses"); |
| 833 let {Prefs} = require("prefs"); | 833 let {Prefs} = require("prefs"); |
| 834 let {Policy} = require("contentPolicy"); | 834 let {Policy} = require("contentPolicy"); |
| 835 let {UI} = require("ui"); | 835 let {UI} = require("ui"); |
| 836 let {Utils} = require("utils"); | 836 let {Utils} = require("utils"); |
| 837 | 837 |
| 838 function toggleWhitelist(window) | 838 let toggleWhitelist = function(window) |
| 839 { | 839 { |
| 840 if (!Prefs.enabled) | 840 if (!Prefs.enabled) |
| 841 { | 841 { |
| 842 Prefs.enabled = true; | 842 Prefs.enabled = true; |
| 843 return; | 843 return; |
| 844 } | 844 } |
| 845 | 845 |
| 846 let location = exports.getCurrentLocation(window); | 846 let location = exports.getCurrentLocation(window); |
| 847 let host = null; | 847 let host = null; |
| 848 if (location instanceof Ci.nsIURL && Policy.isBlockableScheme(location)) | 848 if (location instanceof Ci.nsIURL && Policy.isBlockableScheme(location)) |
| 849 { | 849 { |
| 850 try | 850 try |
| 851 { | 851 { |
| 852 host = location.host.replace(/^www\./, ""); | 852 host = location.host.replace(/^www\./, ""); |
| 853 } catch (e) {} | 853 } catch (e) {} |
| 854 } | 854 } |
| 855 | 855 |
| 856 if (!host) | 856 if (!host) |
| 857 return; | 857 return; |
| 858 | 858 |
| 859 if (Policy.isWhitelisted(location.spec)) | 859 if (Policy.isWhitelisted(location.spec)) |
| 860 UI.removeWhitelist(window); | 860 UI.removeWhitelist(window); |
| 861 else | 861 else |
| 862 UI.toggleFilter(Filter.fromText("@@||" + host + "^$document")); | 862 UI.toggleFilter(Filter.fromText("@@||" + host + "^$document")); |
| 863 } | 863 }; |
| 864 | 864 |
| 865 let menuItem = null; | 865 let menuItem = null; |
| 866 onShutdown.add(function() | 866 onShutdown.add(function() |
| 867 { | 867 { |
| 868 let window = null; | 868 let window = null; |
| 869 for (window in UI.applicationWindows) | 869 for (window in UI.applicationWindows) |
| 870 break; | 870 break; |
| 871 | 871 |
| 872 if (window && menuItem) | 872 if (window && menuItem) |
| 873 window.NativeWindow.menu.remove(menuItem); | 873 window.NativeWindow.menu.remove(menuItem); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 { | 916 { |
| 917 let dialogTitle = this.overlay.attributes.subscriptionDialogTitle; | 917 let dialogTitle = this.overlay.attributes.subscriptionDialogTitle; |
| 918 let dialogMessage = this.overlay.attributes.subscriptionDialogMessage.repl
ace(/\?1\?/, title).replace(/\?2\?/, url); | 918 let dialogMessage = this.overlay.attributes.subscriptionDialogMessage.repl
ace(/\?1\?/, title).replace(/\?2\?/, url); |
| 919 if (Utils.confirm(window, dialogMessage, dialogTitle)) | 919 if (Utils.confirm(window, dialogMessage, dialogTitle)) |
| 920 this.setSubscription(url, title); | 920 this.setSubscription(url, title); |
| 921 }; | 921 }; |
| 922 | 922 |
| 923 break; | 923 break; |
| 924 } | 924 } |
| 925 } | 925 } |
| OLD | NEW |