| OLD | NEW |
| 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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 309 } |
| 310 if (url) | 310 if (url) |
| 311 { | 311 { |
| 312 clickHideFilters.push(relativeToAbsoluteUrl(url)); | 312 clickHideFilters.push(relativeToAbsoluteUrl(url)); |
| 313 selectorList.push(elt.localName + '[src="' + url + '"]'); | 313 selectorList.push(elt.localName + '[src="' + url + '"]'); |
| 314 } | 314 } |
| 315 | 315 |
| 316 // Show popup | 316 // Show popup |
| 317 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); | 317 clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); |
| 318 | 318 |
| 319 // Set background color in case it got selected using context menu | |
| 320 if (typeof currentElement_backgroundColor == "undefined") | |
| 321 currentElement_backgroundColor = currentElement.style.backgroundColor; | |
| 322 | |
| 323 // Highlight the unlucky elements | 319 // Highlight the unlucky elements |
| 324 // Restore currentElement's box-shadow and bgcolor so that highlightElements w
on't save those | 320 // Restore currentElement's box-shadow and bgcolor so that highlightElements w
on't save those |
| 325 currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxShado
w); | 321 currentElement.style.setProperty("-webkit-box-shadow", currentElement_boxShado
w); |
| 326 currentElement.style.backgroundColor = currentElement_backgroundColor; | 322 currentElement.style.backgroundColor = currentElement_backgroundColor; |
| 327 // Highlight the elements specified by selector in yellow | 323 // Highlight the elements specified by selector in yellow |
| 328 highlightElements(selectorList.join(",")); | 324 highlightElements(selectorList.join(",")); |
| 329 // Now, actually highlight the element the user clicked on in red | 325 // Now, actually highlight the element the user clicked on in red |
| 330 currentElement.style.setProperty("-webkit-box-shadow", "inset 0px 0px 5px #fd1
708"); | 326 currentElement.style.setProperty("-webkit-box-shadow", "inset 0px 0px 5px #fd1
708"); |
| 331 currentElement.style.backgroundColor = "#f6a1b5"; | 327 currentElement.style.backgroundColor = "#f6a1b5"; |
| 332 | 328 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 if(msg.filter === url) | 543 if(msg.filter === url) |
| 548 { | 544 { |
| 549 // This request would have come from the chrome.contextMenu handler, s
o we | 545 // This request would have come from the chrome.contextMenu handler, s
o we |
| 550 // simulate the user having chosen the element to get rid of via the u
sual means. | 546 // simulate the user having chosen the element to get rid of via the u
sual means. |
| 551 clickHide_activated = true; | 547 clickHide_activated = true; |
| 552 // FIXME: clickHideFilters is erased in clickHide_mouseClick anyway, s
o why set it? | 548 // FIXME: clickHideFilters is erased in clickHide_mouseClick anyway, s
o why set it? |
| 553 clickHideFilters = [msg.filter]; | 549 clickHideFilters = [msg.filter]; |
| 554 // Coerce red highlighted overlay on top of element to remove. | 550 // Coerce red highlighted overlay on top of element to remove. |
| 555 // TODO: Wow, the design of the clickHide stuff is really dumb - gotta
fix it sometime | 551 // TODO: Wow, the design of the clickHide stuff is really dumb - gotta
fix it sometime |
| 556 currentElement = addElementOverlay(target); | 552 currentElement = addElementOverlay(target); |
| 553 currentElement_backgroundColor = target.style.backgroundColor; |
| 557 // clickHide_mouseOver(lastRightClickEvent); | 554 // clickHide_mouseOver(lastRightClickEvent); |
| 558 clickHide_mouseClick(lastRightClickEvent); | 555 clickHide_mouseClick(lastRightClickEvent); |
| 559 } | 556 } |
| 560 else | 557 else |
| 561 console.log("clickhide-new-filter: URLs don't match. Couldn't find tha
t element.", request.filter, url, lastRightClickEvent.target.src); | 558 console.log("clickhide-new-filter: URLs don't match. Couldn't find tha
t element.", request.filter, url, lastRightClickEvent.target.src); |
| 562 break; | 559 break; |
| 563 case "clickhide-init": | 560 case "clickhide-init": |
| 564 if (clickHideFiltersDialog) | 561 if (clickHideFiltersDialog) |
| 565 { | 562 { |
| 566 sendResponse({filters: clickHide_filters}); | 563 sendResponse({filters: clickHide_filters}); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 586 | 583 |
| 587 clickHide_deactivate(); | 584 clickHide_deactivate(); |
| 588 } | 585 } |
| 589 break; | 586 break; |
| 590 default: | 587 default: |
| 591 sendResponse({}); | 588 sendResponse({}); |
| 592 break; | 589 break; |
| 593 } | 590 } |
| 594 }); | 591 }); |
| 595 } | 592 } |
| OLD | NEW |