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

Delta Between Two Patch Sets: include.postload.js

Issue 5945877571043328: Issue 705 - Generate element hiding instead request blocking filters for non-HTTP URLs (Closed)
Left Patch Set: Created June 24, 2014, 2:54 p.m.
Right Patch Set: Rebased Created Oct. 30, 2014, 4:07 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 quote(value)
28 {
29 return '"' + value.replace(/(["\\])/g, "\\$1") + '"';
30 }
31
32 function supportsShadowRoot(element)
33 {
34 if (!("createShadowRoot" in element))
35 return false;
36
37 // There are some elements (e.g. <textarea>), which don't
38 // support author created shadow roots and throw an exception.
39 var clone = element.cloneNode(false);
40 try
41 {
42 clone.createShadowRoot();
43 }
44 catch (e)
45 {
46 return false;
47 }
48
49 // There are some elements (e.g. <input>), which support
50 // author created shadow roots, but ignore insertion points.
51 var child = document.createTextNode("");
52 clone.appendChild(child);
53
54 var shadow = document.createElement("shadow");
55 clone.shadowRoot.appendChild(shadow);
56
57 return shadow.getDistributedNodes()[0] == child;
58 }
59
60 function highlightElement(element, shadowColor, backgroundColor)
61 {
62 unhighlightElement(element);
63
64 var originalBoxShadowPriority = element.style.getPropertyPriority("box-shadow" );
65 var originalBackgroundColorPriority = element.style.getPropertyPriority("backg round-color");
66
67 var boxShadow = "inset 0px 0px 5px " + shadowColor;
68
69 var highlightWithShadowDOM = function()
70 {
71 var style = document.createElement("style");
72 style.textContent = ":host {" +
73 "box-shadow:" + boxShadow + " !important;" +
74 "background-color:" + backgroundColor + " !important;" +
75 "}";
76
77 var root = element.createShadowRoot();
78 root.appendChild(document.createElement("shadow"));
79 root.appendChild(style);
80
81 element._unhighlight = function()
82 {
83 root.removeChild(style);
84 };
85 };
86
87 var highlightWithStyleAttribute = function()
88 {
89 var originalBoxShadow = element.style.getPropertyValue("box-shadow");
90 var originalBackgroundColor = element.style.getPropertyValue("background-col or");
91
92 element.style.setProperty("box-shadow", boxShadow, "important");
93 element.style.setProperty("background-color", backgroundColor, "important");
94
95 element._unhighlight = function()
96 {
97 this.style.removeProperty("box-shadow");
98 this.style.setProperty(
99 "box-shadow",
100 originalBoxShadow,
101 originalBoxShadowPriority
102 );
103
104 this.style.removeProperty("background-color");
105 this.style.setProperty(
106 "background-color",
107 originalBackgroundColor,
108 originalBackgroundColorPriority
109 );
110 };
111 };
112
113 // Use shadow DOM if posibble to avoid side effects when the
114 // web page updates style while highlighted. However, if the
115 // element has important styles we can't override them with shadow DOM.
116 if (supportsShadowRoot(element) && originalBoxShadowPriority != "importa nt" &&
117 originalBackgroundColorPriority != "importa nt")
118 highlightWithShadowDOM();
119 else
120 highlightWithStyleAttribute();
121 }
122
123
124 function unhighlightElement(element)
125 {
126 if ("_unhighlight" in element)
127 {
128 element._unhighlight();
129 delete element._unhighlight;
130 }
131 }
30 132
31 // Highlight elements according to selector string. This would include 133 // Highlight elements according to selector string. This would include
32 // all elements that would be affected by proposed filters. 134 // all elements that would be affected by proposed filters.
33 function highlightElements(selectorString) { 135 function highlightElements(selectorString) {
34 if(highlightedElementsSelector) 136 unhighlightElements();
35 unhighlightElements();
36 137
37 var highlightedElements = document.querySelectorAll(selectorString); 138 var highlightedElements = document.querySelectorAll(selectorString);
38 highlightedElementsSelector = selectorString; 139 highlightedElementsSelector = selectorString;
39 highlightedElementsBoxShadows = new Array(); 140
40 highlightedElementsBGColors = new Array(); 141 for(var i = 0; i < highlightedElements.length; i++)
41 142 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 } 143 }
49 144
50 // Unhighlight all elements, including those that would be affected by 145 // Unhighlight all elements, including those that would be affected by
51 // the proposed filters 146 // the proposed filters
52 function unhighlightElements() { 147 function unhighlightElements() {
53 if(highlightedElementsSelector == null) 148 if (highlightedElementsSelector)
54 return; 149 {
55 var highlightedElements = document.querySelectorAll(highlightedElementsSelecto r); 150 Array.prototype.forEach.call(
56 for(var i = 0; i < highlightedElements.length; i++) { 151 document.querySelectorAll(highlightedElementsSelector),
57 highlightedElements[i].style.setProperty("-webkit-box-shadow", highlightedEl ementsBoxShadows[i]); 152 unhighlightElement
58 highlightedElements[i].style.backgroundColor = highlightedElementsBGColors[i ]; 153 );
59 } 154
60 highlightedElementsSelector = null; 155 highlightedElementsSelector = null;
156 }
61 } 157 }
62 158
63 // Gets the absolute position of an element by walking up the DOM tree, 159 // Gets the absolute position of an element by walking up the DOM tree,
64 // adding up offsets. 160 // adding up offsets.
65 // I hope there's a better way because it just seems absolutely stupid 161 // 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 162 // 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. 163 // has hundreds and hundreds of other methods that do random junk.
68 function getAbsolutePosition(elt) { 164 function getAbsolutePosition(elt) {
69 var l = 0; 165 var l = 0;
70 var t = 0; 166 var t = 0;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 { 272 {
177 if (clickHideFiltersDialog) 273 if (clickHideFiltersDialog)
178 { 274 {
179 document.body.removeChild(clickHideFiltersDialog); 275 document.body.removeChild(clickHideFiltersDialog);
180 clickHideFiltersDialog = null; 276 clickHideFiltersDialog = null;
181 } 277 }
182 278
183 if(currentElement) { 279 if(currentElement) {
184 currentElement.removeEventListener("contextmenu", clickHide_elementClickHand ler, false); 280 currentElement.removeEventListener("contextmenu", clickHide_elementClickHand ler, false);
185 unhighlightElements(); 281 unhighlightElements();
186 currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxSha dow); 282 unhighlightElement(currentElement);
187 currentElement.style.backgroundColor = currentElement_backgroundColor;
188 currentElement = null; 283 currentElement = null;
189 clickHideFilters = null; 284 clickHideFilters = null;
190 } 285 }
191 unhighlightElements(); 286 unhighlightElements();
192 287
193 clickHide_activated = false; 288 clickHide_activated = false;
194 clickHide_filters = null; 289 clickHide_filters = null;
195 if(!document) 290 if(!document)
196 return; // This can happen inside a nuked iframe...I think 291 return; // This can happen inside a nuked iframe...I think
197 document.removeEventListener("mouseover", clickHide_mouseOver, false); 292 document.removeEventListener("mouseover", clickHide_mouseOver, false);
(...skipping 22 matching lines...) Expand all
220 315
221 var target = e.target; 316 var target = e.target;
222 while (target.parentNode && !(target.id || target.className || target.src || / :.+:/.test(target.getAttribute("style")))) 317 while (target.parentNode && !(target.id || target.className || target.src || / :.+:/.test(target.getAttribute("style"))))
223 target = target.parentNode; 318 target = target.parentNode;
224 if (target == document.documentElement || target == document.body) 319 if (target == document.documentElement || target == document.body)
225 target = null; 320 target = null;
226 321
227 if (target && target instanceof HTMLElement) 322 if (target && target instanceof HTMLElement)
228 { 323 {
229 currentElement = target; 324 currentElement = target;
230 currentElement_boxShadow = target.style.getPropertyValue("-webkit-box-shadow "); 325
231 currentElement_backgroundColor = target.style.backgroundColor; 326 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) ; 327 target.addEventListener("contextmenu", clickHide_elementClickHandler, false) ;
236 } 328 }
237 } 329 }
238 330
239 // No longer hovering over this element so unhighlight it 331 // No longer hovering over this element so unhighlight it
240 function clickHide_mouseOut(e) 332 function clickHide_mouseOut(e)
241 { 333 {
242 if (!clickHide_activated || !currentElement) 334 if (!clickHide_activated || !currentElement)
243 return; 335 return;
244 336
245 currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxShado w); 337 unhighlightElement(currentElement);
246 currentElement.style.backgroundColor = currentElement_backgroundColor;
247
248 currentElement.removeEventListener("contextmenu", clickHide_elementClickHandle r, false); 338 currentElement.removeEventListener("contextmenu", clickHide_elementClickHandle r, false);
249 } 339 }
250 340
251 // Selects the currently hovered-over filter or cancels selection 341 // Selects the currently hovered-over filter or cancels selection
252 function clickHide_keyDown(e) 342 function clickHide_keyDown(e)
253 { 343 {
254 if (!e.ctrlKey && !e.altKey && !e.shiftKey && e.keyCode == 13 /*DOM_VK_RETURN* /) 344 if (!e.ctrlKey && !e.altKey && !e.shiftKey && e.keyCode == 13 /*DOM_VK_RETURN* /)
255 clickHide_mouseClick(e); 345 clickHide_mouseClick(e);
256 else if (!e.ctrlKey && !e.altKey && !e.shiftKey && e.keyCode == 27 /*DOM_VK_ES CAPE*/) 346 else if (!e.ctrlKey && !e.altKey && !e.shiftKey && e.keyCode == 27 /*DOM_VK_ES CAPE*/)
257 { 347 {
258 clickHide_deactivate(); 348 ext.backgroundPage.sendMessage(
349 {
350 type: "forward",
351 payload:
352 {
353 type: "clickhide-deactivate"
354 }
355 });
259 e.preventDefault(); 356 e.preventDefault();
260 e.stopPropagation(); 357 e.stopPropagation();
261 } 358 }
262 } 359 }
263 360
264 // When the user clicks, the currentElement is the one we want. 361 // When the user clicks, the currentElement is the one we want.
265 // We should have ABP rules ready for when the 362 // We should have ABP rules ready for when the
266 // popup asks for them. 363 // popup asks for them.
267 function clickHide_mouseClick(e) 364 function clickHide_mouseClick(e)
268 { 365 {
(...skipping 20 matching lines...) Expand all
289 386
290 clickHideFilters = new Array(); 387 clickHideFilters = new Array();
291 selectorList = new Array(); 388 selectorList = new Array();
292 389
293 var addSelector = function(selector) 390 var addSelector = function(selector)
294 { 391 {
295 clickHideFilters.push(document.domain + "##" + selector); 392 clickHideFilters.push(document.domain + "##" + selector);
296 selectorList.push(selector); 393 selectorList.push(selector);
297 }; 394 };
298 395
299 var addSelectorFromAttribute = function(element, attribute)
300 {
301 var value = element.getAttribute(attribute);
302 if (value)
303 addSelector(element.localName + "[" + attribute + '="' + value.replace(/"/ g, '\\"') + '"]');
304 };
305
306 if (elementId) 396 if (elementId)
307 addSelector("#" + elementId); 397 addSelector("#" + elementId);
308 398
309 if (elt.classList.length > 0) 399 if (elementClasses && elementClasses.length > 0)
310 { 400 {
311 var selector = ""; 401 var selector = "";
312 402
313 for (var i = 0; i < elt.classList.length; i++) 403 for (var i = 0; i < elt.classList.length; i++)
314 selector += "." + elt.classList[i].replace(/([^\w-])/, "\\$1"); 404 selector += "." + elt.classList[i].replace(/([^\w-])/, "\\$1");
315 405
316 addSelector(selector); 406 addSelector(selector);
317 } 407 }
318 408
319 if (url) 409 if (url)
320 { 410 {
321 url = relativeToAbsoluteUrl(url); 411 var src = elt.getAttribute("src");
322 if (/^https?:/.test(url)) 412 var selector = src && elt.localName + '[src=' + quote(src) + ']';
Wladimir Palant 2014/10/30 22:36:28 elt.localName still needs escaping, DOM methods al
Sebastian Noack 2014/10/31 13:52:49 The syntax for valid tag names is very restrictive
Wladimir Palant 2014/11/03 18:14:28 document.createElement("foo:bar") might still be p
413
414 if (/^https?:/i.test(url))
323 { 415 {
324 clickHideFilters.push(normalizeURL(url)); 416 clickHideFilters.push(url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||"));
325 selectorList.push(elt.localName + '[src="' + url + '"]'); 417
418 if (selector)
419 selectorList.push(selector);
326 } 420 }
327 else 421 else if (selector)
328 addSelectorFromAttribute(elt, "src"); 422 addSelector(selector);
329 } 423 }
330 424
331 // restore the original style, before generating the fallback filter that 425 // restore the original style, before generating the fallback filter that
332 // will include the style, and to prevent highlightElements from saving those 426 // will include the style, and to prevent highlightElements from saving those
333 currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxShado w); 427 unhighlightElement(currentElement);
334 currentElement.style.backgroundColor = currentElement_backgroundColor;
335 428
336 // as last resort, create a filter based on inline styles 429 // as last resort, create a filter based on inline styles
337 if (clickHideFilters.length == 0) 430 if (clickHideFilters.length == 0)
338 addSelectorFromAttribute(elt, "style"); 431 {
432 var style = elt.getAttribute("style");
433 if (style)
434 addSelector(elt.localName + '[style=' + quote(style) + ']');
435 }
339 436
340 // Show popup 437 // Show popup
341 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); 438 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters);
342 439
343 // Highlight the elements specified by selector in yellow 440 // Highlight the elements specified by selector in yellow
344 highlightElements(selectorList.join(",")); 441 highlightElements(selectorList.join(","));
345 // Now, actually highlight the element the user clicked on in red 442 // Now, actually highlight the element the user clicked on in red
346 currentElement.style.setProperty("-webkit-box-shadow", "inset 0px 0px 5px #fd1 708"); 443 highlightElement(currentElement, "#fd1708", "#f6a1b5");
347 currentElement.style.backgroundColor = "#f6a1b5";
348 444
349 // Make sure the browser doesn't handle this click 445 // Make sure the browser doesn't handle this click
350 e.preventDefault(); 446 e.preventDefault();
351 e.stopPropagation(); 447 e.stopPropagation();
352 } 448 }
353 449
354 // Extracts source URL from an IMG, OBJECT, EMBED, or IFRAME 450 // Extracts source URL from an IMG, OBJECT, EMBED, or IFRAME
355 function getElementURL(elt) { 451 function getElementURL(elt) {
356 // Check children of object nodes for "param" nodes with name="movie" that spe cify a URL 452 // Check children of object nodes for "param" nodes with name="movie" that spe cify a URL
357 // in value attribute 453 // in value attribute
358 var url; 454 var url;
359 if(elt.localName.toUpperCase() == "OBJECT" && !(url = elt.getAttribute("data") )) { 455 if(elt.localName.toUpperCase() == "OBJECT" && !(url = elt.getAttribute("data") )) {
360 // No data attribute, look in PARAM child tags for a URL for the swf file 456 // No data attribute, look in PARAM child tags for a URL for the swf file
361 var params = elt.querySelectorAll("param[name=\"movie\"]"); 457 var params = elt.querySelectorAll("param[name=\"movie\"]");
362 // This OBJECT could contain an EMBED we already nuked, in which case there' s no URL 458 // This OBJECT could contain an EMBED we already nuked, in which case there' s no URL
363 if(params[0]) 459 if(params[0])
364 url = params[0].getAttribute("value"); 460 url = params[0].getAttribute("value");
365 else { 461 else {
366 params = elt.querySelectorAll("param[name=\"src\"]"); 462 params = elt.querySelectorAll("param[name=\"src\"]");
367 if(params[0]) 463 if(params[0])
368 url = params[0].getAttribute("value"); 464 url = params[0].getAttribute("value");
369 } 465 }
466
467 if (url)
468 url = resolveURL(url);
370 } else if(!url) { 469 } else if(!url) {
371 url = elt.getAttribute("src") || elt.getAttribute("href"); 470 url = elt.src || elt.href;
372 } 471 }
373 return url; 472 return url;
374 } 473 }
375 474
376 // This function Copyright (c) 2008 Jeni Tennison, from jquery.uri.js 475 // This function Copyright (c) 2008 Jeni Tennison, from jquery.uri.js
377 // and licensed under the MIT license. See jquery-*.min.js for details. 476 // and licensed under the MIT license. See jquery-*.min.js for details.
378 function removeDotSegments(u) { 477 function removeDotSegments(u) {
379 var r = '', m = []; 478 var r = '', m = [];
380 if (/\./.test(u)) { 479 if (/\./.test(u)) {
381 while (u !== undefined && u !== '') { 480 while (u !== undefined && u !== '') {
(...skipping 13 matching lines...) Expand all
395 u = m[2]; 494 u = m[2];
396 r = r + m[1]; 495 r = r + m[1];
397 } 496 }
398 } 497 }
399 return r; 498 return r;
400 } else { 499 } else {
401 return u; 500 return u;
402 } 501 }
403 } 502 }
404 503
405 // Does some degree of URL normalization 504 if (document instanceof HTMLDocument)
406 function normalizeURL(url)
407 {
408 var components = url.match(/(.+:\/\/)(.+?)\/(.*)/);
409 if(!components)
410 return url;
411 var newPath = removeDotSegments(components[3]);
412 if(newPath != '' && newPath[0] != '/')
413 newPath = '/' + newPath;
414 return '||' + components[2] + newPath;
415 }
416
417 // Content scripts are apparently invoked on non-HTML documents, so we have to
418 // check for that before doing stuff. |document instanceof HTMLDocument| check
419 // will fail on some sites like planet.mozilla.org because WebKit creates
420 // Document instances for XHTML documents, have to test the root element.
421 if (document.documentElement instanceof HTMLElement)
422 { 505 {
423 // Use a contextmenu handler to save the last element the user right-clicked o n. 506 // Use a contextmenu handler to save the last element the user right-clicked o n.
424 // To make things easier, we actually save the DOM event. 507 // To make things easier, we actually save the DOM event.
425 // We have to do this because the contextMenu API only provides a URL, not the actual 508 // We have to do this because the contextMenu API only provides a URL, not the actual
426 // DOM element. 509 // DOM element.
427 document.addEventListener('contextmenu', function(e) { 510 document.addEventListener('contextmenu', function(e) {
428 lastRightClickEvent = e; 511 lastRightClickEvent = e;
429 }, false); 512 }, false);
430 513
431 document.addEventListener("click", function(event) 514 document.addEventListener("click", function(event)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if(msg.filter === url) 618 if(msg.filter === url)
536 { 619 {
537 // This request would have come from the chrome.contextMenu handler, s o we 620 // This request would have come from the chrome.contextMenu handler, s o we
538 // simulate the user having chosen the element to get rid of via the u sual means. 621 // simulate the user having chosen the element to get rid of via the u sual means.
539 clickHide_activated = true; 622 clickHide_activated = true;
540 // FIXME: clickHideFilters is erased in clickHide_mouseClick anyway, s o why set it? 623 // FIXME: clickHideFilters is erased in clickHide_mouseClick anyway, s o why set it?
541 clickHideFilters = [msg.filter]; 624 clickHideFilters = [msg.filter];
542 // Coerce red highlighted overlay on top of element to remove. 625 // Coerce red highlighted overlay on top of element to remove.
543 // TODO: Wow, the design of the clickHide stuff is really dumb - gotta fix it sometime 626 // TODO: Wow, the design of the clickHide stuff is really dumb - gotta fix it sometime
544 currentElement = addElementOverlay(target); 627 currentElement = addElementOverlay(target);
545 currentElement_backgroundColor = target.style.backgroundColor;
546 // clickHide_mouseOver(lastRightClickEvent); 628 // clickHide_mouseOver(lastRightClickEvent);
547 clickHide_mouseClick(lastRightClickEvent); 629 clickHide_mouseClick(lastRightClickEvent);
548 } 630 }
549 else 631 else
550 console.log("clickhide-new-filter: URLs don't match. Couldn't find tha t element.", request.filter, url, lastRightClickEvent.target.src); 632 console.log("clickhide-new-filter: URLs don't match. Couldn't find tha t element.", msg.filter, url, lastRightClickEvent.target.src);
551 break; 633 break;
552 case "clickhide-init": 634 case "clickhide-init":
553 if (clickHideFiltersDialog) 635 if (clickHideFiltersDialog)
554 { 636 {
555 sendResponse({filters: clickHide_filters}); 637 sendResponse({filters: clickHide_filters});
556 638
557 clickHideFiltersDialog.style.width = msg.width + "px"; 639 clickHideFiltersDialog.style.width = msg.width + "px";
558 clickHideFiltersDialog.style.height = msg.height + "px"; 640 clickHideFiltersDialog.style.height = msg.height + "px";
559 clickHideFiltersDialog.style.visibility = "visible"; 641 clickHideFiltersDialog.style.visibility = "visible";
560 } 642 }
561 break; 643 break;
562 case "clickhide-move": 644 case "clickhide-move":
563 if (clickHideFiltersDialog) 645 if (clickHideFiltersDialog)
564 { 646 {
565 clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.s tyle.left, 10) + request.x) + "px"; 647 clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.s tyle.left, 10) + msg.x) + "px";
566 clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.st yle.top, 10) + request.y) + "px"; 648 clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.st yle.top, 10) + msg.y) + "px";
567 } 649 }
568 break; 650 break;
569 case "clickhide-close": 651 case "clickhide-close":
570 if (clickHideFiltersDialog) 652 if (clickHideFiltersDialog)
571 { 653 {
572 // Explicitly get rid of currentElement 654 // Explicitly get rid of currentElement
573 if (msg.remove && currentElement && currentElement.parentNode) 655 if (msg.remove && currentElement && currentElement.parentNode)
574 currentElement.parentNode.removeChild(currentElement); 656 currentElement.parentNode.removeChild(currentElement);
575
576 clickHide_deactivate();
577 } 657 }
658 clickHide_deactivate();
578 break; 659 break;
579 default: 660 default:
580 sendResponse({}); 661 sendResponse({});
581 break; 662 break;
582 } 663 }
583 }); 664 });
584 } 665
666 if (window == window.top)
667 ext.backgroundPage.sendMessage({type: "report-html-page"});
668 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld