-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.js
More file actions
29 lines (23 loc) · 857 Bytes
/
options.js
File metadata and controls
29 lines (23 loc) · 857 Bytes
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
function saveOptions() {
localStorage.username = document.getElementById("username").value;
localStorage.password = MD5(document.getElementById("password").value);
chrome.extension.sendRequest({type: "newSession"});
//Update status box in options page to let user know their username and pass has been taken.
updateStatus("Will now scrobble using "+localStorage.username+".");
return false;
}
function deleteOptions() {
localStorage.clear();
chrome.extension.sendRequest({type: "newSession"});
updateStatus("Account deleted.");
}
function updateStatus(msg) {
// Updates the status box
document.getElementById("status").style.display="block";
document.getElementById("status").innerHTML=msg;
}
function getCurrentUser() {
if (localStorage.username != null) {
updateStatus('Using '+localStorage.username+' to scrobble.')
}
}