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

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

Issue 2400303003: Update UI and catch executeScript errors now shown in Canary (Closed)
Patch Set: Created 4 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
1 // Copyright 2016 Google Inc. All rights reserved. 1 // Copyright 2016 Google Inc. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Disable the whitelist field when it's not relevant.
6 function updateEnabledInputs() {
7 var checkbox = document.getElementById('disableInApplets');
8 document.getElementById('whitelist').disabled = !checkbox.checked;
9 }
10
5 // Initialize the page. 11 // Initialize the page.
6 function init() { 12 function init() {
7 LoadInternationalizedStrings(); 13 LoadInternationalizedStrings();
8 14
9 var blacklist = document.getElementById('blacklist'); 15 var blacklist = document.getElementById('blacklist');
10 var checkbox = document.getElementById('disableInApplets'); 16 var checkbox = document.getElementById('disableInApplets');
11 var whitelist = document.getElementById('whitelist'); 17 var whitelist = document.getElementById('whitelist');
12 18
13 // Configure the textboxes, allowing 200 characters for JSON serialization 19 // Configure the textboxes, allowing 200 characters for JSON serialization
14 // and key length. 20 // and key length.
(...skipping 15 matching lines...) Expand all
30 if (chrome.runtime.lastError) { 36 if (chrome.runtime.lastError) {
31 document.getElementById('error').textContent = 37 document.getElementById('error').textContent =
32 chrome.i18n.getMessage('errorSaving', 38 chrome.i18n.getMessage('errorSaving',
33 chrome.runtime.lastError.message); 39 chrome.runtime.lastError.message);
34 } else { 40 } else {
35 window.close(); 41 window.close();
36 } 42 }
37 }); 43 });
38 }; 44 };
39 45
46 checkbox.onchange = updateEnabledInputs;
47
40 document.getElementById('cancel_button').onclick = function() { 48 document.getElementById('cancel_button').onclick = function() {
41 window.close(); 49 window.close();
42 }; 50 };
43 51
44 document.getElementById('report_page').onclick = function() { 52 document.getElementById('report_page').onclick = function() {
45 reportPage(); 53 reportPage();
46 }; 54 };
47 55
48 // Load saved settings into the form fields. 56 // Load saved settings into the form fields.
49 chrome.storage.sync.get({ 57 chrome.storage.sync.get({
50 blacklist: [], 58 blacklist: [],
51 disableInApplets: true, 59 disableInApplets: true,
52 whitelist: [] 60 whitelist: []
53 }, function(items) { 61 }, function(items) {
54 blacklist.value = items.blacklist.join('\n'); 62 blacklist.value = items.blacklist.join('\n');
55 checkbox.checked = items.disableInApplets; 63 checkbox.checked = items.disableInApplets;
56 whitelist.value = items.whitelist.join('\n'); 64 whitelist.value = items.whitelist.join('\n');
65
66 updateEnabledInputs();
57 }); 67 });
58 } 68 }
59 69
60 window.addEventListener('load', init, false); 70 window.addEventListener('load', init, false);
OLDNEW
« go-back-with-backspace/manifest.json ('K') | « go-back-with-backspace/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698