forked from web-scrobbler/web-scrobbler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
41 lines (31 loc) · 1.49 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
32
33
34
35
36
37
38
39
40
41
// options ---------------------------------------------------------------------
$(function(){
// use immediate-change checkboxes
$('#use-notifications').click(function(){
localStorage['useNotifications'] = this.checked ? 1 : 0;
updateDisabled();
});
$('#use-notifications-nowplaying').click(function(){
localStorage['useNotificationsNowPlaying'] = this.checked ? 1 : 0;
});
$('#use-notifications-scrobbled').click(function(){
localStorage['useNotificationsScrobbled'] = this.checked ? 1 : 0;
});
$('#use-autocorrect').click(function(){
localStorage['useAutocorrect'] = this.checked ? 1 : 0;
});
$('#use-youtube-inpage').click(function(){
localStorage['useYTInpage'] = this.checked ? 1 : 0;
});
// preload options
$('#use-notifications').attr('checked', (localStorage['useNotifications'] == 1));
$('#use-notifications-nowplaying').attr('checked', (localStorage['useNotificationsNowPlaying'] == 1));
$('#use-notifications-scrobbled').attr('checked', (localStorage['useNotificationsScrobbled'] == 1));
$('#use-autocorrect').attr('checked', (localStorage['useAutocorrect'] == 1));
$('#use-youtube-inpage').attr('checked', (localStorage['useYTInpage'] == 1));
// disable subitems
function updateDisabled() {
$('#use-notifications-nowplaying').attr('disabled', (!$('#use-notifications').is(':checked')));
$('#use-notifications-scrobbled').attr('disabled', (!$('#use-notifications').is(':checked')));
}
});