| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * This Source Code is subject to the terms of the Mozilla Public License |    2  * This Source Code is subject to the terms of the Mozilla Public License | 
|    3  * version 2.0 (the "License"). You can obtain a copy of the License at |    3  * version 2.0 (the "License"). You can obtain a copy of the License at | 
|    4  * http://mozilla.org/MPL/2.0/. |    4  * http://mozilla.org/MPL/2.0/. | 
|    5  */ |    5  */ | 
|    6  |    6  | 
|    7 let {Prefs} = require("prefs"); |    7 let {Prefs} = require("prefs"); | 
|    8  |    8  | 
|    9 let domainData; |    9 let domainData; | 
|   10 let nodeData; |   10 let nodeData; | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   94   }; |   94   }; | 
|   95 } |   95 } | 
|   96  |   96  | 
|   97 function createPropertyProxy(obj, orig, key) { |   97 function createPropertyProxy(obj, orig, key) { | 
|   98   if (typeof orig[key] == "function") { |   98   if (typeof orig[key] == "function") { | 
|   99     obj[key] = function() { |   99     obj[key] = function() { | 
|  100       return orig[key].apply(orig, arguments); |  100       return orig[key].apply(orig, arguments); | 
|  101     }; |  101     }; | 
|  102   } |  102   } | 
|  103   else { |  103   else { | 
|  104     obj.__defineGetter__(key, function() { |  104     Object.defineProperty(obj, key, { | 
|  105       return orig[key]; |  105       get: () => orig[key], | 
|  106     }); |  106       set: value => { orig[key] = value; }, | 
|  107     obj.__defineSetter__(key, function(value) { |  107       enumerable: true | 
|  108       orig[key] = value; |  | 
|  109     }); |  108     }); | 
|  110   } |  109   } | 
|  111 } |  110 } | 
|  112  |  111  | 
|  113 function TreeView_getRowProperties(row) { |  112 function TreeView_getRowProperties(row) { | 
|  114   let properties = "selected-" + this.selection.isSelected(row); |  113   let properties = "selected-" + this.selection.isSelected(row); | 
|  115  |  114  | 
|  116   var item = this.getItemAtIndex(row); |  115   var item = this.getItemAtIndex(row); | 
|  117   if (item && (item.nodeData.expression != "*" || item.nodeData == nodeData)) |  116   if (item && (item.nodeData.expression != "*" || item.nodeData == nodeData)) | 
|  118     properties += " anchor"; |  117     properties += " anchor"; | 
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  242           else if (attr.value.substr(0, attr.selected.length) == attr.selected) |  241           else if (attr.value.substr(0, attr.selected.length) == attr.selected) | 
|  243             op = "^="; |  242             op = "^="; | 
|  244           else if (attr.value.substr(attr.value.length - attr.selected.length) =
     = attr.selected) |  243           else if (attr.value.substr(attr.value.length - attr.selected.length) =
     = attr.selected) | 
|  245             op = "$="; |  244             op = "$="; | 
|  246    |  245    | 
|  247           let useFallback = false; |  246           let useFallback = false; | 
|  248           if (attr.name == "id" && op == "=") |  247           if (attr.name == "id" && op == "=") | 
|  249             expression += "#" + escapeName(attr.selected).replace(/^([^a-zA-Z\\]
     )/, escapeChar).replace(/\\(\s)$/, escapeChar); |  248             expression += "#" + escapeName(attr.selected).replace(/^([^a-zA-Z\\]
     )/, escapeChar).replace(/\\(\s)$/, escapeChar); | 
|  250           else if (attr.name == "class" && /\S/.test(attr.selected)) |  249           else if (attr.name == "class" && /\S/.test(attr.selected)) | 
|  251           { |  250           { | 
|  252             let knownClasses = {}; |  251             let knownClasses = new Set(attr.value.split(/\s+/)); | 
|  253             for each (let cls in attr.value.split(/\s+/)) |  252             let classes = attr.selected.split(/\s+/).filter(cls => cls != ""); | 
|  254               knownClasses[cls] = true; |  253             if (classes.every(cls => knownClasses.has(cls))) | 
|  255  |  | 
|  256             let classes = attr.selected.split(/\s+/).filter(function(cls) cls !=
      ""); |  | 
|  257             if (classes.every(function(cls) knownClasses.hasOwnProperty(cls))) |  | 
|  258               expression += "." + classes.map(escapeName).join("."); |  254               expression += "." + classes.map(escapeName).join("."); | 
|  259             else |  255             else | 
|  260               useFallback = true; |  256               useFallback = true; | 
|  261           } |  257           } | 
|  262           else |  258           else | 
|  263             useFallback = true; |  259             useFallback = true; | 
|  264  |  260  | 
|  265           if (useFallback) |  261           if (useFallback) | 
|  266           { |  262           { | 
|  267             var escapedValue = attr.selected.replace(/(["\\])/g, '\\$1') |  263             var escapedValue = attr.selected.replace(/(["\\])/g, '\\$1') | 
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  632  |  628  | 
|  633   fillAttributes(item.nodeData); |  629   fillAttributes(item.nodeData); | 
|  634 } |  630 } | 
|  635  |  631  | 
|  636 function addExpression() |  632 function addExpression() | 
|  637 { |  633 { | 
|  638   AdblockPlus.addPatterns([document.getElementById("expression").value]); |  634   AdblockPlus.addPatterns([document.getElementById("expression").value]); | 
|  639  |  635  | 
|  640   togglePreview(false); |  636   togglePreview(false); | 
|  641 } |  637 } | 
| OLD | NEW |