1 /* Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. */
5 function setRadio(name, defaultValue) {
6 chrome.storage.sync.get(name, function(result) {
7 var value = result[name];
8 if (value === undefined) {
12 chrome.storage.sync.set(obj);
14 var controls = document.querySelectorAll(
15 'input[type="radio"][name="' + name + '"]');
16 for (var i = 0; i < controls.length; i++) {
18 if (c.value == value) {
21 c.addEventListener('change', function(evt) {
22 if (evt.target.checked) {
24 obj[evt.target.name] = evt.target.value;
25 chrome.storage.sync.set(obj);
33 var isMac = (navigator.appVersion.indexOf("Mac") != -1);
35 document.body.classList.add('mac');
37 document.body.classList.add('nonmac');
40 var isCros = (navigator.appVersion.indexOf("CrOS") != -1);
42 document.body.classList.add('cros');
44 document.body.classList.add('noncros');
47 setRadio('onenable', 'anim');
48 setRadio('onjump', 'flash');
50 var heading = document.querySelector('h1');
51 var sel = window.getSelection();
52 sel.setBaseAndExtent(heading, 0, heading, 0);
55 chrome.i18n.getMessage('caret_browsing_caretBrowsingOptions');
56 var i18nElements = document.querySelectorAll('*[i18n-content]');
57 for (var i = 0; i < i18nElements.length; i++) {
58 var elem = i18nElements[i];
59 var msg = elem.getAttribute('i18n-content');
60 elem.innerHTML = chrome.i18n.getMessage(msg);
64 window.addEventListener('load', load, false);