Index: include.preload.js |
=================================================================== |
--- a/include.preload.js |
+++ b/include.preload.js |
@@ -495,52 +495,54 @@ |
browser.runtime.sendMessage({ |
type: "devtools.traceElemHide", |
selectors: [], |
filters |
}); |
} |
}, |
- apply() |
+ apply({trace, inline, inlineEmulated, selectors, emulatedPatterns} = {}) |
{ |
- browser.runtime.sendMessage({type: "elemhide.getSelectors"}, response => |
- { |
- if (this.tracer) |
- this.tracer.disconnect(); |
- this.tracer = null; |
+ if (this.tracer) |
+ this.tracer.disconnect(); |
+ this.tracer = null; |
- if (response.trace) |
- this.tracer = new ElementHidingTracer(); |
+ if (trace) |
+ this.tracer = new ElementHidingTracer(); |
- this.inline = response.inline; |
- this.inlineEmulated = !!response.inlineEmulated; |
+ this.inline = inline; |
+ this.inlineEmulated = !!inlineEmulated; |
- if (this.inline) |
- this.addSelectorsInline(response.selectors, "standard"); |
+ if (this.inline) |
+ this.addSelectorsInline(selectors, "standard"); |
- if (this.tracer) |
- this.tracer.addSelectors(response.selectors); |
+ if (this.tracer) |
+ this.tracer.addSelectors(selectors); |
- // Prefer CSS selectors for -abp-has and -abp-contains unless the |
- // background page has asked us to use inline styles. |
- this.elemHideEmulation.useInlineStyles = this.inline || |
- this.inlineEmulated; |
+ // Prefer CSS selectors for -abp-has and -abp-contains unless the |
+ // background page has asked us to use inline styles. |
+ this.elemHideEmulation.useInlineStyles = this.inline || |
+ this.inlineEmulated; |
- this.elemHideEmulation.apply(response.emulatedPatterns); |
- }); |
+ this.elemHideEmulation.apply(emulatedPatterns); |
} |
}; |
if (document instanceof HTMLDocument) |
{ |
checkSitekey(); |
elemhide = new ElemHide(); |
- elemhide.apply(); |
+ |
+ browser.runtime.onMessage.addListener(message => |
+ { |
+ if (message.type == "elemhide.apply") |
+ elemhide.apply(message); |
+ }); |
document.addEventListener("error", event => |
{ |
checkCollapse(event.target); |
}, true); |
document.addEventListener("load", event => |
{ |