| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 var SpecialSubscription = subscriptionClasses.SpecialSubscription; | 37 var SpecialSubscription = subscriptionClasses.SpecialSubscription; |
| 38 | 38 |
| 39 function convertObject(keys, obj) | 39 function convertObject(keys, obj) |
| 40 { | 40 { |
| 41 var result = {}; | 41 var result = {}; |
| 42 for (var i = 0; i < keys.length; i++) | 42 for (var i = 0; i < keys.length; i++) |
| 43 result[keys[i]] = obj[keys[i]]; | 43 result[keys[i]] = obj[keys[i]]; |
| 44 return result; | 44 return result; |
| 45 } | 45 } |
| 46 | 46 |
| 47 var convertSubscription = convertObject.bind(null, ["disabled", "downloadStatu
s", | 47 var convertSubscription = convertObject.bind(null, ["disabled", |
| 48 "homepage", "lastSuccess", "title", "url"]); | 48 "downloadStatus", "homepage", "lastSuccess", "title", "url"]); |
| 49 var convertFilter = convertObject.bind(null, ["text"]); | 49 var convertFilter = convertObject.bind(null, ["text"]); |
| 50 | 50 |
| 51 var changeListeners = null; | 51 var changeListeners = null; |
| 52 var messageTypes = { | 52 var messageTypes = { |
| 53 "app": "app.listen", | 53 "app": "app.listen", |
| 54 "filter": "filters.listen", | 54 "filter": "filters.listen", |
| 55 "subscription": "subscriptions.listen" | 55 "subscription": "subscriptions.listen" |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 function onFilterChange(action) | 58 function onFilterChange(action) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 { | 120 { |
| 121 listenerFilters = Object.create(null); | 121 listenerFilters = Object.create(null); |
| 122 changeListeners.set(sender.page, listenerFilters); | 122 changeListeners.set(sender.page, listenerFilters); |
| 123 } | 123 } |
| 124 break; | 124 break; |
| 125 } | 125 } |
| 126 | 126 |
| 127 switch (message.type) | 127 switch (message.type) |
| 128 { | 128 { |
| 129 case "add-subscription": | 129 case "add-subscription": |
| 130 var subscription = Subscription.fromURL(message.url); | 130 ext.showOptions(function() |
| 131 subscription.title = message.title; | 131 { |
| 132 onFilterChange("addSubscription", subscription); | 132 var subscription = Subscription.fromURL(message.url); |
| 133 subscription.title = message.title; |
| 134 onFilterChange("addSubscription", subscription); |
| 135 }); |
| 133 break; | 136 break; |
| 134 case "app.get": | 137 case "app.get": |
| 135 if (message.what == "issues") | 138 if (message.what == "issues") |
| 136 { | 139 { |
| 137 var info = require("info"); | 140 var info = require("info"); |
| 138 callback({ | 141 callback({ |
| 139 seenDataCorruption: "seenDataCorruption" in global ? global.seenData
Corruption : false, | 142 seenDataCorruption: "seenDataCorruption" in global ? global.seenData
Corruption : false, |
| 140 filterlistsReinitialized: "filterlistsReinitialized" in global ? glo
bal.filterlistsReinitialized : false, | 143 filterlistsReinitialized: "filterlistsReinitialized" in global ? glo
bal.filterlistsReinitialized : false, |
| 141 legacySafariVersion: (info.platform == "safari" && ( | 144 legacySafariVersion: (info.platform == "safari" && ( |
| 142 Services.vc.compare(info.platformVersion, "6.0") < 0 || // bef
oreload breaks websites in Safari 5 | 145 Services.vc.compare(info.platformVersion, "6.0") < 0 || // bef
oreload breaks websites in Safari 5 |
| 143 Services.vc.compare(info.platformVersion, "6.1") == 0 || // ext
ensions are broken in 6.1 and 7.0 | 146 Services.vc.compare(info.platformVersion, "6.1") == 0 || // ext
ensions are broken in 6.1 and 7.0 |
| 144 Services.vc.compare(info.platformVersion, "7.0") == 0)) | 147 Services.vc.compare(info.platformVersion, "7.0") == 0)) |
| 145 }); | 148 }); |
| 146 } | 149 } |
| 147 else if (message.what == "doclink") | 150 else if (message.what == "doclink") |
| 148 callback(Utils.getDocLink(message.link)); | 151 callback(Utils.getDocLink(message.link)); |
| 149 else if (message.what == "localeInfo") | 152 else if (message.what == "localeInfo") |
| 150 { | 153 { |
| 151 callback({ | 154 callback({ |
| 152 locale: Utils.appLocale, | 155 locale: Utils.appLocale, |
| 153 isRTL: Utils.chromeRegistry.isLocaleRTL("adblockplus") | 156 isRTL: Utils.chromeRegistry.isLocaleRTL("adblockplus") |
| 154 }); | 157 }); |
| 155 } | 158 } |
| 159 else if (message.what == "addonVersion") |
| 160 { |
| 161 callback(require("info").addonVersion); |
| 162 } |
| 156 else | 163 else |
| 157 callback(null); | 164 callback(null); |
| 158 break; | 165 break; |
| 159 case "app.listen": | 166 case "app.listen": |
| 160 if (message.filter) | 167 if (message.filter) |
| 161 listenerFilters.app = message.filter; | 168 listenerFilters.app = message.filter; |
| 162 else | 169 else |
| 163 delete listenerFilters.app; | 170 delete listenerFilters.app; |
| 164 break; | 171 break; |
| 165 case "app.open": | 172 case "app.open": |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 subscription.title = message.title; | 264 subscription.title = message.title; |
| 258 subscription.homepage = message.homepage; | 265 subscription.homepage = message.homepage; |
| 259 FilterStorage.addSubscription(subscription); | 266 FilterStorage.addSubscription(subscription); |
| 260 if (!subscription.lastDownload) | 267 if (!subscription.lastDownload) |
| 261 Synchronizer.execute(subscription); | 268 Synchronizer.execute(subscription); |
| 262 } | 269 } |
| 263 break; | 270 break; |
| 264 } | 271 } |
| 265 }); | 272 }); |
| 266 })(this); | 273 })(this); |
| LEFT | RIGHT |