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

Unified Diff: adblockplus/Api.jsm

Issue 29342912: Issue 3070 - Create Adblock Plus on/off switch (Closed)
Patch Set: Adjusting preferences xml attributes order Created Oct. 26, 2016, 12:37 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mobile/android/base/locales/adblockbrowser/en-US/android_strings.dtd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: adblockplus/Api.jsm
===================================================================
--- a/adblockplus/Api.jsm
+++ b/adblockplus/Api.jsm
@@ -59,16 +59,24 @@ function getWhitelistingFilter(url)
}
var AdblockPlusApi =
{
get filtersLoaded()
{
return !FilterStorage._loading;
},
+ get adblockPlusEnabled()
+ {
+ return Prefs.enabled;
+ },
+ set adblockPlusEnabled(adblockPlusEnabled)
+ {
+ Prefs.enabled = adblockPlusEnabled
+ },
get acceptableAdsEnabled()
{
return FilterStorage.subscriptions.some(
(subscription) => subscription.url == Prefs.subscriptions_exceptionsurl);
},
set acceptableAdsEnabled(acceptableAdsEnabled)
{
if (acceptableAdsEnabled != AdblockPlusApi.acceptableAdsEnabled)
@@ -170,16 +178,25 @@ var AdblockPlusApi =
if (data["action"] == "getFiltersLoaded")
return {"success": true, "value": this.filtersLoaded};
if (!this.filtersLoaded)
return {"success": false, "error": "filters not loaded"};
switch (data["action"])
{
+ case "getAdblockPlusEnabled":
+ return {"success": true, "value": this.adblockPlusEnabled};
+ case "setAdblockPlusEnabled":
+ if ("enable" in data)
+ {
+ this.adblockPlusEnabled = !!data["enable"];
+ return {"success": true};
+ }
+ break;
case "getAcceptableAdsEnabled":
return {"success": true, "value": this.acceptableAdsEnabled};
case "setAcceptableAdsEnabled":
if ("enable" in data)
{
this.acceptableAdsEnabled = !!data["enable"];
return {"success": true};
}
« no previous file with comments | « no previous file | mobile/android/base/locales/adblockbrowser/en-US/android_strings.dtd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld