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

Side by Side Diff: chrome/content/ui/composer.js

Issue 29329884: Issue 3224 - Unbreak filter assistant (Closed)
Patch Set: Created Nov. 9, 2015, 1:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/content/ui/sidebar.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 nodes = null; 18 var nodesID = null;
19 var item = null; 19 var item = null;
20 var advancedMode = false; 20 var advancedMode = false;
21 21
22 function init() 22 function init()
23 { 23 {
24 [nodes, item] = window.arguments; 24 [nodesID, item] = window.arguments;
25 window.addEventListener("unload", () => Policy.deleteNodes(nodesID));
25 26
26 E("filterType").value = (!item.filter || item.filter.disabled || item.filter i nstanceof WhitelistFilter ? "filterlist" : "whitelist"); 27 E("filterType").value = (!item.filter || item.filter.disabled || item.filter i nstanceof WhitelistFilter ? "filterlist" : "whitelist");
27 E("customPattern").value = item.location; 28 E("customPattern").value = item.location;
28 29
29 let insertionPoint = E("customPatternBox"); 30 let insertionPoint = E("customPatternBox");
30 let addSuggestion = function(address) 31 let addSuggestion = function(address)
31 { 32 {
32 // Always drop protocol and www. from the suggestion 33 // Always drop protocol and www. from the suggestion
33 address = address.replace(/^[\w\-]+:\/+(?:www\.)?/, ""); 34 address = address.replace(/^[\w\-]+:\/+(?:www\.)?/, "");
34 35
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 E("patternGroup").value = ""; 335 E("patternGroup").value = "";
335 updatePatternSelection(); 336 updatePatternSelection();
336 } 337 }
337 338
338 function addFilter() { 339 function addFilter() {
339 let filter = Filter.fromText(document.getElementById("filter").value); 340 let filter = Filter.fromText(document.getElementById("filter").value);
340 filter.disabled = false; 341 filter.disabled = false;
341 342
342 FilterStorage.addFilter(filter); 343 FilterStorage.addFilter(filter);
343 344
344 if (nodes) 345 if (nodesID)
345 Policy.refilterNodes(nodes, item); 346 Policy.refilterNodes(nodesID, item);
346 347
347 return true; 348 return true;
348 } 349 }
349 350
350 function setAdvancedMode(mode) { 351 function setAdvancedMode(mode) {
351 advancedMode = mode; 352 advancedMode = mode;
352 353
353 var dialog = document.documentElement; 354 var dialog = document.documentElement;
354 dialog.setAttribute("advancedMode", advancedMode); 355 dialog.setAttribute("advancedMode", advancedMode);
355 356
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 * Selects or unselects all type checkboxes except those 393 * Selects or unselects all type checkboxes except those
393 * that are disabled. 394 * that are disabled.
394 */ 395 */
395 function selectAllTypes(/**Boolean*/ select) 396 function selectAllTypes(/**Boolean*/ select)
396 { 397 {
397 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.n extSibling) 398 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.n extSibling)
398 if (typeNode.getAttribute("disabled") != "true") 399 if (typeNode.getAttribute("disabled") != "true")
399 typeNode.checked = select; 400 typeNode.checked = select;
400 updateFilter(); 401 updateFilter();
401 } 402 }
OLDNEW
« no previous file with comments | « no previous file | chrome/content/ui/sidebar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld