Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: popup.js

Issue 29374674: Issue 4864 - Start using ESLint for adblockpluschrome (Closed)
Left Patch Set: Use var for ext declarations again Created Feb. 8, 2017, 9:02 a.m.
Right Patch Set: Use .includes again Created March 31, 2017, 8:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « options.js ('k') | qunit/.eslintrc.json » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2017 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 *
(...skipping 15 matching lines...) Expand all
29 29
30 function onLoad() 30 function onLoad()
31 { 31 {
32 ext.pages.query({active: true, lastFocusedWindow: true}, pages => 32 ext.pages.query({active: true, lastFocusedWindow: true}, pages =>
33 { 33 {
34 page = pages[0]; 34 page = pages[0];
35 35
36 // Mark page as 'local' or 'nohtml' to hide non-relevant elements 36 // Mark page as 'local' or 'nohtml' to hide non-relevant elements
37 if (!page || (page.url.protocol != "http:" && 37 if (!page || (page.url.protocol != "http:" &&
38 page.url.protocol != "https:")) 38 page.url.protocol != "https:"))
39 {
40 document.body.classList.add("local"); 39 document.body.classList.add("local");
41 }
42 else if (!require("filterComposer").isPageReady(page)) 40 else if (!require("filterComposer").isPageReady(page))
43 { 41 {
44 document.body.classList.add("nohtml"); 42 document.body.classList.add("nohtml");
45 require("messaging").getPort(window).on( 43 require("messaging").getPort(window).on(
46 "composer.ready", (message, sender) => 44 "composer.ready", (message, sender) =>
47 { 45 {
48 if (sender.page.id == page.id) 46 if (sender.page.id == page.id)
49 document.body.classList.remove("nohtml"); 47 document.body.classList.remove("nohtml");
50 } 48 }
51 ); 49 );
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 94 }
97 95
98 function toggleEnabled() 96 function toggleEnabled()
99 { 97 {
100 let disabled = document.body.classList.toggle("disabled"); 98 let disabled = document.body.classList.toggle("disabled");
101 if (disabled) 99 if (disabled)
102 { 100 {
103 let host = getDecodedHostname(page.url).replace(/^www\./, ""); 101 let host = getDecodedHostname(page.url).replace(/^www\./, "");
104 let filter = Filter.fromText("@@||" + host + "^$document"); 102 let filter = Filter.fromText("@@||" + host + "^$document");
105 if (filter.subscriptions.length && filter.disabled) 103 if (filter.subscriptions.length && filter.disabled)
106 {
107 filter.disabled = false; 104 filter.disabled = false;
108 }
109 else 105 else
110 { 106 {
111 filter.disabled = false; 107 filter.disabled = false;
112 FilterStorage.addFilter(filter); 108 FilterStorage.addFilter(filter);
113 } 109 }
114 } 110 }
115 else 111 else
116 { 112 {
117 // Remove any exception rules applying to this URL 113 // Remove any exception rules applying to this URL
118 let filter = checkWhitelisted(page); 114 let filter = checkWhitelisted(page);
(...skipping 28 matching lines...) Expand all
147 } 143 }
148 144
149 function toggleCollapse(event) 145 function toggleCollapse(event)
150 { 146 {
151 let collapser = event.currentTarget; 147 let collapser = event.currentTarget;
152 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; 148 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option];
153 collapser.parentNode.classList.toggle("collapsed"); 149 collapser.parentNode.classList.toggle("collapsed");
154 } 150 }
155 151
156 document.addEventListener("DOMContentLoaded", onLoad, false); 152 document.addEventListener("DOMContentLoaded", onLoad, false);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld