mirror of
https://github.com/krateng/maloja.git
synced 2025-05-17 15:26:31 +03:00
Manual scrobbling now also uses new notification system
This commit is contained in:
parent
8023c2d51c
commit
884e95dc58
@ -69,8 +69,9 @@ function scrobble(artists,title) {
|
|||||||
"title":title
|
"title":title
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (title != "" && artists.length > 0) {
|
if (title != "" && artists.length > 0) {
|
||||||
neo.xhttpreq("/apis/mlj_1/newscrobble",data=payload,method="POST",callback=scrobbledone,json=true)
|
neo.xhttpreq("/apis/mlj_1/newscrobble",data=payload,method="POST",callback=notifyCallback,json=true)
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("title").value = "";
|
document.getElementById("title").value = "";
|
||||||
|
@ -38,14 +38,17 @@ function notifyCallback(request) {
|
|||||||
var body = request.response;
|
var body = request.response;
|
||||||
var status = request.status;
|
var status = request.status;
|
||||||
|
|
||||||
|
|
||||||
if (status == 200) {
|
if (status == 200) {
|
||||||
var notification_type = 'info';
|
var notification_type = 'info';
|
||||||
|
var title = "Success!";
|
||||||
|
var msg = "Scrobbled " + body.track.title + " by " + body.track.artists.join(", ");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var notification_type = 'warning';
|
var notification_type = 'warning';
|
||||||
|
var title = "Error: " + body.error.type;
|
||||||
|
var msg = body.error.desc || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
notify("Error: " + body.error.type,body.error.desc || "",notification_type);
|
notify(title,msg,notification_type);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user