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}; |
} |