Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: ext/common.js

Issue 29573083: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Created Oct. 10, 2017, 10:24 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « devtools-panel.js ('k') | firstRun.html » ('j') | polyfill.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 "use strict"; 18 "use strict";
19 19
20 (function() 20 (function()
21 { 21 {
22 if (typeof chrome == "undefined")
23 window.chrome = {};
24
25 if (typeof ext == "undefined") 22 if (typeof ext == "undefined")
26 window.ext = {}; 23 window.ext = {};
27 24
28 function Page(source) 25 function Page(source)
29 { 26 {
30 this._source = source; 27 this._source = source;
31 } 28 }
32 Page.prototype = 29 Page.prototype =
33 { 30 {
34 sendMessage(message) 31 sendMessage(message)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return; 151 return;
155 152
156 let rawCatalog = JSON.parse(xhr.responseText); 153 let rawCatalog = JSON.parse(xhr.responseText);
157 for (let msgId in rawCatalog) 154 for (let msgId in rawCatalog)
158 { 155 {
159 if (!(msgId in catalog)) 156 if (!(msgId in catalog))
160 catalog[msgId] = parseMessage(rawCatalog[msgId]); 157 catalog[msgId] = parseMessage(rawCatalog[msgId]);
161 } 158 }
162 }; 159 };
163 160
164 chrome.i18n = { 161 browser.i18n = {
Sebastian Noack 2017/10/10 23:23:08 I think this code should be moved to polyfill.js n
Manish Jethani 2017/10/11 11:29:06 Done.
165 getUILanguage() 162 getUILanguage()
166 { 163 {
167 return locales[0].replace(/_/g, "-"); 164 return locales[0].replace(/_/g, "-");
168 }, 165 },
169 getMessage(msgId, substitutions) 166 getMessage(msgId, substitutions)
170 { 167 {
171 while (true) 168 while (true)
172 { 169 {
173 let message = catalog[msgId]; 170 let message = catalog[msgId];
174 if (message) 171 if (message)
(...skipping 13 matching lines...) Expand all
188 if (locales.length == 0) 185 if (locales.length == 0)
189 return ""; 186 return "";
190 187
191 let locale = locales.shift(); 188 let locale = locales.shift();
192 readCatalog(locale, "common.json"); 189 readCatalog(locale, "common.json");
193 readCatalog(locale, catalogFile); 190 readCatalog(locale, catalogFile);
194 } 191 }
195 } 192 }
196 }; 193 };
197 }()); 194 }());
OLDNEW
« no previous file with comments | « devtools-panel.js ('k') | firstRun.html » ('j') | polyfill.js » ('J')

Powered by Google App Engine
This is Rietveld