Index: options.js |
=================================================================== |
--- a/options.js |
+++ b/options.js |
@@ -1,24 +1,36 @@ |
var backgroundPage = chrome.extension.getBackgroundPage(); |
-var imports = ["FilterStorage", "FilterNotifier", "Subscription", "SpecialSubscription", |
- "DownloadableSubscription", "Filter", "WhitelistFilter", |
- "Synchronizer", "Prefs", "Utils", "require"]; |
-for (var i = 0; i < imports.length; i++) |
- window[imports[i]] = backgroundPage[imports[i]]; |
+var require = backgroundPage.require; |
+ |
+with(require("filterClasses")) |
+{ |
+ this.Filter = Filter; |
+ this.WhitelistFilter = WhitelistFilter; |
+} |
+with(require("subscriptionClasses")) |
+{ |
+ this.Subscription = Subscription; |
+ this.SpecialSubscription = SpecialSubscription; |
+ this.DownloadableSubscription = DownloadableSubscription; |
+} |
+var FilterStorage = require("filterStorage").FilterStorage; |
+var FilterNotifier = require("filterNotifier").FilterNotifier; |
+var Prefs = require("prefs").Prefs; |
+var Synchronizer = require("synchronizer").Synchronizer; |
// Loads options from localStorage and sets UI elements accordingly |
function loadOptions() |
{ |
// Set page title to i18n version of "Adblock Plus Options" |
document.title = i18n.getMessage("options"); |
// Set links |
$("#acceptableAdsLink").attr("href", Prefs.subscriptions_exceptionsurl); |
- $("#acceptableAdsDocs").attr("href", Prefs.documentation_link.replace(/%LINK%/g, "acceptable_ads").replace(/%LANG%/g, Utils.appLocale)); |
+ $("#acceptableAdsDocs").attr("href", Prefs.documentation_link.replace(/%LINK%/g, "acceptable_ads").replace(/%LANG%/g, require("utils").Utils.appLocale)); |
// Add event listeners |
window.addEventListener("unload", unloadOptions, false); |
$("#updateFilterLists").click(updateFilterLists); |
$("#startSubscriptionSelection").click(startSubscriptionSelection); |
$("#subscriptionSelector").change(updateSubscriptionSelection); |
$("#addSubscription").click(addSubscription); |
$("#acceptableAds").click(allowAcceptableAds); |