Index: chrome/content/ui/composer.js |
=================================================================== |
--- a/chrome/content/ui/composer.js |
+++ b/chrome/content/ui/composer.js |
@@ -114,28 +114,19 @@ function init() |
E("patternGroup").value = ""; |
} |
if (Prefs.composer_default == 0) |
E("customPattern").focus(); |
else |
E("patternGroup").focus(); |
let types = []; |
- for (let type in Policy.localizedDescr) |
- { |
- types.push(parseInt(type)); |
- } |
- types.sort(function(a, b) { |
- if (a < b) |
- return -1; |
- else if (a > b) |
- return 1; |
- else |
- return 0; |
- }); |
+ for (let type of Policy.localizedDescr.keys()) |
+ types.push(type); |
+ types.sort(); |
let docDomain = item.docDomain; |
let thirdParty = item.thirdParty; |
if (docDomain) |
docDomain = docDomain.replace(/^www\./i, "").replace(/\.+$/, ""); |
if (docDomain) |
E("domainRestriction").value = docDomain; |
@@ -143,24 +134,24 @@ function init() |
E("thirdParty").hidden = !thirdParty; |
E("firstParty").hidden = thirdParty; |
let typeGroup = E("typeGroup"); |
let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMap.DOCUMENT; |
let isDefaultType = (RegExpFilter.typeMap[item.typeDescr] & defaultTypes) != 0; |
for (let type of types) |
{ |
- if (type == Policy.type.ELEMHIDE) |
+ if (type == "ELEMHIDE") |
continue; |
let typeNode = document.createElement("checkbox"); |
- typeNode.setAttribute("value", Policy.typeDescr[type].toLowerCase().replace(/\_/g, "-")); |
- typeNode.setAttribute("label", Policy.localizedDescr[type].toLowerCase()); |
+ typeNode.setAttribute("value", type.toLowerCase().replace(/\_/g, "-")); |
+ typeNode.setAttribute("label", Policy.localizedDescr.get(type).toLowerCase()); |
- let typeMask = RegExpFilter.typeMap[Policy.typeDescr[type]]; |
+ let typeMask = RegExpFilter.typeMap[type]; |
typeNode._defaultType = (typeMask & defaultTypes) != 0; |
if ((isDefaultType && typeNode._defaultType) || (!isDefaultType && item.type == type)) |
typeNode.setAttribute("checked", "true"); |
if (item.type == type) |
typeNode.setAttribute("disabled", "true"); |
typeNode.addEventListener("command", () => checkboxUpdated(typeNode), false); |
typeGroup.appendChild(typeNode); |