OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 { | 42 { |
43 return Services.io.newURI(url); | 43 return Services.io.newURI(url); |
44 }, | 44 }, |
45 | 45 |
46 checkLocalePrefixMatch: function(prefixes) | 46 checkLocalePrefixMatch: function(prefixes) |
47 { | 47 { |
48 if (!prefixes) | 48 if (!prefixes) |
49 return null; | 49 return null; |
50 | 50 |
51 let list = prefixes.split(","); | 51 let list = prefixes.split(","); |
52 for each (let prefix in list) | 52 for (let prefix of list) |
53 if (new RegExp("^" + prefix + "\\b").test(this.appLocale)) | 53 if (new RegExp("^" + prefix + "\\b").test(this.appLocale)) |
54 return prefix; | 54 return prefix; |
55 | 55 |
56 return null; | 56 return null; |
57 }, | 57 }, |
58 | 58 |
59 chooseFilterSubscription: function(subscriptions) | 59 chooseFilterSubscription: function(subscriptions) |
60 { | 60 { |
61 let selectedItem = null; | 61 let selectedItem = null; |
62 let selectedPrefix = null; | 62 let selectedPrefix = null; |
(...skipping 23 matching lines...) Expand all Loading... |
86 // probability 1/N (N being the number of matches). | 86 // probability 1/N (N being the number of matches). |
87 if (Math.random() * matchCount < 1) | 87 if (Math.random() * matchCount < 1) |
88 { | 88 { |
89 selectedItem = subscription; | 89 selectedItem = subscription; |
90 selectedPrefix = prefix; | 90 selectedPrefix = prefix; |
91 } | 91 } |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |
95 return selectedItem; | 95 return selectedItem; |
| 96 }, |
| 97 |
| 98 yield: function() |
| 99 { |
96 } | 100 } |
97 }; | 101 }; |
OLD | NEW |