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

Side by Side Diff: background.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 | « no previous file | options.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 importAll("filterClasses", this); 1 with(require("filterClasses"))
2 importAll("subscriptionClasses", this); 2 {
3 importAll("filterStorage", this); 3 this.Filter = Filter;
4 importAll("elemHide", this); 4 this.RegExpFilter = RegExpFilter;
5 importAll("filterListener", this); 5 this.BlockingFilter = BlockingFilter;
6 importAll("filterNotifier", this); 6 this.WhitelistFilter = WhitelistFilter;
7 importAll("matcher", this); 7 }
8 importAll("prefs", this); 8 with(require("subscriptionClasses"))
9 importAll("synchronizer", this); 9 {
10 importAll("utils", this); 10 this.Subscription = Subscription;
11 this.DownloadableSubscription = DownloadableSubscription;
12 }
13 var FilterStorage = require("filterStorage").FilterStorage;
14 var ElemHide = require("elemHide").ElemHide;
15 var defaultMatcher = require("matcher").defaultMatcher;
16 var Synchronizer = require("synchronizer").Synchronizer;
11 17
12 // Some types cannot be distinguished 18 // Some types cannot be distinguished
13 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; 19 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
14 RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OT HER; 20 RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OT HER;
15 21
16 var isFirstRun = false; 22 var isFirstRun = false;
17 FilterNotifier.addListener(function(action) 23 require("filterNotifier").FilterNotifier.addListener(function(action)
18 { 24 {
19 if (action == "load") 25 if (action == "load")
20 { 26 {
21 importOldData(); 27 importOldData();
22 if (!localStorage["currentVersion"]) 28 if (!localStorage["currentVersion"])
23 { 29 {
24 isFirstRun = true; 30 isFirstRun = true;
25 executeFirstRunActions(); 31 executeFirstRunActions();
26 } 32 }
27 localStorage["currentVersion"] = require("info").addonVersion; 33 localStorage["currentVersion"] = require("info").addonVersion;
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 refreshIconAndContextMenu(windows[i].tabs[j]); 521 refreshIconAndContextMenu(windows[i].tabs[j]);
516 }); 522 });
517 523
518 // Update icon if a tab changes location 524 // Update icon if a tab changes location
519 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) 525 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
520 { 526 {
521 chrome.tabs.sendRequest(tabId, {reqtype: "clickhide-deactivate"}) 527 chrome.tabs.sendRequest(tabId, {reqtype: "clickhide-deactivate"})
522 if(changeInfo.status == "loading") 528 if(changeInfo.status == "loading")
523 refreshIconAndContextMenu(tab); 529 refreshIconAndContextMenu(tab);
524 }); 530 });
OLDNEW
« no previous file with comments | « no previous file | options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld