| Index: background.js |
| =================================================================== |
| --- a/background.js |
| +++ b/background.js |
| @@ -1,8 +1,13 @@ |
| -var FilterNotifier = require("filterNotifier").FilterNotifier; |
| -var FilterStorage = require("filterStorage").FilterStorage; |
| -var Synchronizer = require("synchronizer").Synchronizer; |
| -var Subscription = require("subscriptionClasses").Subscription; |
| -var DownloadableSubscription = require("subscriptionClasses").DownloadableSubscription; |
| +importAll("filterClasses", this); |
| +importAll("subscriptionClasses", this); |
| +importAll("filterStorage", this); |
| +importAll("elemHide", this); |
| +importAll("filterListener", this); |
| +importAll("filterNotifier", this); |
| +importAll("matcher", this); |
| +importAll("prefs", this); |
| +importAll("synchronizer", this); |
| +importAll("utils", this); |
|
Wladimir Palant
2012/10/12 15:04:02
Please don't use importAll, it hides what is actua
Felix Dahlke
2012/10/16 14:20:01
Okay, done. I tried to keep it similar to Chrome s
Felix Dahlke
2012/10/16 14:20:01
Done. I actually did that to keep the files simila
|
| var isFirstRun = false; |
| FilterNotifier.addListener(function(action) |
| @@ -144,3 +149,35 @@ |
| }; |
| request.send(null); |
| } |
| + |
| +function addToolbarIcon() |
| +{ |
| + var properties = { |
| + disabled: false, |
| + title: "Adblock Plus", |
| + icon: "icons/abp-18.png" |
| + }; |
| + |
| + var button = opera.contexts.toolbar.createItem(properties); |
| + opera.contexts.toolbar.addItem(button); |
| +} |
| + |
| +function loadMessages(callback) |
| +{ |
| + var request = new XMLHttpRequest(); |
| + request.open("GET", "messages.json"); |
| + request.responseType = "json"; |
| + request.addEventListener("load", function() |
| + { |
| + callback(request.response); |
| + }); |
| + request.send(); |
| +} |
| + |
| +addToolbarIcon(); |
| + |
| +var i18nMessages; |
| +loadMessages(function(messages) |
| +{ |
| + i18nMessages = messages; |
| +}); |
|
Wladimir Palant
2012/10/12 15:04:02
a) Is it necessary to assign explicitly here? Can'
Felix Dahlke
2012/10/16 14:20:01
Hm, don't you think it would be less obvious that
|