mirror of
https://github.com/SuperBFG7/ympd
synced 2024-12-28 11:50:26 +00:00
commit
03d02e815c
@ -324,6 +324,7 @@
|
||||
<script src="js/bootstrap-notify.js"></script>
|
||||
<script src="js/bootstrap-slider.js"></script>
|
||||
<script src="js/sammy.js"></script>
|
||||
<script src="js/jquery-ui-sortable.min.js"></script>
|
||||
<script src="js/mpd.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
5
htdocs/js/jquery-ui-sortable.min.js
vendored
Normal file
5
htdocs/js/jquery-ui-sortable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -223,7 +223,7 @@ function webSocketConnect() {
|
||||
"</td><td></td></tr>");
|
||||
}
|
||||
|
||||
if(obj.data[obj.data.length-1].pos + 1 >= pagination + MAX_ELEMENTS_PER_PAGE)
|
||||
if(obj.data.length && obj.data[obj.data.length-1].pos + 1 >= pagination + MAX_ELEMENTS_PER_PAGE)
|
||||
$('#next').removeClass('hide');
|
||||
if(pagination > 0)
|
||||
$('#prev').removeClass('hide');
|
||||
@ -246,6 +246,22 @@ function webSocketConnect() {
|
||||
$(this).children().last().find("a").stop().remove();
|
||||
}
|
||||
});
|
||||
//Helper function to keep table row from collapsing when being sorted
|
||||
var fixHelperModified = function(e, tr) {
|
||||
var $originals = tr.children();
|
||||
var $helper = tr.clone();
|
||||
$helper.children().each(function(index)
|
||||
{
|
||||
$(this).width($originals.eq(index).width())
|
||||
});
|
||||
return $helper;
|
||||
};
|
||||
|
||||
//Make queue table sortable
|
||||
$("#salamisandwich > tbody").sortable({
|
||||
helper: fixHelperModified,
|
||||
stop: function(event,ui) {renumber_table('#salamisandwich',ui.item)}
|
||||
}).disableSelection();
|
||||
break;
|
||||
case "search":
|
||||
$('#wait').modal('hide');
|
||||
@ -257,6 +273,9 @@ function webSocketConnect() {
|
||||
* some browsers, such as Safari, from changing the normalization form of the
|
||||
* URI from NFD to NFC, breaking our link with MPD.
|
||||
*/
|
||||
if ($('#salamisandwich > tbody').is(':ui-sortable')) {
|
||||
$('#salamisandwich > tbody').sortable('destroy');
|
||||
}
|
||||
for (var item in obj.data) {
|
||||
switch(obj.data[item].type) {
|
||||
case "directory":
|
||||
@ -574,6 +593,16 @@ function clickPlay() {
|
||||
socket.send('MPD_API_SET_PAUSE');
|
||||
}
|
||||
|
||||
function renumber_table(tableID,item) {
|
||||
was = item.children("td").first().text();//Check if first item exists!
|
||||
is = item.index() + 1;//maybe add pagination
|
||||
|
||||
if (was != is) {
|
||||
socket.send("MPD_API_MOVE_TRACK," + was + "," + is);
|
||||
socket.send('MPD_API_GET_QUEUE,'+pagination);
|
||||
}
|
||||
}
|
||||
|
||||
function basename(path) {
|
||||
return path.split('/').reverse()[0];
|
||||
}
|
||||
|
@ -85,6 +85,14 @@ int callback_mpd(struct mg_connection *c)
|
||||
if(sscanf(c->content, "MPD_API_RM_TRACK,%u", &uint_buf))
|
||||
mpd_run_delete_id(mpd.conn, uint_buf);
|
||||
break;
|
||||
case MPD_API_MOVE_TRACK:
|
||||
if (sscanf(c->content, "MPD_API_MOVE_TRACK,%u,%u", &uint_buf, &uint_buf_2) == 2)
|
||||
{
|
||||
uint_buf -= 1;
|
||||
uint_buf_2 -= 1;
|
||||
mpd_run_move(mpd.conn, uint_buf, uint_buf_2);
|
||||
}
|
||||
break;
|
||||
case MPD_API_PLAY_TRACK:
|
||||
if(sscanf(c->content, "MPD_API_PLAY_TRACK,%u", &uint_buf))
|
||||
mpd_run_play_id(mpd.conn, uint_buf);
|
||||
|
@ -47,6 +47,7 @@
|
||||
X(MPD_API_SAVE_QUEUE) \
|
||||
X(MPD_API_RM_TRACK) \
|
||||
X(MPD_API_RM_ALL) \
|
||||
X(MPD_API_MOVE_TRACK) \
|
||||
X(MPD_API_SEARCH) \
|
||||
X(MPD_API_SET_VOLUME) \
|
||||
X(MPD_API_SET_PAUSE) \
|
||||
|
Loading…
Reference in New Issue
Block a user