| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return "https://adblockplus.org/redirect?link=" + encodeURIComponent(lin
k); | 85 return "https://adblockplus.org/redirect?link=" + encodeURIComponent(lin
k); |
| 86 }, | 86 }, |
| 87 get appLocale() | 87 get appLocale() |
| 88 { | 88 { |
| 89 return parent.ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); | 89 return parent.ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 modules.prefs = { | 94 modules.prefs = { |
| 95 Prefs: new Notifier() | 95 Prefs: { |
| 96 onChanged: new Notifier() |
| 97 } |
| 96 }; | 98 }; |
| 97 var prefs = { | 99 var prefs = { |
| 98 notifications_ignoredcategories: (params.showNotificationUI) ? ["*"] : [], | 100 notifications_ignoredcategories: (params.showNotificationUI) ? ["*"] : [], |
| 99 notifications_showui: params.showNotificationUI, | 101 notifications_showui: params.showNotificationUI, |
| 100 safari_contentblocker: false, | 102 safari_contentblocker: false, |
| 101 shouldShowBlockElementMenu: true, | 103 shouldShowBlockElementMenu: true, |
| 104 show_devtools_panel: true, |
| 102 subscriptions_exceptionsurl: "https://easylist-downloads.adblockplus.org/exc
eptionrules.txt" | 105 subscriptions_exceptionsurl: "https://easylist-downloads.adblockplus.org/exc
eptionrules.txt" |
| 103 }; | 106 }; |
| 104 Object.keys(prefs).forEach(function(key) | 107 Object.keys(prefs).forEach(function(key) |
| 105 { | 108 { |
| 106 Object.defineProperty(modules.prefs.Prefs, key, { | 109 Object.defineProperty(modules.prefs.Prefs, key, { |
| 107 get: function() | 110 get: function() |
| 108 { | 111 { |
| 109 return prefs[key]; | 112 return prefs[key]; |
| 110 }, | 113 }, |
| 111 set: function(value) | 114 set: function(value) |
| 112 { | 115 { |
| 113 prefs[key] = value; | 116 prefs[key] = value; |
| 114 modules.prefs.Prefs.triggerListeners(key); | 117 modules.prefs.Prefs.onChanged.triggerListeners(key); |
| 115 return prefs[key]; | 118 return prefs[key]; |
| 116 } | 119 } |
| 117 }); | 120 }); |
| 118 }); | 121 }); |
| 119 | 122 |
| 120 modules.notification = { | 123 modules.notification = { |
| 121 Notification: { | 124 Notification: { |
| 122 toggleIgnoreCategory: function(category) | 125 toggleIgnoreCategory: function(category) |
| 123 { | 126 { |
| 124 var categories = prefs.notifications_ignoredcategories; | 127 var categories = prefs.notifications_ignoredcategories; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 236 } |
| 234 } | 237 } |
| 235 }; | 238 }; |
| 236 | 239 |
| 237 modules.filterClasses = { | 240 modules.filterClasses = { |
| 238 BlockingFilter: function() {}, | 241 BlockingFilter: function() {}, |
| 239 Filter: function(text) | 242 Filter: function(text) |
| 240 { | 243 { |
| 241 this.text = text; | 244 this.text = text; |
| 242 this.disabled = false; | 245 this.disabled = false; |
| 243 } | 246 }, |
| 247 RegExpFilter: function() {} |
| 244 }; | 248 }; |
| 245 modules.filterClasses.Filter.fromText = function(text) | 249 modules.filterClasses.Filter.fromText = function(text) |
| 246 { | 250 { |
| 247 return new modules.filterClasses.Filter(text); | 251 return new modules.filterClasses.Filter(text); |
| 248 }; | 252 }; |
| 253 modules.filterClasses.RegExpFilter.typeMap = Object.create(null); |
| 249 | 254 |
| 250 modules.filterValidation = | 255 modules.filterValidation = |
| 251 { | 256 { |
| 252 parseFilter: function(text) | 257 parseFilter: function(text) |
| 253 { | 258 { |
| 254 if (params.filterError) | 259 if (params.filterError) |
| 255 return {error: "Invalid filter"}; | 260 return {error: "Invalid filter"}; |
| 256 return {filter: modules.filterClasses.Filter.fromText(text)}; | 261 return {filter: modules.filterClasses.Filter.fromText(text)}; |
| 257 }, | 262 }, |
| 258 parseFilters: function(text) | 263 parseFilters: function(text) |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 469 |
| 465 if (params.safariContentBlocker) | 470 if (params.safariContentBlocker) |
| 466 { | 471 { |
| 467 global.safari = { | 472 global.safari = { |
| 468 extension: { | 473 extension: { |
| 469 setContentBlocker: function() {} | 474 setContentBlocker: function() {} |
| 470 } | 475 } |
| 471 }; | 476 }; |
| 472 } | 477 } |
| 473 })(this); | 478 })(this); |
| LEFT | RIGHT |