forked from adampash/Music-Plus-for-Google-Music
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.html
95 lines (85 loc) · 3.61 KB
/
options.html
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<html>
<head><title>Music Plus for Google Music Options</title></head>
<script src='scripts/jquery-1.6.1.min.js'></script>
<script type="text/javascript">
// Saves options to localStorage.
function save_options() {
var select = document.getElementById("color");
var color = select.children[select.selectedIndex].value;
localStorage["favorite_color"] = color;
// Update status to let user know options were saved.
setTimeout(function() {
status.innerHTML = "";
}, 750);
}
// Restores select box state to saved value from localStorage.
function restore_options() {
$('input:checkbox').click(function() {
localStorage[this.id] = this.checked;
console.log('call restore settings');
chrome.tabs.sendRequest(parseInt(localStorage["tabID"]), {'action' : 'restore_settings'}, function(response) {
console.log(response);
// console.log('tab id is set to: ' + localStorage["tabID"]);
});
$("#notification").text("Option saved. You may have to refresh your Google Music tab before the change takes effect.").show();
});
$('input:checkbox').each(function(index) {
if (localStorage[this.id] === undefined && this.id != 'support') {
// console.log('first run, setting to true');
localStorage[this.id] = 'true';
}
if (localStorage[this.id] == 'true') {
this.checked = true;
}
else {
this.checked = false;
}
});
}
</script>
<style>
body {
font-family: 'Proxima Nova',arial,sans-serif;
color:#666;
margin:0;
padding:0;
}
#container {
margin:25px;
}
h1 {
background:#666;
color:white;
font-size:26px;
font-weight:normal;
padding:10px;
}
.item {
height:28px;
}
#notification {
position:absolute;
top:70px;
left:430px;
height:25px;
padding:25px;
width:300px;
background:#FFFEA8;
-webkit-border-radius: 10px;
font-size:13px;
}
</style>
<body onload="restore_options()">
<h1>Music Plus for Google Music Settings</h1>
<div id="container">
<div class="item"><input type="checkbox" name="bios" value="Bios" id="bios"> <label for="bios">Include artist and album bios via Last.fm</label><br /></div>
<div class="item"><input type="checkbox" name="scrobble" value="Scrobble" id="scrobble"> <label for="scrobble">Scrobble tracks to Last.fm</label> by <a href="http://www.danielslaughter.com/projects/google-music-with-lastfm/">Daniel Slaughter</a><br /></div>
<div class="item"><input type="checkbox" name="notifications" value="notifications" id="notifications"> <label for="notifications">Show notifications when tracks change</label><br /></div>
<div class="item"><input type="checkbox" name="shortcuts" value="shortcuts" id="shortcuts"> <label for="shortcuts">Enable global keyboard shortcuts</label> (Ctrl+Shift+P to play/pause, Ctrl+Shift+Left/Right for next/previous track)<br /></div>
<div class="item"><input type="checkbox" name="download" id="download" value="Download"> <label for="download">Insert a download button for currently playing track</label> by <a href="http://userscripts.org/scripts/show/105972">Chris Hendry</a><br /></div>
<div class="item"><input type="checkbox" name="lyrics" id="lyrics" value="Lyrics"> <label for="lyrics">Fetch lyrics for currently playing track</label> by <a href="http://userscripts.org/scripts/show/105238">Chris Hendry</a><br /></div>
<div class="item"><input type="checkbox" name="support" id="support" value="Support"> <label for="support">Support this extension via Amazon (Thanks for enabling this!)</label><br /></div>
</div>
<div id="notification" style="display:none;">This is a notification</div>
</body>
</html>