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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 "use strict"; | 18 "use strict"; |
19 | 19 |
20 const {require} = ext.backgroundPage.getWindow(); | 20 const {require} = ext.backgroundPage.getWindow(); |
21 | 21 |
22 const {Filter} = require("filterClasses"); | 22 const {Filter} = require("filterClasses"); |
23 const {FilterStorage} = require("filterStorage"); | 23 const {FilterStorage} = require("filterStorage"); |
24 const {Prefs} = require("prefs"); | 24 const {Prefs} = require("prefs"); |
25 const {checkWhitelisted} = require("whitelisting"); | 25 const {checkWhitelisted} = require("whitelisting"); |
26 const {getDecodedHostname} = require("url"); | 26 const {getDecodedHostname} = require("url"); |
| 27 const {showOptions} = require("options"); |
27 | 28 |
28 let page = null; | 29 let page = null; |
29 | 30 |
30 function onLoad() | 31 function onLoad() |
31 { | 32 { |
32 ext.pages.query({active: true, lastFocusedWindow: true}, pages => | 33 ext.pages.query({active: true, lastFocusedWindow: true}, pages => |
33 { | 34 { |
34 page = pages[0]; | 35 page = pages[0]; |
35 | 36 |
36 // Mark page as 'local' or 'nohtml' to hide non-relevant elements | 37 // Mark page as 'local' or 'nohtml' to hide non-relevant elements |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 "click", toggleEnabled, false | 71 "click", toggleEnabled, false |
71 ); | 72 ); |
72 document.getElementById("clickhide").addEventListener( | 73 document.getElementById("clickhide").addEventListener( |
73 "click", activateClickHide, false | 74 "click", activateClickHide, false |
74 ); | 75 ); |
75 document.getElementById("clickhide-cancel").addEventListener( | 76 document.getElementById("clickhide-cancel").addEventListener( |
76 "click", cancelClickHide, false | 77 "click", cancelClickHide, false |
77 ); | 78 ); |
78 document.getElementById("options").addEventListener("click", () => | 79 document.getElementById("options").addEventListener("click", () => |
79 { | 80 { |
80 ext.showOptions(window.close); | 81 showOptions(window.close); |
81 }, false); | 82 }, false); |
82 | 83 |
83 // Set up collapsing of menu items | 84 // Set up collapsing of menu items |
84 for (let collapser of document.getElementsByClassName("collapse")) | 85 for (let collapser of document.getElementsByClassName("collapse")) |
85 { | 86 { |
86 collapser.addEventListener("click", toggleCollapse, false); | 87 collapser.addEventListener("click", toggleCollapse, false); |
87 if (!Prefs[collapser.dataset.option]) | 88 if (!Prefs[collapser.dataset.option]) |
88 { | 89 { |
89 document.getElementById( | 90 document.getElementById( |
90 collapser.dataset.collapsable | 91 collapser.dataset.collapsable |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 144 } |
144 | 145 |
145 function toggleCollapse(event) | 146 function toggleCollapse(event) |
146 { | 147 { |
147 let collapser = event.currentTarget; | 148 let collapser = event.currentTarget; |
148 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; | 149 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; |
149 collapser.parentNode.classList.toggle("collapsed"); | 150 collapser.parentNode.classList.toggle("collapsed"); |
150 } | 151 } |
151 | 152 |
152 document.addEventListener("DOMContentLoaded", onLoad, false); | 153 document.addEventListener("DOMContentLoaded", onLoad, false); |
OLD | NEW |