Left: | ||
Right: |
OLD | NEW |
---|---|
1 var FilterNotifier = require("filterNotifier").FilterNotifier; | 1 importAll("filterClasses", this); |
2 var FilterStorage = require("filterStorage").FilterStorage; | 2 importAll("subscriptionClasses", this); |
3 var Synchronizer = require("synchronizer").Synchronizer; | 3 importAll("filterStorage", this); |
4 var Subscription = require("subscriptionClasses").Subscription; | 4 importAll("elemHide", this); |
5 var DownloadableSubscription = require("subscriptionClasses").DownloadableSubscr iption; | 5 importAll("filterListener", this); |
6 importAll("filterNotifier", this); | |
7 importAll("matcher", this); | |
8 importAll("prefs", this); | |
9 importAll("synchronizer", this); | |
10 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
| |
6 | 11 |
7 var isFirstRun = false; | 12 var isFirstRun = false; |
8 FilterNotifier.addListener(function(action) | 13 FilterNotifier.addListener(function(action) |
9 { | 14 { |
10 if (action == "load") | 15 if (action == "load") |
11 { | 16 { |
12 importOldData(); | 17 importOldData(); |
13 if (!window.localStorage.currentVersion) | 18 if (!window.localStorage.currentVersion) |
14 { | 19 { |
15 isFirstRun = true; | 20 isFirstRun = true; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 subscription.disabled = false; | 142 subscription.disabled = false; |
138 subscription.title = selectedItem.getAttribute("title"); | 143 subscription.title = selectedItem.getAttribute("title"); |
139 subscription.homepage = selectedItem.getAttribute("homepage"); | 144 subscription.homepage = selectedItem.getAttribute("homepage"); |
140 if (subscription instanceof DownloadableSubscription && !subscription.last Download) | 145 if (subscription instanceof DownloadableSubscription && !subscription.last Download) |
141 Synchronizer.execute(subscription); | 146 Synchronizer.execute(subscription); |
142 FilterStorage.addSubscription(subscription); | 147 FilterStorage.addSubscription(subscription); |
143 } | 148 } |
144 }; | 149 }; |
145 request.send(null); | 150 request.send(null); |
146 } | 151 } |
152 | |
153 function addToolbarIcon() | |
154 { | |
155 var properties = { | |
156 disabled: false, | |
157 title: "Adblock Plus", | |
158 icon: "icons/abp-18.png" | |
159 }; | |
160 | |
161 var button = opera.contexts.toolbar.createItem(properties); | |
162 opera.contexts.toolbar.addItem(button); | |
163 } | |
164 | |
165 function loadMessages(callback) | |
166 { | |
167 var request = new XMLHttpRequest(); | |
168 request.open("GET", "messages.json"); | |
169 request.responseType = "json"; | |
170 request.addEventListener("load", function() | |
171 { | |
172 callback(request.response); | |
173 }); | |
174 request.send(); | |
175 } | |
176 | |
177 addToolbarIcon(); | |
178 | |
179 var i18nMessages; | |
180 loadMessages(function(messages) | |
181 { | |
182 i18nMessages = messages; | |
183 }); | |
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
| |
OLD | NEW |