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

Side by Side Diff: go-back-with-backspace/pages/options.js

Issue 2325963003: Add options and a browser-action popup. (Closed) Base URL: https://chromium.googlesource.com/chromium/extensions-by-google.git@master
Patch Set: Response to comments Created 4 years, 3 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
« no previous file with comments | « go-back-with-backspace/pages/options.html ('k') | go-back-with-backspace/pages/popup.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 Google Inc. 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 // Initialize the page.
6 function init() {
7 LoadInternationalizedStrings();
8
9 var blacklist = document.getElementById('blacklist');
10 var checkbox = document.getElementById('disableInApplets');
11 var whitelist = document.getElementById('whitelist');
12
13 // Configure the textboxes, allowing 200 characters for JSON serialization
14 // and key length.
15 blacklist.maxlength = chrome.storage.sync.QUOTA_BYTES_PER_ITEM - 200;
16 whitelist.maxlength = chrome.storage.sync.QUOTA_BYTES_PER_ITEM - 200;
17
18 // Set event handlers.
19 document.getElementById('done_button').onclick = function() {
20 chrome.storage.sync.set({
21 // Split the lists into arrays at whitespace before saving.
22 blacklist:
23 document.getElementById('blacklist').value.split(/\s+/),
24 disableInApplets: document.getElementById('disableInApplets').checked,
25 whitelist:
26 document.getElementById('whitelist').value.split(/\s+/)
27 }, function() {
28 // One easy way to force an error for testing is to change "sync" to
29 // "managed" in the chrome.storage.sync.set() call above.
30 if (chrome.runtime.lastError) {
31 document.getElementById('error').textContent =
32 chrome.i18n.getMessage('errorSaving',
33 chrome.runtime.lastError.message);
34 } else {
35 window.close();
36 }
37 });
38 };
39
40 document.getElementById('cancel_button').onclick = function() {
41 window.close();
42 };
43
44 document.getElementById('report_page').onclick = function() {
45 reportPage();
46 };
47
48 // Load saved settings into the form fields.
49 chrome.storage.sync.get({
50 blacklist: [],
51 disableInApplets: true,
52 whitelist: []
53 }, function(items) {
54 blacklist.value = items.blacklist.join('\n');
55 checkbox.checked = items.disableInApplets;
56 whitelist.value = items.whitelist.join('\n');
57 });
58 }
59
60 window.addEventListener('load', init, false);
OLDNEW
« no previous file with comments | « go-back-with-backspace/pages/options.html ('k') | go-back-with-backspace/pages/popup.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698