-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
31 lines (28 loc) · 1.07 KB
/
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
30
31
/*
Copyright (C) David Bern
See COPYRIGHT.txt for details
*/
$(function(){
$("#https").prop("checked", (localStorage['https'] == 'true'));
$("#autoRead").prop("checked", (localStorage['autoRead'] == 'true'));
$("#lang").val(localStorage['lang']);
$("#checkDelay").val(localStorage['checkDelay']);
$("#options").submit(function() {
var lang = $("#lang").val();
if (lang != localStorage['lang']) {
// change language and reset any previous unread/last_date
localStorage['lang'] = lang;
localStorage.removeItem('unread');
localStorage.removeItem('last_date');
}
localStorage['https'] = $("#https").prop("checked");
localStorage['autoRead'] = $("#autoRead").prop("checked");
var delay = parseInt($("#checkDelay").val());
if (delay != localStorage['checkDelay'] && delay > 0) {
localStorage['checkDelay'] = delay;
console.log("Scheduling request for " + delay + " minutes");
console.log("Creating alarm 'checkNewItems'");
chrome.alarms.create('checkNewItems', {periodInMinutes: delay});
}
});
});