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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | 22 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
23 Cu.import("resource://gre/modules/Services.jsm"); | 23 Cu.import("resource://gre/modules/Services.jsm"); |
24 Cu.import("resource://gre/modules/AddonManager.jsm"); | 24 Cu.import("resource://gre/modules/AddonManager.jsm"); |
25 | 25 |
26 /** | 26 /** |
27 * Checks whether an application window is known and should get Adblock Plus | 27 * Checks whether an application window is known and should get Adblock Plus |
28 * user interface elements. | 28 * user interface elements. |
29 * @result Boolean | 29 * @result Boolean |
30 */ | 30 */ |
31 exports.isKnownWindow = function isKnownWindow(/**Window*/ window) false; | 31 exports.isKnownWindow = (/**Window*/ window) => false; |
32 | 32 |
33 /** | 33 /** |
34 * HACK: In some applications the window finishes initialization during load | 34 * HACK: In some applications the window finishes initialization during load |
35 * event processing which makes an additional delay necessary. This flag | 35 * event processing which makes an additional delay necessary. This flag |
36 * indicates that. | 36 * indicates that. |
37 * @type Boolean | 37 * @type Boolean |
38 */ | 38 */ |
39 exports.delayInitialization = false; | 39 exports.delayInitialization = false; |
40 | 40 |
41 /** | 41 /** |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 let {application} = require("info"); | 257 let {application} = require("info"); |
258 switch (application) | 258 switch (application) |
259 { | 259 { |
260 case "firefox": | 260 case "firefox": |
261 { | 261 { |
262 exports.isKnownWindow = function ff_isKnownWindow(window) | 262 exports.isKnownWindow = function ff_isKnownWindow(window) |
263 { | 263 { |
264 return (window.document.documentElement.getAttribute("windowtype") == "nav
igator:browser"); | 264 return (window.document.documentElement.getAttribute("windowtype") == "nav
igator:browser"); |
265 }; | 265 }; |
266 | 266 |
267 exports.getBrowser = function ff_getBrowser(window) window.gBrowser; | 267 exports.getBrowser = (window) => window.gBrowser; |
268 | 268 |
269 exports.addTab = function ff_addTab(window, url, event) | 269 exports.addTab = function ff_addTab(window, url, event) |
270 { | 270 { |
271 if (event) | 271 if (event) |
272 window.openNewTabWith(url, exports.getBrowser(window).contentDocument, n
ull, event, false); | 272 window.openNewTabWith(url, exports.getBrowser(window).contentDocument, n
ull, event, false); |
273 else | 273 else |
274 window.gBrowser.loadOneTab(url, {inBackground: false}); | 274 window.gBrowser.loadOneTab(url, {inBackground: false}); |
275 }; | 275 }; |
276 | 276 |
277 exports.contentContextMenu = "contentAreaContextMenu"; | 277 exports.contentContextMenu = "contentAreaContextMenu"; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 case "thunderbird": | 389 case "thunderbird": |
390 { | 390 { |
391 exports.isKnownWindow = function tb_isKnownWindow(window) | 391 exports.isKnownWindow = function tb_isKnownWindow(window) |
392 { | 392 { |
393 let type = window.document.documentElement.getAttribute("windowtype"); | 393 let type = window.document.documentElement.getAttribute("windowtype"); |
394 return (type == "mail:3pane" || type == "mail:messageWindow"); | 394 return (type == "mail:3pane" || type == "mail:messageWindow"); |
395 }; | 395 }; |
396 | 396 |
397 exports.delayInitialization = true; | 397 exports.delayInitialization = true; |
398 | 398 |
399 exports.getBrowser = function tb_getBrowser(window) window.getBrowser(); | 399 exports.getBrowser = (window) => window.getBrowser(); |
400 | 400 |
401 exports.addTab = function tb_addTab(window, url, event) | 401 exports.addTab = function tb_addTab(window, url, event) |
402 { | 402 { |
403 let tabmail = window.document.getElementById("tabmail"); | 403 let tabmail = window.document.getElementById("tabmail"); |
404 if (!tabmail) | 404 if (!tabmail) |
405 { | 405 { |
406 let wnd = Services.wm.getMostRecentWindow("mail:3pane"); | 406 let wnd = Services.wm.getMostRecentWindow("mail:3pane"); |
407 if (window) | 407 if (window) |
408 tabmail = wnd.document.getElementById("tabmail"); | 408 tabmail = wnd.document.getElementById("tabmail"); |
409 } | 409 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 listener.detach(); | 676 listener.detach(); |
677 this.listeners.delete(window); | 677 this.listeners.delete(window); |
678 } | 678 } |
679 }); | 679 }); |
680 | 680 |
681 break; | 681 break; |
682 } | 682 } |
683 | 683 |
684 case "fennec2": | 684 case "fennec2": |
685 { | 685 { |
686 exports.isKnownWindow = function fmn_isKnownWindow(/**Window*/ window) windo
w.document.documentElement.id == "main-window"; | 686 exports.isKnownWindow = (window) => window.document.documentElement.id == "m
ain-window"; |
687 | 687 |
688 exports.getBrowser = function fmn_getBrowser(window) window.BrowserApp.selec
tedBrowser; | 688 exports.getBrowser = (window) => window.BrowserApp.selectedBrowser; |
689 | 689 |
690 exports.addTab = function fmn_addTab(window, url, event) window.BrowserApp.a
ddTab(url, {selected: true}); | 690 exports.addTab = (window, url, event) => window.BrowserApp.addTab(url, {sele
cted: true}); |
691 | 691 |
692 let BrowserChangeListener = function(window, callback) | 692 let BrowserChangeListener = function(window, callback) |
693 { | 693 { |
694 this.window = window; | 694 this.window = window; |
695 this.callback = callback; | 695 this.callback = callback; |
696 this.onSelect = this.onSelect.bind(this); | 696 this.onSelect = this.onSelect.bind(this); |
697 this.attach(); | 697 this.attach(); |
698 }; | 698 }; |
699 BrowserChangeListener.prototype = { | 699 BrowserChangeListener.prototype = { |
700 window: null, | 700 window: null, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 event.state = {id: require("info").addonID}; | 939 event.state = {id: require("info").addonID}; |
940 browser._contentWindow.dispatchEvent(event); | 940 browser._contentWindow.dispatchEvent(event); |
941 }); | 941 }); |
942 }); | 942 }); |
943 }, true); | 943 }, true); |
944 }; | 944 }; |
945 | 945 |
946 break; | 946 break; |
947 } | 947 } |
948 } | 948 } |
OLD | NEW |