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

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

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Left Patch Set: added goBack/goForward support, added 'setAAenabled' setting, modified app for testing Created Sept. 26, 2016, 12:59 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/hide.js ('k') | libadblockplus-android-webview/build.gradle » ('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 var hideElements = function()
2 {
3 // no need to invoke if already invoked on another event
4 if ({{BRIDGE}}.isElementsHidden())
5 {
6 {{DEBUG}} console.log('already hidden, exiting');
7 return;
8 }
9
10 // hide using element visibility (to be replaced with script body)
11 {{HIDE}}
12
13 {{BRIDGE}}.setElementsHidden(true); // set flag not to do it again
14 };
15
16 if ({{BRIDGE}}.getAddDomListener() && document.readyState != 'complete')
17 {
18 {{BRIDGE}}.setAddDomListener(false);
19
20 // onreadystatechange event
21 document.onreadystatechange = function()
22 {
23 {{DEBUG}} console.log('onreadystatechange() event fired (' + document.readyS tate + ')')
24 if (document.readyState == 'interactive')
25 {
26 hideElements();
27 }
28 }
29
30 // load event
31 window.addEventListener('load', function(event)
32 {
33 {{DEBUG}} console.log('load() event fired');
34 hideElements();
35 });
36
37 // DOMContentLoaded event
38 document.addEventListener('DOMContentLoaded', function()
39 {
40 {{DEBUG}} console.log('DOMContentLoaded() event fired');
41 hideElements();
42 }, false);
43
44 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld