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 |
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 backgroundPage = ext.backgroundPage.getWindow(); | 18 var backgroundPage = ext.backgroundPage.getWindow(); |
19 var imports = ["require", "extractHostFromURL", "openOptions"]; | 19 var imports = ["require", "extractHostFromURL"]; |
20 for (var i = 0; i < imports.length; i++) | 20 for (var i = 0; i < imports.length; i++) |
21 window[imports[i]] = backgroundPage[imports[i]]; | 21 window[imports[i]] = backgroundPage[imports[i]]; |
22 | 22 |
23 var Filter = require("filterClasses").Filter; | 23 var Filter = require("filterClasses").Filter; |
24 var FilterStorage = require("filterStorage").FilterStorage; | 24 var FilterStorage = require("filterStorage").FilterStorage; |
25 var Prefs = require("prefs").Prefs; | 25 var Prefs = require("prefs").Prefs; |
26 var isWhitelisted = require("whitelisting").isWhitelisted; | 26 var isWhitelisted = require("whitelisting").isWhitelisted; |
27 | 27 |
28 var page = null; | 28 var page = null; |
29 | 29 |
(...skipping 23 matching lines...) Expand all Loading... |
53 }); | 53 }); |
54 } | 54 } |
55 }); | 55 }); |
56 | 56 |
57 // Attach event listeners | 57 // Attach event listeners |
58 document.getElementById("enabled").addEventListener("click", toggleEnabled, fa
lse); | 58 document.getElementById("enabled").addEventListener("click", toggleEnabled, fa
lse); |
59 document.getElementById("clickhide").addEventListener("click", activateClickHi
de, false); | 59 document.getElementById("clickhide").addEventListener("click", activateClickHi
de, false); |
60 document.getElementById("clickhide-cancel").addEventListener("click", cancelCl
ickHide, false); | 60 document.getElementById("clickhide-cancel").addEventListener("click", cancelCl
ickHide, false); |
61 document.getElementById("options").addEventListener("click", function() | 61 document.getElementById("options").addEventListener("click", function() |
62 { | 62 { |
63 openOptions(); | 63 ext.showOptions(); |
64 }, false); | 64 }, false); |
65 | 65 |
66 // Set up collapsing of menu items | 66 // Set up collapsing of menu items |
67 var collapsers = document.getElementsByClassName("collapse"); | 67 var collapsers = document.getElementsByClassName("collapse"); |
68 for (var i = 0; i < collapsers.length; i++) | 68 for (var i = 0; i < collapsers.length; i++) |
69 { | 69 { |
70 var collapser = collapsers[i]; | 70 var collapser = collapsers[i]; |
71 collapser.addEventListener("click", toggleCollapse, false); | 71 collapser.addEventListener("click", toggleCollapse, false); |
72 if (!Prefs[collapser.dataset.option]) | 72 if (!Prefs[collapser.dataset.option]) |
73 document.getElementById(collapser.dataset.collapsable).classList.add("coll
apsed"); | 73 document.getElementById(collapser.dataset.collapsable).classList.add("coll
apsed"); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 document.body.classList.remove("clickhide-active"); | 124 document.body.classList.remove("clickhide-active"); |
125 page.sendMessage({type: "clickhide-deactivate"}); | 125 page.sendMessage({type: "clickhide-deactivate"}); |
126 } | 126 } |
127 | 127 |
128 function toggleCollapse(event) | 128 function toggleCollapse(event) |
129 { | 129 { |
130 var collapser = event.currentTarget; | 130 var collapser = event.currentTarget; |
131 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; | 131 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; |
132 collapser.parentNode.classList.toggle("collapsed"); | 132 collapser.parentNode.classList.toggle("collapsed"); |
133 } | 133 } |
OLD | NEW |