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

update resource loading

This commit is contained in:
Luke Pulverenti 2016-07-21 17:23:34 -04:00
parent 3838831828
commit 13838f9d76
3 changed files with 17 additions and 64 deletions

View file

@ -117,6 +117,15 @@ define(['apphost'], function (appHost) {
canEditImages: function (user, itemType) { canEditImages: function (user, itemType) {
if (itemType == 'UserView') {
if (user.Policy.IsAdministrator) {
return true;
}
return false;
}
return itemType != 'Timer' && canEdit(user, itemType); return itemType != 'Timer' && canEdit(user, itemType);
}, },

View file

@ -1,59 +0,0 @@
define(['libraryBrowser'], function (libraryBrowser) {
function isClickable(target) {
while (target != null) {
var tagName = target.tagName || '';
if (tagName == 'A' || tagName.indexOf('BUTTON') != -1 || tagName.indexOf('INPUT') != -1) {
return true;
}
return false;
//target = target.parentNode;
}
return false;
}
function onGroupedCardClick(e, card) {
var itemId = card.getAttribute('data-id');
var context = card.getAttribute('data-context');
var userId = Dashboard.getCurrentUserId();
var playedIndicator = card.querySelector('.playedIndicator');
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
var options = {
Limit: parseInt(playedIndicatorHtml || '10'),
Fields: "PrimaryImageAspectRatio,DateCreated",
ParentId: itemId,
GroupItems: false
};
var target = e.target;
if (isClickable(target)) {
return;
}
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
if (items.length == 1) {
Dashboard.navigate(libraryBrowser.getHref(items[0], context));
return;
}
var url = 'itemdetails.html?id=' + itemId;
if (context) {
url += '&context=' + context;
}
Dashboard.navigate(url);
});
e.stopPropagation();
e.preventDefault();
return false;
}
});

View file

@ -1727,6 +1727,12 @@ var AppInfo = {};
return bowerPath; return bowerPath;
} }
function getLayoutManager(layoutManager) {
layoutManager.init();
return layoutManager;
}
function initRequire() { function initRequire() {
var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate()); var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate());
@ -1763,7 +1769,6 @@ var AppInfo = {};
qualityoptions: embyWebComponentsBowerPath + "/qualityoptions", qualityoptions: embyWebComponentsBowerPath + "/qualityoptions",
connectservice: apiClientBowerPath + '/connectservice', connectservice: apiClientBowerPath + '/connectservice',
hammer: bowerPath + "/hammerjs/hammer.min", hammer: bowerPath + "/hammerjs/hammer.min",
layoutManager: embyWebComponentsBowerPath + "/layoutmanager",
pageJs: embyWebComponentsBowerPath + '/page.js/page', pageJs: embyWebComponentsBowerPath + '/page.js/page',
focusManager: embyWebComponentsBowerPath + "/focusmanager", focusManager: embyWebComponentsBowerPath + "/focusmanager",
datetime: embyWebComponentsBowerPath + "/datetime", datetime: embyWebComponentsBowerPath + "/datetime",
@ -1823,6 +1828,7 @@ var AppInfo = {};
define("mediaInfo", [embyWebComponentsBowerPath + "/mediainfo/mediainfo"], returnFirstDependency); define("mediaInfo", [embyWebComponentsBowerPath + "/mediainfo/mediainfo"], returnFirstDependency);
define("itemContextMenu", [embyWebComponentsBowerPath + "/itemcontextmenu"], returnFirstDependency); define("itemContextMenu", [embyWebComponentsBowerPath + "/itemcontextmenu"], returnFirstDependency);
define("dom", [embyWebComponentsBowerPath + "/dom"], returnFirstDependency); define("dom", [embyWebComponentsBowerPath + "/dom"], returnFirstDependency);
define("layoutManager", [embyWebComponentsBowerPath + "/layoutmanager"], getLayoutManager);
define("playMenu", [embyWebComponentsBowerPath + "/playmenu"], returnFirstDependency); define("playMenu", [embyWebComponentsBowerPath + "/playmenu"], returnFirstDependency);
define("refreshDialog", [embyWebComponentsBowerPath + "/refreshdialog/refreshdialog"], returnFirstDependency); define("refreshDialog", [embyWebComponentsBowerPath + "/refreshdialog/refreshdialog"], returnFirstDependency);
define("backdrop", [embyWebComponentsBowerPath + "/backdrop/backdrop"], returnFirstDependency); define("backdrop", [embyWebComponentsBowerPath + "/backdrop/backdrop"], returnFirstDependency);
@ -3153,7 +3159,6 @@ var AppInfo = {};
deps.push('imageLoader'); deps.push('imageLoader');
deps.push('embyRouter'); deps.push('embyRouter');
deps.push('layoutManager');
if (!(AppInfo.isNativeApp && browserInfo.android)) { if (!(AppInfo.isNativeApp && browserInfo.android)) {
document.documentElement.classList.add('minimumSizeTabs'); document.documentElement.classList.add('minimumSizeTabs');
@ -3187,14 +3192,12 @@ var AppInfo = {};
console.log('onAppReady - loading dependencies'); console.log('onAppReady - loading dependencies');
require(deps, function (imageLoader, pageObjects, layoutManager) { require(deps, function (imageLoader, pageObjects) {
console.log('Loaded dependencies in onAppReady'); console.log('Loaded dependencies in onAppReady');
window.ImageLoader = imageLoader; window.ImageLoader = imageLoader;
layoutManager.init();
window.Emby = {}; window.Emby = {};
window.Emby.Page = pageObjects; window.Emby.Page = pageObjects;
window.Emby.TransparencyLevel = pageObjects.TransparencyLevel; window.Emby.TransparencyLevel = pageObjects.TransparencyLevel;