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

Side by Side Diff: popup.js

Issue 29340571: Issue 3687 - Add experimental support for Safari content blockers (Closed)
Patch Set: Created April 19, 2016, 1:59 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
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 { 56 {
57 if (checkWhitelisted(page)) 57 if (checkWhitelisted(page))
58 document.body.classList.add("disabled"); 58 document.body.classList.add("disabled");
59 59
60 page.sendMessage({type: "composer.content.getState"}, function(response) 60 page.sendMessage({type: "composer.content.getState"}, function(response)
61 { 61 {
62 if (response && response.active) 62 if (response && response.active)
63 document.body.classList.add("clickhide-active"); 63 document.body.classList.add("clickhide-active");
64 }); 64 });
65 } 65 }
66
67 // For Safari, if the content blocking API is active we need to hide the
68 // stats section. (The content blocking API doesn't provide a way for us to
69 // offer those blocking statistics.)
70 ext.backgroundPage.sendMessage({type: "safari.contentBlockingActive"},
71 function (contentBlockingActive)
72 {
73 if (contentBlockingActive)
74 document.body.classList.add("contentblocking-active");
75 }
76 );
66 }); 77 });
67 78
68 document.getElementById("enabled").addEventListener("click", toggleEnabled, fa lse); 79 document.getElementById("enabled").addEventListener("click", toggleEnabled, fa lse);
69 document.getElementById("clickhide").addEventListener("click", activateClickHi de, false); 80 document.getElementById("clickhide").addEventListener("click", activateClickHi de, false);
70 document.getElementById("clickhide-cancel").addEventListener("click", cancelCl ickHide, false); 81 document.getElementById("clickhide-cancel").addEventListener("click", cancelCl ickHide, false);
71 document.getElementById("options").addEventListener("click", function() 82 document.getElementById("options").addEventListener("click", function()
72 { 83 {
73 ext.showOptions(); 84 ext.showOptions();
74 }, false); 85 }, false);
75 86
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 145 }
135 146
136 function toggleCollapse(event) 147 function toggleCollapse(event)
137 { 148 {
138 var collapser = event.currentTarget; 149 var collapser = event.currentTarget;
139 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option]; 150 Prefs[collapser.dataset.option] = !Prefs[collapser.dataset.option];
140 collapser.parentNode.classList.toggle("collapsed"); 151 collapser.parentNode.classList.toggle("collapsed");
141 } 152 }
142 153
143 document.addEventListener("DOMContentLoaded", onLoad, false); 154 document.addEventListener("DOMContentLoaded", onLoad, false);
OLDNEW

Powered by Google App Engine
This is Rietveld