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

create collections from movies page

This commit is contained in:
Luke Pulverenti 2014-06-03 23:34:36 -04:00
parent d3a7d45969
commit e0996c055a
5 changed files with 270 additions and 71 deletions

View file

@ -49,7 +49,7 @@
$(document).trigger('headercreated');
$('.libraryMenuButton').on('click', showLibraryMenu);
$('.libraryMenuButton').createHoverTouch().on('hovertouch', showLibraryMenu);
}
function getItemHref(item) {
@ -86,10 +86,15 @@
updateLibraryNavLinks($.mobile.activePage);
$(panel).panel('toggle');
$(panel).panel('toggle').off('mouseleave.librarymenu').on('mouseleave.librarymenu', function () {
$(this).panel("close");
});
}
function updateLibraryMenu(panel) {
var userId = Dashboard.getCurrentUserId();
ApiClient.getItems(userId, {
@ -181,9 +186,9 @@
return panel;
}
function setLibraryMenuText(text) {
$('.libraryMenuButtonText').html('<span>' + text + '</span>');
}
@ -197,7 +202,7 @@
showLibraryMenu: showLibraryMenu,
getTopParentId: getTopParentId,
setText: setLibraryMenuText
};
@ -349,4 +354,54 @@
});
})(window, document, jQuery);
})(window, document, jQuery);
$.fn.createHoverTouch = function () {
var preventHover = false;
var timerId;
function startTimer(elem) {
stopTimer();
timerId = setTimeout(function () {
$(elem).trigger('hovertouch');
}, 200);
}
function stopTimer(elem) {
if (timerId) {
clearTimeout(timerId);
timerId = null;
}
}
return $(this).on('mouseenter', function () {
if (preventHover === true) {
return;
}
startTimer(this);
}).on('mouseleave', function () {
stopTimer(this);
}).on('touchstart', function () {
preventHover = true;
}).on('click', function () {
preventHover = true;
if (preventHover) {
$(this).trigger('hovertouch');
}
});
};