Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/ui/sidebar.js

Issue 29329779: Issue 3258 - Blockable items: restore item flashing functionality (Closed)
Patch Set: Created Nov. 5, 2015, 8:52 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/content/ui/sidebar.xul » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 18 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
19 19
20 // Main browser window 20 // Main browser window
21 var mainWin = parent; 21 var mainWin = parent;
22 22
23 // The window handler currently in use 23 // The window handler currently in use
24 var requestNotifier = null; 24 var requestNotifier = null;
25 25
26 var cacheStorage = null; 26 var cacheStorage = null;
27 var noFlash = false;
28 27
29 // Matcher for disabled filters 28 // Matcher for disabled filters
30 var disabledMatcher = new CombinedMatcher(); 29 var disabledMatcher = new CombinedMatcher();
31 30
32 // Cached string values 31 // Cached string values
33 var docDomainThirdParty = null; 32 var docDomainThirdParty = null;
34 var docDomainFirstParty = null; 33 var docDomainFirstParty = null;
35 34
36 // Localized type names 35 // Localized type names
37 var localizedTypes = new Map(); 36 var localizedTypes = new Map();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 function getFilter(item) 116 function getFilter(item)
118 { 117 {
119 if ("filter" in item && item.filter) 118 if ("filter" in item && item.filter)
120 return Filter.fromText(item.filter); 119 return Filter.fromText(item.filter);
121 else 120 else
122 return null; 121 return null;
123 } 122 }
124 123
125 // To be called on unload 124 // To be called on unload
126 function cleanUp() { 125 function cleanUp() {
127 flasher.stop();
128 requestNotifier.shutdown(); 126 requestNotifier.shutdown();
129 FilterNotifier.removeListener(reloadDisabledFilters); 127 FilterNotifier.removeListener(reloadDisabledFilters);
130 Prefs.removeListener(onPrefChange); 128 Prefs.removeListener(onPrefChange);
131 E("list").view = null; 129 E("list").view = null;
132 130
133 let {removeBrowserLocationListener} = require("appSupport"); 131 let {removeBrowserLocationListener} = require("appSupport");
134 if (removeBrowserLocationListener) 132 if (removeBrowserLocationListener)
135 removeBrowserLocationListener(mainWin, handleLocationChange); 133 removeBrowserLocationListener(mainWin, handleLocationChange);
136 mainWin.removeEventListener("unload", mainUnload, false); 134 mainWin.removeEventListener("unload", mainUnload, false);
137 } 135 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 else 189 else
192 E("copy-command").setAttribute("disabled", "true"); 190 E("copy-command").setAttribute("disabled", "true");
193 191
194 if (item && window.content) 192 if (item && window.content)
195 { 193 {
196 let key = item.location + " " + item.type + " " + item.docDomain; 194 let key = item.location + " " + item.type + " " + item.docDomain;
197 RequestNotifier.storeSelection(window.content, key); 195 RequestNotifier.storeSelection(window.content, key);
198 treeView.itemToSelect = null; 196 treeView.itemToSelect = null;
199 } 197 }
200 198
201 if (!noFlash) 199 if (requestNotifier)
202 flasher.flash(item ? item.nodes : null); 200 requestNotifier.flashNodes(item ? item.ids : null, Prefs.flash_scrolltoitem) ;
203 } 201 }
204 202
205 function handleLocationChange() 203 function handleLocationChange()
206 { 204 {
207 if (requestNotifier) 205 if (requestNotifier)
208 requestNotifier.shutdown(); 206 requestNotifier.shutdown();
209 207
210 treeView.clearData(); 208 treeView.clearData();
211 209
212 let {getBrowser, addBrowserLocationListener} = require("appSupport"); 210 let {getBrowser, addBrowserLocationListener} = require("appSupport");
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 addItem: function(/**RequestEntry*/ item, /**Boolean*/ scanComplete) 1080 addItem: function(/**RequestEntry*/ item, /**Boolean*/ scanComplete)
1083 { 1081 {
1084 // Merge duplicate entries 1082 // Merge duplicate entries
1085 let key = item.location + " " + item.type + " " + item.docDomain; 1083 let key = item.location + " " + item.type + " " + item.docDomain;
1086 if (key in this.dataMap) 1084 if (key in this.dataMap)
1087 { 1085 {
1088 // We know this item already - take over the filter if any and be done wit h it 1086 // We know this item already - take over the filter if any and be done wit h it
1089 let existing = this.dataMap[key]; 1087 let existing = this.dataMap[key];
1090 if (item.filter) 1088 if (item.filter)
1091 existing.filter = item.filter; 1089 existing.filter = item.filter;
1090 existing.ids.push(item.id);
1092 1091
1093 this.invalidateItem(existing); 1092 this.invalidateItem(existing);
1094 return; 1093 return;
1095 } 1094 }
1096 1095
1097 // Add new item to the list 1096 // Add new item to the list
1098 // Store original item in orig property - reading out prototype is messed up in Gecko 1.9.2 1097 // Store original item in orig property - reading out prototype is messed up in Gecko 1.9.2
1099 item = {__proto__: item, orig: item, nodes: []}; 1098 item = {__proto__: item, orig: item, nodes: [], ids: [item.id]};
1100 this.allData.push(item); 1099 this.allData.push(item);
1101 this.dataMap[key] = item; 1100 this.dataMap[key] = item;
1102 1101
1103 // Show disabled filters if no other filter applies 1102 // Show disabled filters if no other filter applies
1104 if (!item.filter) 1103 if (!item.filter)
1105 { 1104 {
1106 let disabledMatch = disabledMatcher.matchesAny(item.location, RegExpFilter .typeMap[item.type], item.docDomain, item.thirdParty); 1105 let disabledMatch = disabledMatcher.matchesAny(item.location, RegExpFilter .typeMap[item.type], item.docDomain, item.thirdParty);
1107 if (disabledMatch) 1106 if (disabledMatch)
1108 item.filter = disabledMatch.text; 1107 item.filter = disabledMatch.text;
1109 } 1108 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 return {tooltip: this.itemsDummyTooltip}; 1278 return {tooltip: this.itemsDummyTooltip};
1280 }, 1279 },
1281 1280
1282 invalidateItem: function(item) 1281 invalidateItem: function(item)
1283 { 1282 {
1284 let row = this.data.indexOf(item); 1283 let row = this.data.indexOf(item);
1285 if (row >= 0) 1284 if (row >= 0)
1286 this.boxObject.invalidateRow(row); 1285 this.boxObject.invalidateRow(row);
1287 } 1286 }
1288 } 1287 }
OLDNEW
« no previous file with comments | « no previous file | chrome/content/ui/sidebar.xul » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld