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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return; | 154 return; |
155 | 155 |
156 let rawCatalog = JSON.parse(xhr.responseText); | 156 let rawCatalog = JSON.parse(xhr.responseText); |
157 for (let msgId in rawCatalog) | 157 for (let msgId in rawCatalog) |
158 { | 158 { |
159 if (!(msgId in catalog)) | 159 if (!(msgId in catalog)) |
160 catalog[msgId] = parseMessage(rawCatalog[msgId]); | 160 catalog[msgId] = parseMessage(rawCatalog[msgId]); |
161 } | 161 } |
162 }; | 162 }; |
163 | 163 |
| 164 /* Polyfills */ |
| 165 |
| 166 if (/\/devtools-panel\.html\b/.test(top.location.href)) |
| 167 { |
| 168 chrome.devtools = { |
| 169 panels: { |
| 170 openResource() {} |
| 171 }, |
| 172 |
| 173 inspectedWindow: { |
| 174 reload() {} |
| 175 } |
| 176 }; |
| 177 } |
| 178 |
164 chrome.i18n = { | 179 chrome.i18n = { |
165 getUILanguage() | 180 getUILanguage() |
166 { | 181 { |
167 return locales[0].replace(/_/g, "-"); | 182 return locales[0].replace(/_/g, "-"); |
168 }, | 183 }, |
169 getMessage(msgId, substitutions) | 184 getMessage(msgId, substitutions) |
170 { | 185 { |
171 while (true) | 186 while (true) |
172 { | 187 { |
173 let message = catalog[msgId]; | 188 let message = catalog[msgId]; |
(...skipping 14 matching lines...) Expand all Loading... |
188 if (locales.length == 0) | 203 if (locales.length == 0) |
189 return ""; | 204 return ""; |
190 | 205 |
191 let locale = locales.shift(); | 206 let locale = locales.shift(); |
192 readCatalog(locale, "common.json"); | 207 readCatalog(locale, "common.json"); |
193 readCatalog(locale, catalogFile); | 208 readCatalog(locale, catalogFile); |
194 } | 209 } |
195 } | 210 } |
196 }; | 211 }; |
197 }()); | 212 }()); |
OLD | NEW |