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-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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 typeNode.setAttribute("value", Policy.typeDescr[type].toLowerCase().replace(
/\_/g, "-")); | 155 typeNode.setAttribute("value", Policy.typeDescr[type].toLowerCase().replace(
/\_/g, "-")); |
156 typeNode.setAttribute("label", Policy.localizedDescr[type].toLowerCase()); | 156 typeNode.setAttribute("label", Policy.localizedDescr[type].toLowerCase()); |
157 | 157 |
158 let typeMask = RegExpFilter.typeMap[Policy.typeDescr[type]]; | 158 let typeMask = RegExpFilter.typeMap[Policy.typeDescr[type]]; |
159 typeNode._defaultType = (typeMask & defaultTypes) != 0; | 159 typeNode._defaultType = (typeMask & defaultTypes) != 0; |
160 if ((isDefaultType && typeNode._defaultType) || (!isDefaultType && item.type
== type)) | 160 if ((isDefaultType && typeNode._defaultType) || (!isDefaultType && item.type
== type)) |
161 typeNode.setAttribute("checked", "true"); | 161 typeNode.setAttribute("checked", "true"); |
162 | 162 |
163 if (item.type == type) | 163 if (item.type == type) |
164 typeNode.setAttribute("disabled", "true"); | 164 typeNode.setAttribute("disabled", "true"); |
165 typeNode.addEventListener("command", function() checkboxUpdated(this), false
); | 165 typeNode.addEventListener("command", () => checkboxUpdated(typeNode), false)
; |
166 typeGroup.appendChild(typeNode); | 166 typeGroup.appendChild(typeNode); |
167 } | 167 } |
168 | 168 |
169 let collapseDefault = E("collapseDefault"); | 169 let collapseDefault = E("collapseDefault"); |
170 collapseDefault.label = collapseDefault.getAttribute(Prefs.fastcollapse ? "lab
el_no" : "label_yes"); | 170 collapseDefault.label = collapseDefault.getAttribute(Prefs.fastcollapse ? "lab
el_no" : "label_yes"); |
171 E("collapse").value = ""; | 171 E("collapse").value = ""; |
172 E("collapse").setAttribute("label", collapseDefault.label); | 172 E("collapse").setAttribute("label", collapseDefault.label); |
173 | 173 |
174 let warning = E("disabledWarning"); | 174 let warning = E("disabledWarning"); |
175 generateLinkText(warning); | 175 generateLinkText(warning); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 disabledTypes.push([typeNode._lastChange || 0, "~" + value]); | 248 disabledTypes.push([typeNode._lastChange || 0, "~" + value]); |
249 } | 249 } |
250 if (!forceEnabledTypes.length && disabledTypes.length < enabledTypes.length) | 250 if (!forceEnabledTypes.length && disabledTypes.length < enabledTypes.length) |
251 options.push.apply(options, disabledTypes); | 251 options.push.apply(options, disabledTypes); |
252 else | 252 else |
253 options.push.apply(options, enabledTypes); | 253 options.push.apply(options, enabledTypes); |
254 options.push.apply(options, forceEnabledTypes); | 254 options.push.apply(options, forceEnabledTypes); |
255 | 255 |
256 if (options.length) | 256 if (options.length) |
257 { | 257 { |
258 options.sort(function(a, b) a[0] - b[0]); | 258 options.sort((a, b) => a[0] - b[0]); |
259 filter += "$" + options.map(function(o) o[1]).join(","); | 259 filter += "$" + options.map(o => o[1]).join(","); |
260 } | 260 } |
261 } | 261 } |
262 else | 262 else |
263 { | 263 { |
264 let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMa
p.DOCUMENT; | 264 let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMa
p.DOCUMENT; |
265 let isDefaultType = (RegExpFilter.typeMap[item.typeDescr] & defaultTypes) !=
0; | 265 let isDefaultType = (RegExpFilter.typeMap[item.typeDescr] & defaultTypes) !=
0; |
266 if (!isDefaultType) | 266 if (!isDefaultType) |
267 filter += "$" + item.typeDescr.toLowerCase().replace(/\_/g, "-"); | 267 filter += "$" + item.typeDescr.toLowerCase().replace(/\_/g, "-"); |
268 } | 268 } |
269 | 269 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 * Selects or unselects all type checkboxes except those | 403 * Selects or unselects all type checkboxes except those |
404 * that are disabled. | 404 * that are disabled. |
405 */ | 405 */ |
406 function selectAllTypes(/**Boolean*/ select) | 406 function selectAllTypes(/**Boolean*/ select) |
407 { | 407 { |
408 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.n
extSibling) | 408 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.n
extSibling) |
409 if (typeNode.getAttribute("disabled") != "true") | 409 if (typeNode.getAttribute("disabled") != "true") |
410 typeNode.checked = select; | 410 typeNode.checked = select; |
411 updateFilter(); | 411 updateFilter(); |
412 } | 412 } |
OLD | NEW |