Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: ui/accessibility/extensions/caretbrowsing/options.js

Issue 593293002: Initial checkin of accessibility extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix license issues Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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. */
4
5 function setRadio(name, defaultValue) {
6 chrome.storage.sync.get(name, function(result) {
7 var value = result[name];
8 if (value === undefined) {
9 value = defaultValue;
10 var obj = {};
11 obj[name] = value;
12 chrome.storage.sync.set(obj);
13 }
14 var controls = document.querySelectorAll(
15 'input[type="radio"][name="' + name + '"]');
16 for (var i = 0; i < controls.length; i++) {
17 var c = controls[i];
18 if (c.value == value) {
19 c.checked = true;
20 }
21 c.addEventListener('change', function(evt) {
22 if (evt.target.checked) {
23 var obj = {};
24 obj[evt.target.name] = evt.target.value;
25 chrome.storage.sync.set(obj);
26 }
27 }, false);
28 }
29 });
30 }
31
32 function load() {
33 var isMac = (navigator.appVersion.indexOf("Mac") != -1);
34 if (isMac) {
35 document.body.classList.add('mac');
36 } else {
37 document.body.classList.add('nonmac');
38 }
39
40 var isCros = (navigator.appVersion.indexOf("CrOS") != -1);
41 if (isCros) {
42 document.body.classList.add('cros');
43 } else {
44 document.body.classList.add('noncros');
45 }
46
47 setRadio('onenable', 'anim');
48 setRadio('onjump', 'flash');
49
50 var heading = document.querySelector('h1');
51 var sel = window.getSelection();
52 sel.setBaseAndExtent(heading, 0, heading, 0);
53
54 document.title = chrome.i18n.getMessage('caretBrowsingOptions');
55 var i18nElements = document.querySelectorAll('*[i18n-content]');
56 for (var i = 0; i < i18nElements.length; i++) {
57 var elem = i18nElements[i];
58 var msg = elem.getAttribute('i18n-content');
59 elem.innerHTML = chrome.i18n.getMessage(msg);
60 }
61 }
62
63 window.addEventListener('load', load, false);
OLDNEW
« no previous file with comments | « ui/accessibility/extensions/caretbrowsing/options.html ('k') | ui/accessibility/extensions/caretbrowsing/traverse_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698