Left: | ||
Right: |
OLD | NEW |
---|---|
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 16 matching lines...) Expand all Loading... | |
27 var parts = params[i].split("=", 2); | 27 var parts = params[i].split("=", 2); |
28 if (parts.length == 2 && parts[0] in data) | 28 if (parts.length == 2 && parts[0] in data) |
29 data[parts[0]] = decodeURIComponent(parts[1]); | 29 data[parts[0]] = decodeURIComponent(parts[1]); |
30 } | 30 } |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 var subscriptions =[ | 34 var subscriptions =[ |
35 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", | 35 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", |
36 "https://easylist-downloads.adblockplus.org/exceptionrules.txt", | 36 "https://easylist-downloads.adblockplus.org/exceptionrules.txt", |
37 "https://easylist-downloads.adblockplus.org/fanboy-social.txt" | 37 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", |
38 "~user~786254" | |
39 ]; | |
40 var filters = [ | |
41 {text: "@@||alternate.de^$document"}, | |
42 {text: "@@||der.postillion.com^$document"}, | |
43 {text: "@@||taz.de^$document"}, | |
44 {text: "@@||amazon.de^$document"} | |
38 ]; | 45 ]; |
39 | 46 |
40 var modules = {}; | 47 var modules = {}; |
41 global.require = function(module) | 48 global.require = function(module) |
42 { | 49 { |
43 return modules[module]; | 50 return modules[module]; |
44 }; | 51 }; |
45 | 52 |
46 modules.utils = { | 53 modules.utils = { |
47 Utils: { | 54 Utils: { |
48 getDocLink: function(link) | 55 getDocLink: function(link) |
49 { | 56 { |
50 return "https://adblockplus.org/redirect?link=" + encodeURIComponent(lin k); | 57 return "https://adblockplus.org/redirect?link=" + encodeURIComponent(lin k); |
51 } | 58 } |
52 } | 59 } |
53 }; | 60 }; |
54 | 61 |
62 modules.prefs = { | |
63 Prefs: { | |
64 "subscriptions_exceptionsurl": "https://easylist-downloads.adblockplus.org /exceptionrules.txt" | |
65 } | |
66 } | |
67 | |
55 modules.subscriptionClasses = { | 68 modules.subscriptionClasses = { |
56 Subscription: function(url) | 69 Subscription: function(url) |
57 { | 70 { |
58 this.url = url; | 71 this.url = url; |
59 this.title = "Subscription " + url; | 72 this.title = "Subscription " + url; |
60 this.disabled = false; | 73 this.disabled = false; |
61 this.lastDownload = 1234; | 74 this.lastDownload = 1234; |
62 }, | 75 }, |
63 | 76 |
64 SpecialSubscription: function() {} | 77 SpecialSubscription: function(url) { |
78 this.url = url; | |
79 this.disabled = false; | |
80 this.filters = filters.slice(); | |
81 } | |
65 }; | 82 }; |
66 modules.subscriptionClasses.Subscription.fromURL = function(url) | 83 modules.subscriptionClasses.Subscription.fromURL = function(url) |
67 { | 84 { |
68 return new modules.subscriptionClasses.Subscription(url); | 85 if (/^https?:\/\//.test(url)) |
86 return new modules.subscriptionClasses.Subscription(url); | |
87 else | |
88 return new modules.subscriptionClasses.SpecialSubscription(url); | |
69 }; | 89 }; |
70 modules.subscriptionClasses.DownloadableSubscription = modules.subscriptionCla sses.Subscription; | 90 modules.subscriptionClasses.DownloadableSubscription = modules.subscriptionCla sses.Subscription; |
71 | 91 |
72 modules.filterStorage = { | 92 modules.filterStorage = { |
73 FilterStorage: { | 93 FilterStorage: { |
74 get subscriptions() | 94 get subscriptions() |
75 { | 95 { |
76 return subscriptions.map(modules.subscriptionClasses.Subscription.fromUR L); | 96 return subscriptions.map(modules.subscriptionClasses.Subscription.fromUR L); |
77 }, | 97 }, |
78 | 98 |
(...skipping 16 matching lines...) Expand all Loading... | |
95 }, | 115 }, |
96 | 116 |
97 removeSubscription: function(subscription) | 117 removeSubscription: function(subscription) |
98 { | 118 { |
99 var index = subscriptions.indexOf(subscription.url); | 119 var index = subscriptions.indexOf(subscription.url); |
100 if (index >= 0) | 120 if (index >= 0) |
101 { | 121 { |
102 subscriptions.splice(index, 1); | 122 subscriptions.splice(index, 1); |
103 modules.filterNotifier.FilterNotifier.triggerListeners("subscription.r emoved", subscription); | 123 modules.filterNotifier.FilterNotifier.triggerListeners("subscription.r emoved", subscription); |
104 } | 124 } |
125 }, | |
126 | |
127 addFilter: function(filter) | |
128 { | |
129 var subscription = Subscription.fromURL("~user~786254"); | |
saroyanm
2015/01/26 19:44:06
Subscription is not defined here, this needs to be
Thomas Greiner
2015/01/27 13:01:07
Done.
| |
130 var index = subscription.filters.indexOf(filter); | |
131 if (index < 0) | |
132 { | |
133 subscription.filters.push(filter); | |
134 modules.filterNotifier.FilterNotifier.triggerListeners("filter.added", filter); | |
135 } | |
136 }, | |
137 | |
138 removeFilter: function(filter) | |
139 { | |
140 var subscription = Subscription.fromURL("~user~786254"); | |
saroyanm
2015/01/26 19:44:06
Subscription is not defined here, this needs to be
Thomas Greiner
2015/01/27 13:01:07
Done.
| |
141 var index = subscription.filters.indexOf(filter); | |
142 if (index >= 0) | |
143 { | |
144 subscription.filters.splice(index, 1); | |
145 modules.filterNotifier.FilterNotifier.triggerListeners("filter.removed ", filter); | |
146 } | |
105 } | 147 } |
106 } | 148 } |
107 }; | 149 }; |
108 | 150 |
109 modules.filterClasses = { | 151 modules.filterClasses = { |
110 BlockingFilter: function() {} | 152 BlockingFilter: function() {}, |
153 Filter: function(text) | |
154 { | |
155 this.text = text; | |
156 this.disabled = false; | |
157 } | |
158 }; | |
159 modules.filterClasses.Filter.fromText = function(text) | |
160 { | |
161 return new modules.filterClasses.Filter(text); | |
111 }; | 162 }; |
112 | 163 |
113 modules.synchronizer = { | 164 modules.synchronizer = { |
114 Synchronizer: {} | 165 Synchronizer: {} |
115 }; | 166 }; |
116 | 167 |
117 modules.matcher = { | 168 modules.matcher = { |
118 defaultMatcher: { | 169 defaultMatcher: { |
119 matchesAny: function(url, requestType, docDomain, thirdParty) | 170 matchesAny: function(url, requestType, docDomain, thirdParty) |
120 { | 171 { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 return parseFloat(v1) - parseFloat(v2); | 221 return parseFloat(v1) - parseFloat(v2); |
171 } | 222 } |
172 } | 223 } |
173 }; | 224 }; |
174 | 225 |
175 var issues = {seenDataCorruption: false, filterlistsReinitialized: false}; | 226 var issues = {seenDataCorruption: false, filterlistsReinitialized: false}; |
176 updateFromURL(issues); | 227 updateFromURL(issues); |
177 global.seenDataCorruption = issues.seenDataCorruption; | 228 global.seenDataCorruption = issues.seenDataCorruption; |
178 global.filterlistsReinitialized = issues.filterlistsReinitialized; | 229 global.filterlistsReinitialized = issues.filterlistsReinitialized; |
179 })(this); | 230 })(this); |
OLD | NEW |