1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-26 06:47:17 +00:00

fixed osx scanf behaviour, notifications

This commit is contained in:
Andrew Karpow 2014-03-08 12:23:21 +01:00
parent b9a4d83130
commit 35ab38d0e2
2 changed files with 24 additions and 5 deletions

View File

@ -155,7 +155,7 @@ function webSocketConnect() {
"</td><td></td></tr>");
}
if(obj.data[obj.data.length-1].id >= pagination + MAX_ELEMENTS_PER_PAGE)
if(obj.data[obj.data.length-1].pos + 1 >= pagination + MAX_ELEMENTS_PER_PAGE)
$('#next').removeClass('hide');
if(pagination > 0)
$('#prev').removeClass('hide');
@ -358,7 +358,7 @@ function webSocketConnect() {
}
if ($.cookie("notification") === "true")
songNotify(obj.data.title, obj.data.artist + " " + obj.data.album );
songNotify(obj.data.title, obj.data.artist, obj.data.album );
else
$('.top-right').notify({
message:{html: notification},
@ -573,8 +573,27 @@ function notificationsSupported() {
return "webkitNotifications" in window;
}
function songNotify(artist, title) {
var notification = window.webkitNotifications.createNotification("assets/favicon.ico", artist, title);
function songNotify(title, artist, album) {
/*var opt = {
type: "list",
title: title,
message: title,
items: []
}
if(artist.length > 0)
opt.items.push({title: "Artist", message: artist});
if(album.length > 0)
opt.items.push({title: "Album", message: album});
*/
//chrome.notifications.create(id, options, creationCallback);
var textNotification = "";
if(artist.length > 0)
textNotification += " " + artist;
if(album.length > 0)
textNotification += "\n " + album;
var notification = window.webkitNotifications.createNotification("assets/favicon.ico", textNotification, title);
notification.show();
setTimeout(function(notification) {
notification.cancel();

View File

@ -46,7 +46,7 @@ int callback_mpd(struct mg_connection *c)
size_t n = 0;
unsigned int uint_buf, uint_buf_2;
int int_buf;
char *p_charbuf;
char *p_charbuf = NULL;
if(cmd_id == -1)
return MG_CLIENT_CONTINUE;