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

add dlna pause fix

This commit is contained in:
Luke Pulverenti 2014-03-15 16:08:06 -04:00
parent a5f1fa7681
commit e3e1ab2db3
6 changed files with 280 additions and 11 deletions

View file

@ -0,0 +1,116 @@
(function () {
function onDocumentMouseDown(e) {
var $e = $(e.target);
var isContextMenuOption = $e.is('.contextMenuOption');
if (!isContextMenuOption || $e.is('.contextMenuCommandOption')) {
if ($e.is('.itemContextMenu') || $e.parents('.itemContextMenu').length) {
return;
}
}
if (isContextMenuOption) {
setTimeout(closeContextMenus, 150);
} else {
closeContextMenus();
}
}
function closeContextMenus() {
$('.itemContextMenu').hide().remove();
$('.hasContextMenu').removeClass('hasContextMenu');
}
function getMenuOptionHtml(item) {
var html = '';
if (item.type == 'divider') {
html += '<p class="contextMenuDivider"></p>';
}
if (item.type == 'header') {
html += '<p class="contextMenuHeader">' + item.text + '</p>';
}
if (item.type == 'link') {
html += '<a class="contextMenuOption" href="' + item.url + '">' + item.text + '</a>';
}
if (item.type == 'command') {
html += '<a class="contextMenuOption contextMenuCommandOption" data-command="' + item.name + '" href="#">' + item.text + '</a>';
}
return html;
}
function getMenu(items) {
var html = '';
html += '<div class="itemContextMenu">';
html += '<div class="contextMenuInner">' + items.map(getMenuOptionHtml).join('') + '</div>';
html += '</div>';
return $(html).appendTo(document.body);
}
$.fn.createContextMenu = function (options) {
return this.on('contextmenu', options.selector, function (e) {
var elem = this;
var items = options.getOptions(elem);
if (!items.length) {
return;
}
var menu = getMenu(items);
var autoH = menu.height() + 12;
if ((e.pageY + autoH) > $('html').height()) {
menu.addClass('dropdown-context-up').css({
top: e.pageY - 20 - autoH,
left: e.pageX - 13
}).fadeIn();
} else {
menu.css({
top: e.pageY + 10,
left: e.pageX - 13
}).fadeIn();
}
$(this).addClass('hasContextMenu');
$(document).off('mousedown.closecontextmenu').on('mousedown.closecontextmenu', onDocumentMouseDown);
menu.on('click', '.contextMenuCommandOption', function() {
closeContextMenus();
options.command(this.getAttribute('data-command'), elem);
return false;
});
return false;
});
};
})();

View file

@ -662,7 +662,7 @@
cssClass += ' ' + options.shape + 'PosterItem';
html += '<a data-itemid="' + item.Id + '" class="' + cssClass + '" href="' + LibraryBrowser.getHref(item, options.context) + '">';
html += '<a data-itemid="' + item.Id + '" class="' + cssClass + '" data-locationtype="' + item.LocationType + '" data-mediatype="' + (item.MediaType || '') + '" href="' + LibraryBrowser.getHref(item, options.context) + '">';
// Ribbon
if (item.MediaType == "Video" && item.Video3DFormat) {
@ -680,7 +680,7 @@
format = "3D";
ribbonColor = "ribbon-3d";
}
html += '<div class="ribbon-wrapper">';
html += '<div class="ribbon ' + ribbonColor + '">';
html += format;
@ -2100,10 +2100,42 @@
return false;
}
function onMenuCommand(command, elem) {
var id = elem.getAttribute('data-itemid');
}
function getMenuOptions(elem) {
var items = [];
var id = elem.getAttribute('data-itemid');
var mediatype = elem.getAttribute('data-mediatype');
items.push({ type: 'header', text: 'Edit' });
items.push({ type: 'link', text: 'Details', url: 'edititemmetadata.html?id=' + id });
items.push({ type: 'link', text: 'Images', url: 'edititemimages.html?id=' + id });
if (mediatype == 'Video' && elem.getAttribute('data-locationtype') == 'FileSystem') {
items.push({ type: 'divider' });
items.push({ type: 'header', text: 'Manage' });
items.push({ type: 'command', text: 'Alternate Editions', name: 'AlternateEditions' });
}
return items;
}
$.fn.createPosterItemHoverMenu = function () {
function onShowTimerExpired(elem) {
if ($(elem).hasClass('hasContextMenu')) {
return;
}
var innerElem = $('.posterItemOverlayTarget', elem);
var id = elem.getAttribute('data-itemid');
@ -2152,7 +2184,23 @@
return this;
}
return this.on('mouseenter', '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem', onHoverIn).on('mouseleave', '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem', onHoverOut);
var sequence = this;
Dashboard.getCurrentUser().done(function (user) {
if (user.Configuration.IsAdministrator) {
sequence.createContextMenu({
getOptions: getMenuOptions,
command: onMenuCommand,
selector: '.posterItem'
});
}
});
return this.on('mouseenter', '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem', onHoverIn)
.on('mouseleave', '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem', onHoverOut);
};
})(jQuery, document, window);

View file

@ -96,7 +96,7 @@ var Dashboard = {
var userId;
if (autoLoginUserId && autoLoginUserId != storedUserId) {
localStorage.setItem("userId", autoLoginUserId);
ApiClient.currentUserId(autoLoginUserId);
}