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 #4543 Created Oct. 17, 2016, 2:43 p.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
4 // no need to invoke if already invoked on another event
5 if (jsBridge.isElementsHidden())
6 {
7 {{DEBUG}} console.log('already hidden, exiting');
8 return;
9 }
10
11 // hide using element visibility (to be replaced with script body)
12 {{HIDE}}
13
14 {{BRIDGE}}.setElementsHidden(true); // set flag not to do it again
15 };
16
17 if ({{BRIDGE}}.getAddDomListener() && document.readyState != 'complete')
18 {
19 {{BRIDGE}}.setAddDomListener(false);
20
21 // onreadystatechange event
22 document.onreadystatechange = function()
23 {
24 {{DEBUG}} console.log('onreadystatechange() event fired (' + document.readyS tate + ')')
25 if (document.readyState == 'interactive')
26 {
27 hideElements();
28 }
29 }
30
31 // load event
32 window.addEventListener('load', function(event)
33 {
34 {{DEBUG}} console.log('load() event fired');
35 hideElements();
36 });
37
38 // DOMContentLoaded event
39 document.addEventListener('DOMContentLoaded', function()
40 {
41 {{DEBUG}} console.log('DOMContentLoaded() event fired');
42 hideElements();
43 }, false);
44
45 };
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