| LEFT | RIGHT |
| (no file at all) | |
| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 reloadDisabledScheduled = true; | 148 reloadDisabledScheduled = true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 function reloadDisabledFiltersInternal() | 151 function reloadDisabledFiltersInternal() |
| 152 { | 152 { |
| 153 reloadDisabledScheduled = false; | 153 reloadDisabledScheduled = false; |
| 154 disabledMatcher.clear(); | 154 disabledMatcher.clear(); |
| 155 | 155 |
| 156 if (Prefs.enabled) | 156 if (Prefs.enabled) |
| 157 { | 157 { |
| 158 for each (let subscription in FilterStorage.subscriptions) | 158 for (let subscription of FilterStorage.subscriptions) |
| 159 { | 159 { |
| 160 if (subscription.disabled) | 160 if (subscription.disabled) |
| 161 continue; | 161 continue; |
| 162 | 162 |
| 163 for each (let filter in subscription.filters) | 163 for (let filter of subscription.filters) |
| 164 if (filter instanceof RegExpFilter && filter.disabled) | 164 if (filter instanceof RegExpFilter && filter.disabled) |
| 165 disabledMatcher.add(filter); | 165 disabledMatcher.add(filter); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 treeView.updateFilters(); | 169 treeView.updateFilters(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Called whenever list selection changes - triggers flasher | 172 // Called whenever list selection changes - triggers flasher |
| 173 function onSelectionChange() { | 173 function onSelectionChange() { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 469 |
| 470 doBlock(); | 470 doBlock(); |
| 471 } | 471 } |
| 472 | 472 |
| 473 /** | 473 /** |
| 474 * Opens the item in a new tab. | 474 * Opens the item in a new tab. |
| 475 */ | 475 */ |
| 476 function openInTab(item, /**Event*/ event) | 476 function openInTab(item, /**Event*/ event) |
| 477 { | 477 { |
| 478 let items = (item ? [item] : treeView.getAllSelectedItems()); | 478 let items = (item ? [item] : treeView.getAllSelectedItems()); |
| 479 for each (let item in items) | 479 for (let item of items) |
| 480 { | 480 { |
| 481 if (item && item.typeDescr != "ELEMHIDE") | 481 if (item && item.typeDescr != "ELEMHIDE") |
| 482 UI.loadInBrowser(item.location, mainWin, event); | 482 UI.loadInBrowser(item.location, mainWin, event); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 function doBlock() { | 486 function doBlock() { |
| 487 var item = treeView.getSelectedItem(); | 487 var item = treeView.getSelectedItem(); |
| 488 if (!item || item.typeDescr == "ELEMHIDE") | 488 if (!item || item.typeDescr == "ELEMHIDE") |
| 489 return; | 489 return; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 myPrefs.detachsidebar = doDetach; | 665 myPrefs.detachsidebar = doDetach; |
| 666 myMainWin.document.getElementById("abp-command-sidebar").doCommand(); | 666 myMainWin.document.getElementById("abp-command-sidebar").doCommand(); |
| 667 } | 667 } |
| 668 | 668 |
| 669 // Returns items size in the document if available | 669 // Returns items size in the document if available |
| 670 function getItemSize(item) | 670 function getItemSize(item) |
| 671 { | 671 { |
| 672 if (item.filter && !item.filter.disabled && item.filter instanceof BlockingFil
ter) | 672 if (item.filter && !item.filter.disabled && item.filter instanceof BlockingFil
ter) |
| 673 return null; | 673 return null; |
| 674 | 674 |
| 675 for each (let node in item.nodes) | 675 for (let node of item.nodes) |
| 676 { | 676 { |
| 677 if (node instanceof HTMLImageElement && (node.naturalWidth || node.naturalHe
ight)) | 677 if (node instanceof HTMLImageElement && (node.naturalWidth || node.naturalHe
ight)) |
| 678 return [node.naturalWidth, node.naturalHeight]; | 678 return [node.naturalWidth, node.naturalHeight]; |
| 679 else if (node instanceof HTMLElement && (node.offsetWidth || node.offsetHeig
ht)) | 679 else if (node instanceof HTMLElement && (node.offsetWidth || node.offsetHeig
ht)) |
| 680 return [node.offsetWidth, node.offsetHeight]; | 680 return [node.offsetWidth, node.offsetHeight]; |
| 681 } | 681 } |
| 682 return null; | 682 return null; |
| 683 } | 683 } |
| 684 | 684 |
| 685 // Sort functions for the item list | 685 // Sort functions for the item list |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 setTree: function(boxObject) { | 795 setTree: function(boxObject) { |
| 796 if (!boxObject) | 796 if (!boxObject) |
| 797 return; | 797 return; |
| 798 this.boxObject = boxObject; | 798 this.boxObject = boxObject; |
| 799 this.itemsDummy = boxObject.treeBody.getAttribute("noitemslabel"); | 799 this.itemsDummy = boxObject.treeBody.getAttribute("noitemslabel"); |
| 800 this.whitelistDummy = boxObject.treeBody.getAttribute("whitelistedlabel"); | 800 this.whitelistDummy = boxObject.treeBody.getAttribute("whitelistedlabel"); |
| 801 var stringAtoms = ["col-address", "col-type", "col-filter", "col-state", "co
l-size", "col-docDomain", "col-filterSource", "state-regular", "state-filtered",
"state-whitelisted", "state-hidden", "state-hiddenexception"]; | 801 var stringAtoms = ["col-address", "col-type", "col-filter", "col-state", "co
l-size", "col-docDomain", "col-filterSource", "state-regular", "state-filtered",
"state-whitelisted", "state-hidden", "state-hiddenexception"]; |
| 802 var boolAtoms = ["selected", "dummy", "filter-disabled"]; | 802 var boolAtoms = ["selected", "dummy", "filter-disabled"]; |
| 803 var atomService = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomSer
vice); | 803 var atomService = Cc["@mozilla.org/atom-service;1"].getService(Ci.nsIAtomSer
vice); |
| 804 this.atoms = {}; | 804 this.atoms = {}; |
| 805 for each (let atom in stringAtoms) | 805 for (let atom of stringAtoms) |
| 806 this.atoms[atom] = atomService.getAtom(atom); | 806 this.atoms[atom] = atomService.getAtom(atom); |
| 807 for each (let atom in boolAtoms) | 807 for (let atom of boolAtoms) |
| 808 { | 808 { |
| 809 this.atoms[atom + "-true"] = atomService.getAtom(atom + "-true"); | 809 this.atoms[atom + "-true"] = atomService.getAtom(atom + "-true"); |
| 810 this.atoms[atom + "-false"] = atomService.getAtom(atom + "-false"); | 810 this.atoms[atom + "-false"] = atomService.getAtom(atom + "-false"); |
| 811 } | 811 } |
| 812 | 812 |
| 813 this.itemsDummyTooltip = Utils.getString("no_blocking_suggestions"); | 813 this.itemsDummyTooltip = Utils.getString("no_blocking_suggestions"); |
| 814 this.whitelistDummyTooltip = Utils.getString("whitelisted_page"); | 814 this.whitelistDummyTooltip = Utils.getString("whitelisted_page"); |
| 815 | 815 |
| 816 // Check current sort direction | 816 // Check current sort direction |
| 817 var cols = document.getElementsByTagName("treecol"); | 817 var cols = document.getElementsByTagName("treecol"); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 this.selection.select(index); | 1137 this.selection.select(index); |
| 1138 this.boxObject.ensureRowIsVisible(index); | 1138 this.boxObject.ensureRowIsVisible(index); |
| 1139 this.itemToSelect = null; | 1139 this.itemToSelect = null; |
| 1140 } | 1140 } |
| 1141 else if (!scanComplete && this.selection.currentIndex >= 0) // Keep selected
row visible while scanning | 1141 else if (!scanComplete && this.selection.currentIndex >= 0) // Keep selected
row visible while scanning |
| 1142 this.boxObject.ensureRowIsVisible(this.selection.currentIndex); | 1142 this.boxObject.ensureRowIsVisible(this.selection.currentIndex); |
| 1143 }, | 1143 }, |
| 1144 | 1144 |
| 1145 updateFilters: function() | 1145 updateFilters: function() |
| 1146 { | 1146 { |
| 1147 for each (let item in this.allData) | 1147 for (let item of this.allData) |
| 1148 { | 1148 { |
| 1149 if (item.filter instanceof RegExpFilter && item.filter.disabled) | 1149 if (item.filter instanceof RegExpFilter && item.filter.disabled) |
| 1150 delete item.filter; | 1150 delete item.filter; |
| 1151 if (!item.filter) | 1151 if (!item.filter) |
| 1152 item.filter = disabledMatcher.matchesAny(item.location, item.typeDescr,
item.docDomain, item.thirdParty); | 1152 item.filter = disabledMatcher.matchesAny(item.location, item.typeDescr,
item.docDomain, item.thirdParty); |
| 1153 } | 1153 } |
| 1154 this.refilter(); | 1154 this.refilter(); |
| 1155 }, | 1155 }, |
| 1156 | 1156 |
| 1157 /** | 1157 /** |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 return {tooltip: this.itemsDummyTooltip}; | 1262 return {tooltip: this.itemsDummyTooltip}; |
| 1263 }, | 1263 }, |
| 1264 | 1264 |
| 1265 invalidateItem: function(item) | 1265 invalidateItem: function(item) |
| 1266 { | 1266 { |
| 1267 let row = this.data.indexOf(item); | 1267 let row = this.data.indexOf(item); |
| 1268 if (row >= 0) | 1268 if (row >= 0) |
| 1269 this.boxObject.invalidateRow(row); | 1269 this.boxObject.invalidateRow(row); |
| 1270 } | 1270 } |
| 1271 } | 1271 } |
| LEFT | RIGHT |