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

Unified Diff: background.js

Issue 8560083: adblockplusopera: Port UI code from Chrome (Closed)
Patch Set: Created Oct. 12, 2012, 1:11 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | button.js » ('j') | i18n.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | button.js » ('j') | i18n.js » ('J')

Powered by Google App Engine
This is Rietveld