-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
29 lines (26 loc) · 944 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
27
28
29
// Initialize Material Design lib
mdc.autoInit();
// Restore options
$(() => {
chrome.storage.sync.get(default_options, options => {
$("#victorops_notification_frequency").val(options.victorops_notification_frequency);
$("#victorops_tab_refresh_frequency").val(options.victorops_tab_refresh_frequency);
});
});
// Save options
$("#save").on("click", () => {
var victoropsNotificationFrequency = $("#victorops_notification_frequency").val();
var victoropsTabRefreshFrequency = $("#victorops_tab_refresh_frequency").val();
chrome.storage.sync.set({
victorops_notification_frequency: victoropsNotificationFrequency,
victorops_tab_refresh_frequency: victoropsTabRefreshFrequency
}, () => {
// Reload matching tab
var status = $("#save-status");
status.text("Options saved.");
setTimeout(() => {
status.text("");
chrome.tabs.reload(default_options.victorops_tab_id);
}, 750);
});
});