1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

switch drag & drop lib

This commit is contained in:
Luke Pulverenti 2015-10-22 11:03:08 -04:00
parent 1f9c509d58
commit f7c130f1b5
105 changed files with 4100 additions and 4165 deletions

View file

@ -82,16 +82,23 @@
listItems.push(elems[i]);
}
Dashboard.loadDragula(function (dragula) {
var listParent = elem.querySelector('.paperList');
dragula([elem.querySelector('.paperList')], {
direction: 'vertical',
revertOnSpill: true
}).on('drop', function (el, target, source, sibling) {
onDrop(el, target, source, sibling, page, item);
if (!AppInfo.isTouchPreferred) {
require(['sortable'], function (Sortable) {
var sortable = new Sortable(listParent, {
draggable: ".listItem",
// dragging ended
onEnd: function (/**Event*/evt) {
onDrop(evt, page, item);
}
});
});
});
}
ImageLoader.lazyChildren(elem);
@ -118,20 +125,11 @@
});
}
function onDrop(el, target, source, sibling, page, item) {
function onDrop(evt, page, item) {
var parent = $(el).parents('.paperList')[0];
var newIndex;
var el = evt.item;
if (sibling) {
newIndex = parseInt(sibling.getAttribute('data-index'));
} else {
// dropped at the end
newIndex = parent.querySelectorAll('paper-icon-item').length;
}
var newIndex = evt.newIndex;
var itemId = el.getAttribute('data-playlistitemid');
@ -173,7 +171,7 @@
function showDragAndDropHelp() {
if ($.browser.mobile) {
if (AppInfo.isTouchPreferred) {
// Not implemented for mobile yet
return;
}

View file

@ -2067,7 +2067,7 @@ var AppInfo = {};
medialibrarycreator: 'components/medialibrarycreator/medialibrarycreator',
medialibraryeditor: 'components/medialibraryeditor/medialibraryeditor',
howler: 'bower_components/howler.js/howler.min',
dragula: 'bower_components/dragula.js/dist/dragula.min'
sortable: 'bower_components/Sortable/Sortable.min'
};
if (Dashboard.isRunningInCordova()) {

View file

@ -285,7 +285,7 @@
html += '<paper-icon-button icon="' + AppInfo.moreIcon + '" class="btnUserMenu"></paper-icon-button>';
html += "</div>";
html += '<div class="cardText" style="margin-right: 30px; padding: 11px 0 10px;">';
html += '<div class="cardText" style="padding-top:10px;padding-bottom:10px;">';
html += user.UserName;
html += "</div>";