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 // Saves options to chrome.storage
6 function save_options() {
7 var border
= document
.getElementById('border').checked
;
8 chrome
.storage
.sync
.set({
11 // Update status to let user know options were saved.
12 var status
= document
.getElementById('status');
13 status
.textContent
= 'Options saved.';
14 setTimeout(function() {
15 status
.textContent
= '';
20 // Restores select box and checkbox state using the preferences
21 // stored in chrome.storage.
22 function restore_options() {
23 // Use default value addBOrder = false.
24 chrome
.storage
.sync
.get("addBorder", function(item
) {
25 document
.getElementById('border').checked
= item
.addBorder
;
29 document
.addEventListener('DOMContentLoaded', restore_options
);
30 document
.getElementById('border').addEventListener('click', save_options
);
32 document
.title
= chrome
.i18n
.getMessage('longdesc_options');
33 var i18nElements
= document
.querySelectorAll('*[i18n-content]');
34 for (var i
= 0; i
< i18nElements
.length
; i
++) {
35 var elem
= i18nElements
[i
];
36 var msg
= elem
.getAttribute('i18n-content');
37 elem
.innerHTML
= chrome
.i18n
.getMessage(msg
);