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

Side by Side Diff: i18n.js

Issue 29573083: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Rebase Created Oct. 16, 2017, 9:33 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
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
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 currentElement.appendChild(e); 51 currentElement.appendChild(e);
52 52
53 processString(match[4], currentElement); 53 processString(match[4], currentElement);
54 } 54 }
55 else 55 else
56 currentElement.appendChild(document.createTextNode(str)); 56 currentElement.appendChild(document.createTextNode(str));
57 } 57 }
58 58
59 while (element.lastChild) 59 while (element.lastChild)
60 element.removeChild(element.lastChild); 60 element.removeChild(element.lastChild);
61 processString(chrome.i18n.getMessage(stringName, args), element); 61 processString(browser.i18n.getMessage(stringName, args), element);
62 } 62 }
63 }; 63 };
64 64
65 // Loads i18n strings 65 // Loads i18n strings
66 function loadI18nStrings() 66 function loadI18nStrings()
67 { 67 {
68 function addI18nStringsToElements(containerElement) 68 function addI18nStringsToElements(containerElement)
69 { 69 {
70 let elements = containerElement.querySelectorAll("[class^='i18n_']"); 70 let elements = containerElement.querySelectorAll("[class^='i18n_']");
71 for (let node of elements) 71 for (let node of elements)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
OLDNEW

Powered by Google App Engine
This is Rietveld