1 // Copyright (c) 2015 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 animationPolicyChanged() {
8 var setting = this.value;
9 console.log('set policy '+': '+setting);
10 chrome.accessibilityFeatures.animationPolicy.set(
11 {'value': setting}, function (callback) {});
15 function listener(data) {
16 console.log('animation policy is changed.');
20 var i18nElements = document.querySelectorAll('*[i18n-content]');
21 for (var i = 0; i < i18nElements.length; i++) {
22 var elem = i18nElements[i];
23 var msg = elem.getAttribute('i18n-content');
24 elem.innerHTML = chrome.i18n.getMessage(msg);
27 chrome.accessibilityFeatures.animationPolicy.onChange.addListener(listener);
28 chrome.accessibilityFeatures.animationPolicy.get(
29 {'incognito': false}, function (policy) {
30 console.log('get policy '+': '+policy.value);
31 var selects = document.querySelectorAll('input');
32 for (var i = 0; i < selects.length; i++) {
33 if (selects[i].value == policy.value)
34 selects[i].checked = true;
38 var selects = document.querySelectorAll('input');
39 for (var i = 0; i < selects.length; i++) {
40 selects[i].addEventListener('change', animationPolicyChanged);
44 window.addEventListener('load', init, false);