forked from orbitbot/chrome-extensions-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
25 lines (21 loc) · 786 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function setChildTextNode(elementId, text) {
document.getElementById(elementId).innerText = text;
}
function init() {
setChildTextNode('languageSpan', chrome.i18n.getMessage("click_here"));
}
function getAcceptLanguages() {
chrome.i18n.getAcceptLanguages(function(languageList) {
var languages = languageList.join(",");
setChildTextNode('languageSpan',
chrome.i18n.getMessage("chrome_accept_languages", languages));
})
}
document.addEventListener('DOMContentLoaded', function() {
document.querySelector('#accept_lang').addEventListener(
'click', getAcceptLanguages);
init();
});