Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 // Click-to-hide stuff | 18 // Click-to-hide stuff |
19 var clickHide_activated = false; | 19 var clickHide_activated = false; |
20 var clickHide_filters = null; | 20 var clickHide_filters = null; |
21 var currentElement = null; | 21 var currentElement = null; |
22 var currentElement_boxShadow = null; | |
23 var currentElement_backgroundColor; | |
24 var clickHideFilters = null; | 22 var clickHideFilters = null; |
25 var highlightedElementsSelector = null; | 23 var highlightedElementsSelector = null; |
26 var highlightedElementsBoxShadows = null; | |
27 var highlightedElementsBGColors = null; | |
28 var clickHideFiltersDialog = null; | 24 var clickHideFiltersDialog = null; |
29 var lastRightClickEvent = null; | 25 var lastRightClickEvent = null; |
26 | |
27 function supportsShadowRoot(element) | |
28 { | |
29 if (!("createShadowRoot" in element)) | |
30 return false; | |
31 | |
32 // There are some elements (e.g. <textarea>), which don't | |
33 // support author created shadow roots and throw an exception. | |
34 var clone = element.cloneNode(false); | |
35 try | |
36 { | |
37 clone.createShadowRoot(); | |
38 } | |
39 catch (e) | |
40 { | |
41 return false; | |
42 } | |
43 | |
44 // There are some elements (e.g. <input>), which support | |
45 // author created shadow roots, but ignore insertion points. | |
46 var child = document.createTextNode(""); | |
47 clone.appendChild(child); | |
48 | |
49 var shadow = document.createElement("shadow"); | |
50 clone.shadowRoot.appendChild(shadow); | |
51 | |
52 return shadow.getDistributedNodes()[0] == child; | |
53 } | |
54 | |
55 function highlightElement(element, shadowColor, backgroundColor) | |
56 { | |
57 unhighlightElement(element); | |
58 | |
59 var originalBoxShadowPriority = element.style.getPropertyPriority("box-shadow" ); | |
60 var originalBackgroundColorPriority = element.style.getPropertyPriority("backg round-color"); | |
61 | |
62 var boxShadow = "inset 0px 0px 5px " + shadowColor; | |
63 | |
64 var highlightWithShadowDOM = function() | |
65 { | |
66 var style = document.createElement("style"); | |
67 style.textContent = ":host {" + | |
68 "box-shadow:" + boxShadow + " !important;" + | |
69 "background-color:" + backgroundColor + " !important;" + | |
70 "}"; | |
71 | |
72 var root = element.createShadowRoot(); | |
73 root.appendChild(document.createElement("shadow")); | |
74 root.appendChild(style); | |
75 | |
76 element._unhighlight = function() | |
77 { | |
78 root.removeChild(style); | |
79 }; | |
80 }; | |
81 | |
82 var highlightWithStyleAttribute = function() | |
83 { | |
84 var originalBoxShadow = element.style.getPropertyValue("box-shadow"); | |
85 var originalBackgroundColor = element.style.getPropertyValue("background-col or"); | |
86 | |
87 element.style.setProperty("box-shadow", boxShadow, "important"); | |
88 element.style.setProperty("background-color", backgroundColor, "important"); | |
89 | |
90 element._unhighlight = function() | |
91 { | |
92 this.style.removeProperty("box-shadow"); | |
93 this.style.setProperty( | |
94 "box-shadow", | |
95 originalBoxShadow, | |
96 originalBoxShadowPriority | |
97 ); | |
98 | |
99 this.style.removeProperty("background-color"); | |
100 this.style.setProperty( | |
101 "background-color", | |
102 originalBackgroundColor, | |
103 originalBackgroundColorPriority | |
104 ); | |
105 }; | |
106 }; | |
107 | |
108 // Use shadow DOM if posibble to avoid side effects when the | |
109 // web page updates style while highlighted. However, if the | |
110 // element has important styles we can't override them with shadow DOM. | |
111 if (supportsShadowRoot(element) && originalBoxShadowPriority != "importa nt" && | |
112 originalBackgroundColorPriority != "importa nt") | |
113 highlightWithShadowDOM(); | |
114 else | |
115 highlightWithStyleAttribute(); | |
116 } | |
117 | |
118 | |
119 function unhighlightElement(element) | |
120 { | |
121 if ("_unhighlight" in element) | |
122 { | |
123 element._unhighlight(); | |
124 delete element._unhighlight; | |
125 } | |
126 } | |
30 | 127 |
31 // Highlight elements according to selector string. This would include | 128 // Highlight elements according to selector string. This would include |
32 // all elements that would be affected by proposed filters. | 129 // all elements that would be affected by proposed filters. |
33 function highlightElements(selectorString) { | 130 function highlightElements(selectorString) { |
34 if(highlightedElementsSelector) | 131 unhighlightElements(); |
35 unhighlightElements(); | |
36 | 132 |
37 var highlightedElements = document.querySelectorAll(selectorString); | 133 var highlightedElements = document.querySelectorAll(selectorString); |
38 highlightedElementsSelector = selectorString; | 134 highlightedElementsSelector = selectorString; |
39 highlightedElementsBoxShadows = new Array(); | 135 |
40 highlightedElementsBGColors = new Array(); | 136 for(var i = 0; i < highlightedElements.length; i++) |
41 | 137 highlightElement(highlightedElements[i], "#fd6738", "#f6e1e5"); |
42 for(var i = 0; i < highlightedElements.length; i++) { | |
43 highlightedElementsBoxShadows[i] = highlightedElements[i].style.getPropertyV alue("-webkit-box-shadow"); | |
44 highlightedElementsBGColors[i] = highlightedElements[i].style.backgroundColo r; | |
45 highlightedElements[i].style.setProperty("-webkit-box-shadow", "inset 0px 0p x 5px #fd6738"); | |
46 highlightedElements[i].style.backgroundColor = "#f6e1e5"; | |
47 } | |
48 } | 138 } |
49 | 139 |
50 // Unhighlight all elements, including those that would be affected by | 140 // Unhighlight all elements, including those that would be affected by |
51 // the proposed filters | 141 // the proposed filters |
52 function unhighlightElements() { | 142 function unhighlightElements() { |
53 if(highlightedElementsSelector == null) | 143 if (highlightedElementsSelector) |
54 return; | 144 { |
55 var highlightedElements = document.querySelectorAll(highlightedElementsSelecto r); | 145 Array.prototype.forEach.call( |
56 for(var i = 0; i < highlightedElements.length; i++) { | 146 document.querySelectorAll(highlightedElementsSelector), |
57 highlightedElements[i].style.setProperty("-webkit-box-shadow", highlightedEl ementsBoxShadows[i]); | 147 unhighlightElement |
58 highlightedElements[i].style.backgroundColor = highlightedElementsBGColors[i ]; | 148 ); |
59 } | 149 |
60 highlightedElementsSelector = null; | 150 highlightedElementsSelector = null; |
151 } | |
61 } | 152 } |
62 | 153 |
63 // Gets the absolute position of an element by walking up the DOM tree, | 154 // Gets the absolute position of an element by walking up the DOM tree, |
64 // adding up offsets. | 155 // adding up offsets. |
65 // I hope there's a better way because it just seems absolutely stupid | 156 // I hope there's a better way because it just seems absolutely stupid |
66 // that the DOM wouldn't have a direct way to get this, given that it | 157 // that the DOM wouldn't have a direct way to get this, given that it |
67 // has hundreds and hundreds of other methods that do random junk. | 158 // has hundreds and hundreds of other methods that do random junk. |
68 function getAbsolutePosition(elt) { | 159 function getAbsolutePosition(elt) { |
69 var l = 0; | 160 var l = 0; |
70 var t = 0; | 161 var t = 0; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 { | 267 { |
177 if (clickHideFiltersDialog) | 268 if (clickHideFiltersDialog) |
178 { | 269 { |
179 document.body.removeChild(clickHideFiltersDialog); | 270 document.body.removeChild(clickHideFiltersDialog); |
180 clickHideFiltersDialog = null; | 271 clickHideFiltersDialog = null; |
181 } | 272 } |
182 | 273 |
183 if(currentElement) { | 274 if(currentElement) { |
184 currentElement.removeEventListener("contextmenu", clickHide_elementClickHand ler, false); | 275 currentElement.removeEventListener("contextmenu", clickHide_elementClickHand ler, false); |
185 unhighlightElements(); | 276 unhighlightElements(); |
186 currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxSha dow); | 277 unhighlightElement(currentElement); |
187 currentElement.style.backgroundColor = currentElement_backgroundColor; | |
188 currentElement = null; | 278 currentElement = null; |
189 clickHideFilters = null; | 279 clickHideFilters = null; |
190 } | 280 } |
191 unhighlightElements(); | 281 unhighlightElements(); |
192 | 282 |
193 clickHide_activated = false; | 283 clickHide_activated = false; |
194 clickHide_filters = null; | 284 clickHide_filters = null; |
195 if(!document) | 285 if(!document) |
196 return; // This can happen inside a nuked iframe...I think | 286 return; // This can happen inside a nuked iframe...I think |
197 document.removeEventListener("mouseover", clickHide_mouseOver, false); | 287 document.removeEventListener("mouseover", clickHide_mouseOver, false); |
(...skipping 14 matching lines...) Expand all Loading... | |
212 clickHide_mouseClick(ev); | 302 clickHide_mouseClick(ev); |
213 } | 303 } |
214 | 304 |
215 // Hovering over an element so highlight it | 305 // Hovering over an element so highlight it |
216 function clickHide_mouseOver(e) | 306 function clickHide_mouseOver(e) |
217 { | 307 { |
218 if (clickHide_activated == false) | 308 if (clickHide_activated == false) |
219 return; | 309 return; |
220 | 310 |
221 var target = e.target; | 311 var target = e.target; |
222 while (target.parentNode && !(target.id || target.className || target.src || / :.+:/.test(target.getAttribute("style")))) | 312 while (target.parentNode && !(target.id || target.className || target.src)) |
223 target = target.parentNode; | 313 target = target.parentNode; |
224 if (target == document.documentElement || target == document.body) | 314 if (target == document.documentElement || target == document.body) |
225 target = null; | 315 target = null; |
226 | 316 |
227 if (target && target instanceof HTMLElement) | 317 if (target && target instanceof HTMLElement) |
228 { | 318 { |
229 currentElement = target; | 319 currentElement = target; |
230 currentElement_boxShadow = target.style.getPropertyValue("-webkit-box-shadow "); | 320 |
231 currentElement_backgroundColor = target.style.backgroundColor; | 321 highlightElement(target, "#d6d84b", "#f8fa47"); |
232 target.style.setProperty("-webkit-box-shadow", "inset 0px 0px 5px #d6d84b"); | |
233 target.style.backgroundColor = "#f8fa47"; | |
234 | |
235 target.addEventListener("contextmenu", clickHide_elementClickHandler, false) ; | 322 target.addEventListener("contextmenu", clickHide_elementClickHandler, false) ; |
236 } | 323 } |
237 } | 324 } |
238 | 325 |
239 // No longer hovering over this element so unhighlight it | 326 // No longer hovering over this element so unhighlight it |
240 function clickHide_mouseOut(e) | 327 function clickHide_mouseOut(e) |
241 { | 328 { |
242 if (!clickHide_activated || !currentElement) | 329 if (!clickHide_activated || !currentElement) |
243 return; | 330 return; |
244 | 331 |
245 currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxShado w); | 332 unhighlightElement(currentElement); |
246 currentElement.style.backgroundColor = currentElement_backgroundColor; | |
247 | |
248 currentElement.removeEventListener("contextmenu", clickHide_elementClickHandle r, false); | 333 currentElement.removeEventListener("contextmenu", clickHide_elementClickHandle r, false); |
249 } | 334 } |
250 | 335 |
251 // Selects the currently hovered-over filter or cancels selection | 336 // Selects the currently hovered-over filter or cancels selection |
252 function clickHide_keyDown(e) | 337 function clickHide_keyDown(e) |
253 { | 338 { |
254 if (!e.ctrlKey && !e.altKey && !e.shiftKey && e.keyCode == 13 /*DOM_VK_RETURN* /) | 339 if (!e.ctrlKey && !e.altKey && !e.shiftKey && e.keyCode == 13 /*DOM_VK_RETURN* /) |
255 clickHide_mouseClick(e); | 340 clickHide_mouseClick(e); |
256 else if (!e.ctrlKey && !e.altKey && !e.shiftKey && e.keyCode == 27 /*DOM_VK_ES CAPE*/) | 341 else if (!e.ctrlKey && !e.altKey && !e.shiftKey && e.keyCode == 27 /*DOM_VK_ES CAPE*/) |
257 { | 342 { |
(...skipping 24 matching lines...) Expand all Loading... | |
282 // Construct filters. The popup will retrieve these. | 367 // Construct filters. The popup will retrieve these. |
283 // Only one ID | 368 // Only one ID |
284 var elementId = elt.id ? elt.id.split(' ').join('') : null; | 369 var elementId = elt.id ? elt.id.split(' ').join('') : null; |
285 // Can have multiple classes, and there might be extraneous whitespace | 370 // Can have multiple classes, and there might be extraneous whitespace |
286 var elementClasses = null; | 371 var elementClasses = null; |
287 if (elt.className) | 372 if (elt.className) |
288 elementClasses = elt.className.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '' ).split(' '); | 373 elementClasses = elt.className.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '' ).split(' '); |
289 | 374 |
290 clickHideFilters = new Array(); | 375 clickHideFilters = new Array(); |
291 selectorList = new Array(); | 376 selectorList = new Array(); |
292 | 377 if (elementId) |
293 var addSelector = function(selector) | 378 { |
294 { | 379 clickHideFilters.push(document.domain + "###" + elementId); |
380 selectorList.push("#" + elementId); | |
381 } | |
382 if (elementClasses && elementClasses.length > 0) | |
383 { | |
384 var selector = elementClasses.map(function(elClass) | |
385 { | |
386 return "." + elClass.replace(/([^\w-])/, "\\$1"); | |
387 }).join(""); | |
388 | |
295 clickHideFilters.push(document.domain + "##" + selector); | 389 clickHideFilters.push(document.domain + "##" + selector); |
296 selectorList.push(selector); | 390 selectorList.push(selector); |
297 }; | 391 } |
298 | |
299 if (elementId) | |
300 addSelector("#" + elementId); | |
301 | |
302 if (elt.classList.length > 0) | |
303 { | |
304 var selector = ""; | |
305 | |
306 for (var i = 0; i < elt.classList.length; i++) | |
307 selector += "." + elt.classList[i].replace(/([^\w-])/g, "\\$1"); | |
308 | |
309 addSelector(selector); | |
310 } | |
311 | |
312 if (url) | 392 if (url) |
313 clickHideFilters.push(normalizeURL(relativeToAbsoluteUrl(url))); | 393 { |
314 | 394 clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||")); |
315 // restore the original style, before generating the fallback filter that | 395 selectorList.push('[src="' + elt.getAttribute("src") + '"]'); |
316 // will include the style, and to prevent highlightElements from saving those | 396 } |
317 currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxShado w); | |
318 currentElement.style.backgroundColor = currentElement_backgroundColor; | |
319 | |
320 // as last resort, create a filter based on inline styles | |
321 if (clickHideFilters.length == 0 && elt.hasAttribute("style")) | |
322 addSelector(elt.localName + '[style="' + elt.getAttribute("style").replace(/ "/g, '\\"') + '"]'); | |
323 | 397 |
324 // Show popup | 398 // Show popup |
325 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); | 399 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); |
326 | 400 |
401 // Highlight the unlucky elements | |
402 // Restore currentElement's box-shadow and bgcolor so that highlightElements w on't save those | |
403 unhighlightElement(currentElement); | |
327 // Highlight the elements specified by selector in yellow | 404 // Highlight the elements specified by selector in yellow |
328 highlightElements(selectorList.join(",")); | 405 highlightElements(selectorList.join(",")); |
329 // Now, actually highlight the element the user clicked on in red | 406 // Now, actually highlight the element the user clicked on in red |
330 currentElement.style.setProperty("-webkit-box-shadow", "inset 0px 0px 5px #fd1 708"); | 407 highlightElement(currentElement, "#fd1708", "#f6a1b5"); |
331 currentElement.style.backgroundColor = "#f6a1b5"; | |
332 | 408 |
333 // Make sure the browser doesn't handle this click | 409 // Make sure the browser doesn't handle this click |
334 e.preventDefault(); | 410 e.preventDefault(); |
335 e.stopPropagation(); | 411 e.stopPropagation(); |
336 } | 412 } |
337 | 413 |
338 // Extracts source URL from an IMG, OBJECT, EMBED, or IFRAME | 414 // Extracts source URL from an IMG, OBJECT, EMBED, or IFRAME |
339 function getElementURL(elt) { | 415 function getElementURL(elt) { |
340 // Check children of object nodes for "param" nodes with name="movie" that spe cify a URL | 416 // Check children of object nodes for "param" nodes with name="movie" that spe cify a URL |
341 // in value attribute | 417 // in value attribute |
342 var url; | 418 var url; |
343 if(elt.localName.toUpperCase() == "OBJECT" && !(url = elt.getAttribute("data") )) { | 419 if(elt.localName.toUpperCase() == "OBJECT" && !(url = elt.getAttribute("data") )) { |
344 // No data attribute, look in PARAM child tags for a URL for the swf file | 420 // No data attribute, look in PARAM child tags for a URL for the swf file |
345 var params = elt.querySelectorAll("param[name=\"movie\"]"); | 421 var params = elt.querySelectorAll("param[name=\"movie\"]"); |
346 // This OBJECT could contain an EMBED we already nuked, in which case there' s no URL | 422 // This OBJECT could contain an EMBED we already nuked, in which case there' s no URL |
347 if(params[0]) | 423 if(params[0]) |
348 url = params[0].getAttribute("value"); | 424 url = params[0].getAttribute("value"); |
349 else { | 425 else { |
350 params = elt.querySelectorAll("param[name=\"src\"]"); | 426 params = elt.querySelectorAll("param[name=\"src\"]"); |
351 if(params[0]) | 427 if(params[0]) |
352 url = params[0].getAttribute("value"); | 428 url = params[0].getAttribute("value"); |
353 } | 429 } |
430 | |
431 if (url) | |
432 url = resolveURL(url); | |
354 } else if(!url) { | 433 } else if(!url) { |
355 url = elt.getAttribute("src") || elt.getAttribute("href"); | 434 url = elt.src || elt.href; |
356 } | 435 } |
357 return url; | 436 return url; |
358 } | 437 } |
359 | 438 |
360 // This function Copyright (c) 2008 Jeni Tennison, from jquery.uri.js | 439 // This function Copyright (c) 2008 Jeni Tennison, from jquery.uri.js |
361 // and licensed under the MIT license. See jquery-*.min.js for details. | 440 // and licensed under the MIT license. See jquery-*.min.js for details. |
362 function removeDotSegments(u) { | 441 function removeDotSegments(u) { |
363 var r = '', m = []; | 442 var r = '', m = []; |
364 if (/\./.test(u)) { | 443 if (/\./.test(u)) { |
365 while (u !== undefined && u !== '') { | 444 while (u !== undefined && u !== '') { |
(...skipping 13 matching lines...) Expand all Loading... | |
379 u = m[2]; | 458 u = m[2]; |
380 r = r + m[1]; | 459 r = r + m[1]; |
381 } | 460 } |
382 } | 461 } |
383 return r; | 462 return r; |
384 } else { | 463 } else { |
385 return u; | 464 return u; |
386 } | 465 } |
387 } | 466 } |
388 | 467 |
389 // Does some degree of URL normalization | 468 if (document instanceof HTMLDocument) |
390 function normalizeURL(url) | |
Wladimir Palant
2014/09/30 21:27:42
The function name and comment no longer make sense
| |
391 { | |
392 var components = url.match(/(.+:\/\/)(.+?)\/(.*)/); | |
Wladimir Palant
2014/09/30 21:27:42
This regexp won't work correctly for something lik
| |
393 if(!components) | |
394 return url; | |
Wladimir Palant
2014/09/30 21:27:42
I guess this would make more sense:
return "|"
| |
395 var newPath = removeDotSegments(components[3]); | |
Wladimir Palant
2014/09/30 21:27:42
Do we still need the "dot removal"? This should be
| |
396 if(newPath[0] != "/") | |
397 newPath = "/" + newPath; | |
398 return "||" + components[2] + newPath; | |
399 } | |
400 | |
401 // Content scripts are apparently invoked on non-HTML documents, so we have to | |
402 // check for that before doing stuff. |document instanceof HTMLDocument| check | |
403 // will fail on some sites like planet.mozilla.org because WebKit creates | |
404 // Document instances for XHTML documents, have to test the root element. | |
405 if (document.documentElement instanceof HTMLElement) | |
406 { | 469 { |
407 // Use a contextmenu handler to save the last element the user right-clicked o n. | 470 // Use a contextmenu handler to save the last element the user right-clicked o n. |
408 // To make things easier, we actually save the DOM event. | 471 // To make things easier, we actually save the DOM event. |
409 // We have to do this because the contextMenu API only provides a URL, not the actual | 472 // We have to do this because the contextMenu API only provides a URL, not the actual |
410 // DOM element. | 473 // DOM element. |
411 document.addEventListener('contextmenu', function(e) { | 474 document.addEventListener('contextmenu', function(e) { |
412 lastRightClickEvent = e; | 475 lastRightClickEvent = e; |
413 }, false); | 476 }, false); |
414 | 477 |
415 document.addEventListener("click", function(event) | 478 document.addEventListener("click", function(event) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
519 if(msg.filter === url) | 582 if(msg.filter === url) |
520 { | 583 { |
521 // This request would have come from the chrome.contextMenu handler, s o we | 584 // This request would have come from the chrome.contextMenu handler, s o we |
522 // simulate the user having chosen the element to get rid of via the u sual means. | 585 // simulate the user having chosen the element to get rid of via the u sual means. |
523 clickHide_activated = true; | 586 clickHide_activated = true; |
524 // FIXME: clickHideFilters is erased in clickHide_mouseClick anyway, s o why set it? | 587 // FIXME: clickHideFilters is erased in clickHide_mouseClick anyway, s o why set it? |
525 clickHideFilters = [msg.filter]; | 588 clickHideFilters = [msg.filter]; |
526 // Coerce red highlighted overlay on top of element to remove. | 589 // Coerce red highlighted overlay on top of element to remove. |
527 // TODO: Wow, the design of the clickHide stuff is really dumb - gotta fix it sometime | 590 // TODO: Wow, the design of the clickHide stuff is really dumb - gotta fix it sometime |
528 currentElement = addElementOverlay(target); | 591 currentElement = addElementOverlay(target); |
529 currentElement_backgroundColor = target.style.backgroundColor; | |
530 // clickHide_mouseOver(lastRightClickEvent); | 592 // clickHide_mouseOver(lastRightClickEvent); |
531 clickHide_mouseClick(lastRightClickEvent); | 593 clickHide_mouseClick(lastRightClickEvent); |
532 } | 594 } |
533 else | 595 else |
534 console.log("clickhide-new-filter: URLs don't match. Couldn't find tha t element.", request.filter, url, lastRightClickEvent.target.src); | 596 console.log("clickhide-new-filter: URLs don't match. Couldn't find tha t element.", request.filter, url, lastRightClickEvent.target.src); |
535 break; | 597 break; |
536 case "clickhide-init": | 598 case "clickhide-init": |
537 if (clickHideFiltersDialog) | 599 if (clickHideFiltersDialog) |
538 { | 600 { |
539 sendResponse({filters: clickHide_filters}); | 601 sendResponse({filters: clickHide_filters}); |
(...skipping 18 matching lines...) Expand all Loading... | |
558 currentElement.parentNode.removeChild(currentElement); | 620 currentElement.parentNode.removeChild(currentElement); |
559 | 621 |
560 clickHide_deactivate(); | 622 clickHide_deactivate(); |
561 } | 623 } |
562 break; | 624 break; |
563 default: | 625 default: |
564 sendResponse({}); | 626 sendResponse({}); |
565 break; | 627 break; |
566 } | 628 } |
567 }); | 629 }); |
568 } | 630 |
631 if (window == window.top) | |
632 ext.backgroundPage.sendMessage({type: "report-html-page"}); | |
633 } | |
LEFT | RIGHT |