| Index: include.postload.js |
| =================================================================== |
| --- a/include.postload.js |
| +++ b/include.postload.js |
| @@ -506,15 +506,19 @@ |
| if (currentElement.classList.contains("__adblockplus__overlay")) |
| elt = currentElement.prisoner; |
| - clickHideFilters = new Array(); |
| - selectorList = new Array(); |
| + clickHideFilters = []; |
| + elemHideFilters = []; |
| + selectorList = []; |
| var addSelector = function(selector) |
| { |
| if (selectorList.indexOf(selector) != -1) |
| return; |
| - clickHideFilters.push(document.domain + "##" + selector); |
| + var filter = document.domain + "##" + selector; |
| + clickHideFilters.push(filter); |
| + elemHideFilters.push(filter); |
| + |
| selectorList.push(selector); |
| }; |
| @@ -558,14 +562,34 @@ |
| addSelector(escapeCSS(elt.localName) + '[style=' + quote(style) + ']'); |
| } |
| - // Show popup |
| - clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); |
| + ext.backgroundPage.sendMessage( |
| + { |
| + type: "can-block", |
| + urls: urls, |
| + mediatype: typeMap[elt.localName], |
| + elemHideFilters: elemHideFilters |
| + }, |
| - // Highlight the elements specified by selector in yellow |
| - if (selectorList.length > 0) |
| - highlightElements(selectorList.join(",")); |
| - // Now, actually highlight the element the user clicked on in red |
| - highlightElement(currentElement, "#fd1708", "#f6a1b5"); |
| + function(response) |
| + { |
| + if (response.canBlock) |
| + { |
| + clickHide_showDialog(e.clientX, e.clientY, clickHideFilters); |
| + |
| + // Highlight the elements specified by selector in yellow |
| + if (selectorList.length > 0) |
| + highlightElements(selectorList.join(",")); |
| + |
| + // Now, actually highlight the element the user clicked on in red |
| + highlightElement(currentElement, "#fd1708", "#f6a1b5"); |
| + } |
| + else |
| + { |
| + clickHide_deactivate(); |
| + alert(response.reason); |
| + } |
| + } |
| + ); |
| // Make sure the browser doesn't handle this click |
| e.preventDefault(); |