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-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 */ | |
Manish Jethani
2017/10/11 22:46:00
The code in this section will eventually move to p
| |
165 | |
166 if (/\/devtools-panel\.html\b/.test(top.location.href)) | |
Manish Jethani
2017/10/11 22:46:00
chrome.devtools is not available outside the devto
| |
167 { | |
168 chrome.devtools = { | |
169 panels: { | |
170 openResource() {} | |
171 }, | |
172 | |
173 inspectedWindow: { | |
174 reload() {} | |
175 }, | |
176 | |
177 onCreated: { | |
178 addListener(listener) | |
179 { | |
180 window.addEventListener("message", (event) => | |
181 { | |
182 if (event.data.type == "devtools") | |
183 listener(new ext.Page(event.source)); | |
184 }); | |
185 } | |
186 } | |
187 }; | |
188 } | |
189 | |
164 chrome.i18n = { | 190 chrome.i18n = { |
165 getUILanguage() | 191 getUILanguage() |
166 { | 192 { |
167 return locales[0].replace(/_/g, "-"); | 193 return locales[0].replace(/_/g, "-"); |
168 }, | 194 }, |
169 getMessage(msgId, substitutions) | 195 getMessage(msgId, substitutions) |
170 { | 196 { |
171 while (true) | 197 while (true) |
172 { | 198 { |
173 let message = catalog[msgId]; | 199 let message = catalog[msgId]; |
(...skipping 14 matching lines...) Expand all Loading... | |
188 if (locales.length == 0) | 214 if (locales.length == 0) |
189 return ""; | 215 return ""; |
190 | 216 |
191 let locale = locales.shift(); | 217 let locale = locales.shift(); |
192 readCatalog(locale, "common.json"); | 218 readCatalog(locale, "common.json"); |
193 readCatalog(locale, catalogFile); | 219 readCatalog(locale, catalogFile); |
194 } | 220 } |
195 } | 221 } |
196 }; | 222 }; |
197 }()); | 223 }()); |
OLD | NEW |