forked from GoogleChrome/chrome-extensions-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
26 lines (23 loc) · 914 Bytes
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Restore the option last saved.
window.onload = function() {
chrome.storage.local.get(['tabCaptureMethod'], function(result) {
if (result.tabCaptureMethod == 'streamId') {
document.getElementById('streamId').checked = true;
} else {
document.getElementById('capture').checked = true;
}
});
}
// Save option locally.
function saveOption(){
var value = document.querySelector('input[name="method"]:checked').value;
chrome.storage.local.set({'tabCaptureMethod': value}, function() {
var status = document.getElementById('status');
status.textContent = "Option saved.";
setTimeout(function() {status.textContent = '';}, 750);
});
}
document.getElementById('save').addEventListener('click', saveOption);