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

Delta Between Two Patch Sets: libadblockplus-android-webview/assets/hide.js

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Left Patch Set: supporting api 21 with referer and pre-21 with no referer Created Sept. 30, 2016, 1:28 p.m.
Right Patch Set: changed packages, now using AdblockEngine (original ABPEngine), improved demo app Created Oct. 25, 2016, 11:20 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « libadblockplus-android-webview/assets/empty.js ('k') | libadblockplus-android-webview/assets/inject.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 {
2 {{DEBUG}} console.log('started hiding elements');
3 var selectors = JSON.parse({{BRIDGE}}.getElemhideSelectors());
4 {{DEBUG}} console.log('parsed selectors: ' + selectors.length);
5 for (var i = 0; i < selectors.length; i++)
6 {
7 var selector = selectors[i];
8 // console.log('testing selector ' + selector);
9 if (selector[0] == '#')
10 {
11 var element = document.getElementById(selector.substr(1));
12 if (element != undefined)
13 {
14 {{DEBUG}} console.log('elem blocked ' + selector);
15 element.style.display = 'none';
16 };
17 }
18 else
19 {
20 var elements = document.getElementsByClassName(selector.substr(1));
21 for (var k=0; k < elements.length; k++)
22 {
23 {{DEBUG}} console.log('elem hidden ' + selector);
24 elements[k].style.display = 'none';
25 }
26 };
27 };
28 {{DEBUG}} console.log('finished hiding elements');
29 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld