LEFT | RIGHT |
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 // Getting UI locale cannot be done synchronously on Firefox, | 20 // Getting UI locale cannot be done synchronously on Firefox, |
21 // requires messaging the background page. For Chrome and Safari, | 21 // requires messaging the background page. For Chrome and Safari, |
22 // we could get the UI locale here, but would need to duplicate | 22 // we could get the UI locale here, but would need to duplicate |
23 // the logic implemented in Utils.appLocale. | 23 // the logic implemented in Utils.appLocale. |
24 ext.backgroundPage.sendMessage( | 24 browser.runtime.sendMessage( |
25 { | 25 { |
26 type: "app.get", | 26 type: "app.get", |
27 what: "localeInfo" | 27 what: "localeInfo" |
28 }, | 28 }, |
29 (localeInfo) => | 29 (localeInfo) => |
30 { | 30 { |
31 document.documentElement.lang = localeInfo.locale; | 31 document.documentElement.lang = localeInfo.locale; |
32 document.documentElement.dir = localeInfo.bidiDir; | 32 document.documentElement.dir = localeInfo.bidiDir; |
33 } | 33 } |
34 ); | 34 ); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 dateParts = dateParts.map( | 112 dateParts = dateParts.map( |
113 (datePart) => datePart < 10 ? "0" + datePart : datePart | 113 (datePart) => datePart < 10 ? "0" + datePart : datePart |
114 ); | 114 ); |
115 | 115 |
116 return [dateParts.splice(0, 3).join("-"), dateParts.join(":")]; | 116 return [dateParts.splice(0, 3).join("-"), dateParts.join(":")]; |
117 } | 117 } |
118 | 118 |
119 // Fill in the strings as soon as possible | 119 // Fill in the strings as soon as possible |
120 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); | 120 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); |
LEFT | RIGHT |