LEFT | RIGHT |
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 var require = AdblockPlus.require; | 18 var require = AdblockPlus.require; |
19 var Prefs = require("prefs").Prefs; | 19 var Prefs = require("prefs").Prefs; |
20 var Utils = require("utils").Utils; | 20 var Utils = require("utils").Utils; |
21 var Filter = require("filterClasses").Filter; | 21 var Filter = require("filterClasses").Filter; |
22 | |
23 function addListener(object, type, listener) | |
24 { | |
25 // all IE versions require the use of attachEvent for message event to work | |
26 if (type != "message" && "addEventListener" in object) | |
27 object.addEventListener(type, listener, false); | |
28 else | |
29 { | |
30 object.attachEvent("on" + type, function() | |
31 { | |
32 listener(event); | |
33 }); | |
34 } | |
35 } | |
36 | |
37 function removeListener(object, type, listener) | |
38 { | |
39 // all IE versions require the use of detachEvent for message event to work | |
40 if (type != "message" && "removeEventListener" in object) | |
41 object.removeEventListener(type, listener); | |
42 else | |
43 object.detachEvent("on" + type, listener); | |
44 } | |
45 | 22 |
46 function openSharePopup(url) | 23 function openSharePopup(url) |
47 { | 24 { |
48 var iframe = document.getElementById("share-popup"); | 25 var iframe = document.getElementById("share-popup"); |
49 var glassPane = document.getElementById("glass-pane"); | 26 var glassPane = document.getElementById("glass-pane"); |
50 var popupMessageReceived = false; | 27 var popupMessageReceived = false; |
51 | 28 |
52 var popupMessageListener = function(event) | 29 var popupMessageListener = function(event) |
53 { | 30 { |
54 var originFilter = Filter.fromText("||adblockplus.org^"); | 31 var originFilter = Filter.fromText("||adblockplus.org^"); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 classList.push("share-variant-" + variant); | 129 classList.push("share-variant-" + variant); |
153 document.documentElement.className = classList.join(" "); | 130 document.documentElement.className = classList.join(" "); |
154 | 131 |
155 initTranslations(); | 132 initTranslations(); |
156 initSocialLinks(variant); | 133 initSocialLinks(variant); |
157 | 134 |
158 var donateLink = document.getElementById("share-donate"); | 135 var donateLink = document.getElementById("share-donate"); |
159 donateLink.href = getDocLink("donate") + "&variant=" + variant; | 136 donateLink.href = getDocLink("donate") + "&variant=" + variant; |
160 } | 137 } |
161 | 138 |
162 addListener(window, "load", init); | 139 window.addEventListener("load", init); |
LEFT | RIGHT |