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

Delta Between Two Patch Sets: chrome/content/ui/composer.js

Issue 29333265: Issue 3478 - Hide genericblock and generichide from the composer (Closed)
Left Patch Set: Created Jan. 6, 2016, 3:32 p.m.
Right Patch Set: Hide (instead disable) generichide and genericblock Created Jan. 6, 2016, 4:12 p.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 | « no previous file | no next file » | 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-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
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 E("domainRestriction").value = docDomain; 131 E("domainRestriction").value = docDomain;
132 132
133 E("thirdParty").hidden = !thirdParty; 133 E("thirdParty").hidden = !thirdParty;
134 E("firstParty").hidden = thirdParty; 134 E("firstParty").hidden = thirdParty;
135 135
136 let typeGroup = E("typeGroup"); 136 let typeGroup = E("typeGroup");
137 let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMap. DOCUMENT; 137 let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMap. DOCUMENT;
138 let isDefaultType = (RegExpFilter.typeMap[item.type] & defaultTypes) != 0; 138 let isDefaultType = (RegExpFilter.typeMap[item.type] & defaultTypes) != 0;
139 for (let type of types) 139 for (let type of types)
140 { 140 {
141 if (type == "ELEMHIDE") 141 if (type == "ELEMHIDE" || type == "GENERICBLOCK" || type == "GENERICHIDE")
142 continue; 142 continue;
143 143
144 let typeNode = document.createElement("checkbox"); 144 let typeNode = document.createElement("checkbox");
145 typeNode.setAttribute("value", type.toLowerCase().replace(/\_/g, "-")); 145 typeNode.setAttribute("value", type.toLowerCase().replace(/\_/g, "-"));
146 typeNode.setAttribute("label", Utils.getString("type_label_" + type.toLowerC ase())); 146 typeNode.setAttribute("label", Utils.getString("type_label_" + type.toLowerC ase()));
147 147
148 let typeMask = RegExpFilter.typeMap[type]; 148 let typeMask = RegExpFilter.typeMap[type];
149 typeNode._defaultType = (typeMask & defaultTypes) != 0; 149 typeNode._defaultType = (typeMask & defaultTypes) != 0;
150 if ((isDefaultType && typeNode._defaultType) || (!isDefaultType && item.type == type)) 150 if ((isDefaultType && typeNode._defaultType) || (!isDefaultType && item.type == type))
151 typeNode.setAttribute("checked", "true"); 151 typeNode.setAttribute("checked", "true");
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 disableElement(collapse, type == "whitelist", "value", ""); 217 disableElement(collapse, type == "whitelist", "value", "");
218 if (collapse.value != "") 218 if (collapse.value != "")
219 options.push([collapse._lastChange, collapse.value]); 219 options.push([collapse._lastChange, collapse.value]);
220 220
221 let enabledTypes = []; 221 let enabledTypes = [];
222 let disabledTypes = []; 222 let disabledTypes = [];
223 let forceEnabledTypes = []; 223 let forceEnabledTypes = [];
224 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode .nextSibling) 224 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode .nextSibling)
225 { 225 {
226 let value = typeNode.getAttribute("value"); 226 let value = typeNode.getAttribute("value");
227 if (value == "document" || value == "genericblock" || value == "generichid e") 227 if (value == "document")
Thomas Greiner 2016/01/06 15:44:51 What about "elemhide"? Similar to these options "e
Sebastian Noack 2016/01/06 15:49:33 Interestingly, "ELEMHIDE" is skipped above. So no
Thomas Greiner 2016/01/06 16:07:02 I assume that's because the composer only creates
Sebastian Noack 2016/01/06 16:15:10 I wonder whether we should expose generichide and
228 disableElement(typeNode, type != "whitelist", "checked", false); 228 disableElement(typeNode, type != "whitelist", "checked", false);
229 229
230 if (!typeNode._defaultType) 230 if (!typeNode._defaultType)
231 { 231 {
232 if (typeNode.getAttribute("checked") == "true") 232 if (typeNode.getAttribute("checked") == "true")
233 forceEnabledTypes.push([typeNode._lastChange || 0, value]); 233 forceEnabledTypes.push([typeNode._lastChange || 0, value]);
234 } 234 }
235 else if (typeNode.getAttribute("checked") == "true") 235 else if (typeNode.getAttribute("checked") == "true")
236 enabledTypes.push([typeNode._lastChange || 0, value]); 236 enabledTypes.push([typeNode._lastChange || 0, value]);
237 else 237 else
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 * Selects or unselects all type checkboxes except those 393 * Selects or unselects all type checkboxes except those
394 * that are disabled. 394 * that are disabled.
395 */ 395 */
396 function selectAllTypes(/**Boolean*/ select) 396 function selectAllTypes(/**Boolean*/ select)
397 { 397 {
398 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.n extSibling) 398 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.n extSibling)
399 if (typeNode.getAttribute("disabled") != "true") 399 if (typeNode.getAttribute("disabled") != "true")
400 typeNode.checked = select; 400 typeNode.checked = select;
401 updateFilter(); 401 updateFilter();
402 } 402 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld