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

Side by Side Diff: libadblockplus-android-webview/assets/inject.js

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Patch Set: fixed: hardcoded js bridge name Created Oct. 21, 2016, 10:33 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 };
OLDNEW
« no previous file with comments | « libadblockplus-android-webview/assets/hide.js ('k') | libadblockplus-android-webview/build.gradle » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld