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

Side by Side Diff: options.js

Issue 8616119: Use require() properly instead of importing all symbols of a module (Closed)
Patch Set: Created Oct. 22, 2012, 8:48 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « background.js ('k') | popup.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var backgroundPage = chrome.extension.getBackgroundPage(); 1 var backgroundPage = chrome.extension.getBackgroundPage();
2 var imports = ["FilterStorage", "FilterNotifier", "Subscription", "SpecialSubscr iption", 2 var require = backgroundPage.require;
3 "DownloadableSubscription", "Filter", "WhitelistFilter", 3
4 "Synchronizer", "Prefs", "Utils", "require"]; 4 with(require("filterClasses"))
5 for (var i = 0; i < imports.length; i++) 5 {
6 window[imports[i]] = backgroundPage[imports[i]]; 6 this.Filter = Filter;
7 this.WhitelistFilter = WhitelistFilter;
8 }
9 with(require("subscriptionClasses"))
10 {
11 this.Subscription = Subscription;
12 this.SpecialSubscription = SpecialSubscription;
13 this.DownloadableSubscription = DownloadableSubscription;
14 }
15 var FilterStorage = require("filterStorage").FilterStorage;
16 var FilterNotifier = require("filterNotifier").FilterNotifier;
17 var Prefs = require("prefs").Prefs;
18 var Synchronizer = require("synchronizer").Synchronizer;
7 19
8 // Loads options from localStorage and sets UI elements accordingly 20 // Loads options from localStorage and sets UI elements accordingly
9 function loadOptions() 21 function loadOptions()
10 { 22 {
11 // Set page title to i18n version of "Adblock Plus Options" 23 // Set page title to i18n version of "Adblock Plus Options"
12 document.title = i18n.getMessage("options"); 24 document.title = i18n.getMessage("options");
13 25
14 // Set links 26 // Set links
15 $("#acceptableAdsLink").attr("href", Prefs.subscriptions_exceptionsurl); 27 $("#acceptableAdsLink").attr("href", Prefs.subscriptions_exceptionsurl);
16 $("#acceptableAdsDocs").attr("href", Prefs.documentation_link.replace(/%LINK%/ g, "acceptable_ads").replace(/%LANG%/g, Utils.appLocale)); 28 $("#acceptableAdsDocs").attr("href", Prefs.documentation_link.replace(/%LINK%/ g, "acceptable_ads").replace(/%LANG%/g, require("utils").Utils.appLocale));
17 29
18 // Add event listeners 30 // Add event listeners
19 window.addEventListener("unload", unloadOptions, false); 31 window.addEventListener("unload", unloadOptions, false);
20 $("#updateFilterLists").click(updateFilterLists); 32 $("#updateFilterLists").click(updateFilterLists);
21 $("#startSubscriptionSelection").click(startSubscriptionSelection); 33 $("#startSubscriptionSelection").click(startSubscriptionSelection);
22 $("#subscriptionSelector").change(updateSubscriptionSelection); 34 $("#subscriptionSelector").change(updateSubscriptionSelection);
23 $("#addSubscription").click(addSubscription); 35 $("#addSubscription").click(addSubscription);
24 $("#acceptableAds").click(allowAcceptableAds); 36 $("#acceptableAds").click(allowAcceptableAds);
25 $("#whitelistForm").submit(addWhitelistDomain); 37 $("#whitelistForm").submit(addWhitelistDomain);
26 $("#removeWhitelist").click(removeSelectedExcludedDomain); 38 $("#removeWhitelist").click(removeSelectedExcludedDomain);
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 if (subscription.disabled == !enabled.checked) 596 if (subscription.disabled == !enabled.checked)
585 return; 597 return;
586 598
587 subscription.disabled = !enabled.checked; 599 subscription.disabled = !enabled.checked;
588 }, false); 600 }, false);
589 601
590 updateSubscriptionInfo(element); 602 updateSubscriptionInfo(element);
591 603
592 document.getElementById("filterLists").appendChild(element); 604 document.getElementById("filterLists").appendChild(element);
593 } 605 }
OLDNEW
« no previous file with comments | « background.js ('k') | popup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld