| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = {}; |
| 253 for each (let cls in attr.value.split(/\s+/)) | 252 for (let cls of attr.value.split(/\s+/)) |
| 254 knownClasses[cls] = true; | 253 knownClasses[cls] = true; |
| 255 | 254 |
| 256 let classes = attr.selected.split(/\s+/).filter(function(cls) cls !=
""); | 255 let classes = attr.selected.split(/\s+/).filter(cls => cls != ""); |
| 257 if (classes.every(function(cls) knownClasses.hasOwnProperty(cls))) | 256 if (classes.every(cls => knownClasses.hasOwnProperty(cls))) |
| 258 expression += "." + classes.map(escapeName).join("."); | 257 expression += "." + classes.map(escapeName).join("."); |
| 259 else | 258 else |
| 260 useFallback = true; | 259 useFallback = true; |
| 261 } | 260 } |
| 262 else | 261 else |
| 263 useFallback = true; | 262 useFallback = true; |
| 264 | 263 |
| 265 if (useFallback) | 264 if (useFallback) |
| 266 { | 265 { |
| 267 var escapedValue = attr.selected.replace(/(["\\])/g, '\\$1') | 266 var escapedValue = attr.selected.replace(/(["\\])/g, '\\$1') |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 631 |
| 633 fillAttributes(item.nodeData); | 632 fillAttributes(item.nodeData); |
| 634 } | 633 } |
| 635 | 634 |
| 636 function addExpression() | 635 function addExpression() |
| 637 { | 636 { |
| 638 AdblockPlus.addPatterns([document.getElementById("expression").value]); | 637 AdblockPlus.addPatterns([document.getElementById("expression").value]); |
| 639 | 638 |
| 640 togglePreview(false); | 639 togglePreview(false); |
| 641 } | 640 } |
| OLD | NEW |