Index: libadblockplus-android-webview/assets/css.js |
diff --git a/libadblockplus-android-webview/assets/css.js b/libadblockplus-android-webview/assets/css.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..708c1e5b6954d8d5eded3289f1c4353fe7591942 |
--- /dev/null |
+++ b/libadblockplus-android-webview/assets/css.js |
@@ -0,0 +1,21 @@ |
+{ |
+ {{DEBUG}} console.log('starting injecting css rules'); |
+ var selectors = JSON.parse({{BRIDGE}}.getElemhideSelectors()); |
+ {{DEBUG}} console.log('parsed selectors: ' + selectors.length); |
+ var head = document.getElementsByTagName("head")[0]; |
+ var style = document.createElement("style"); |
+ head.appendChild(style); |
+ var sheet = style.sheet ? style.sheet : style.styleSheet; |
+ for (var i=0; i<selectors.length; i++) |
+ { |
+ if (sheet.insertRule) |
+ { |
+ sheet.insertRule(selectors[i] + ' { display: none !important; }', 0); |
+ } |
+ else |
+ { |
+ sheet.addRule(selectors[i], 'display: none !important;', 0); |
+ } |
+ } |
+ {{DEBUG}} console.log('finished injecting css rules'); |
+} |