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

fix image loading

This commit is contained in:
Luke Pulverenti 2015-06-16 00:52:01 -04:00
parent 46776f1eac
commit 0d59297b1b
86 changed files with 5857 additions and 273 deletions

View file

@ -197,7 +197,7 @@
}
}
$(document).on('pagebeforeshowready', ".page", function () {
$(document).on('pageshowready', ".page", function () {
var page = this;
@ -212,7 +212,10 @@
var parentId = $page.hasClass('globalBackdropPage') ? '' : LibraryMenu.getTopParentId();
showBackdrop(type, parentId);
// This is an artificial timeout, but we want to give priority to the regular data requests for the page
setTimeout(function () {
showBackdrop(type, parentId);
}, 100);
} else {
$page.removeClass('backdropPage');

View file

@ -193,6 +193,7 @@
}
function supportInAppSignup() {
return false;
return AppInfo.isNativeApp;
return AppInfo.isNativeApp || getWindowUrl().toLowerCase().indexOf('https') == 0;
}
@ -232,6 +233,20 @@
}
});
$('.btnCancelSignup', page).on('click', function () {
history.back();
});
$('.btnCancelManualServer', page).on('click', function () {
history.back();
});
$('.btnWelcomeNext', page).on('click', function () {
Dashboard.navigate('connectlogin.html?mode=connect');
});
}).on('pagebeforeshowready', "#connectLoginPage", function () {
var page = this;
@ -253,7 +268,6 @@
}).on('pageshowready', "#connectLoginPage", function () {
var page = this;
loadPage(page);
});
@ -273,7 +287,6 @@
handleConnectionResult(page, result);
}).fail(function () {
handleConnectionResult(page, {
State: MediaBrowser.ConnectionState.Unavailable
});

View file

@ -590,4 +590,13 @@ function ticks_to_human(str) {
};
});
})();
})();
// This only exists because the polymer elements get distorted when using regular jquery show/hide
$.fn.visible = function(visible) {
if (visible) {
return this.removeClass('hide');
}
return this.addClass('hide');
};

View file

@ -23,10 +23,7 @@
var latestMediElem = $('.section0', page);
Sections.loadRecentlyAdded(latestMediElem, user, context).done(function () {
$('h1', latestMediElem).addClass('firstListHeader');
});
Sections.loadRecentlyAdded(latestMediElem, user, context);
Sections.loadLatestLiveTvRecordings($(".section1", page), userId);
Sections.loadLatestChannelItems($(".section2", page), userId);
}

View file

@ -992,10 +992,17 @@
getPostersPerRow: function (screenWidth) {
var cache = true;
function getValue(shape) {
var div = $('<div class="card ' + shape + 'Card"><div class="cardBox"><div class="cardImage"></div></div></div>').appendTo(document.body);
var width = screenWidth / $('.cardImage', div).innerWidth();
var innerWidth = $('.cardImage', div).innerWidth();
if (!innerWidth || isNaN(innerWidth)) {
cache = false;
innerWidth = Math.min(400, screenWidth / 2);
}
var width = screenWidth / innerWidth;
div.remove();
return Math.floor(width);
}
@ -1006,6 +1013,7 @@
var currentShape = LibraryBrowser.shapes[i];
info[currentShape] = getValue(currentShape);
}
info.cache = cache;
return info;
},
@ -1025,8 +1033,11 @@
}
var result = LibraryBrowser.getPosterViewInfoInternal(screenWidth);
result.screenWidth = screenWidth;
cachedResults.push(result);
if (result.cache) {
cachedResults.push(result);
}
return result;
},
@ -1039,7 +1050,7 @@
result.screenWidth = screenWidth;
if (!AppInfo.hasLowImageBandwidth) {
screenWidth *= 1.25;
screenWidth *= 1.2;
}
var roundTo = 100;
@ -1057,6 +1068,8 @@
result[currentShape + 'Width'] = Math.round(shapeWidth);
}
result.cache = imagesPerRow.cache;
return result;
},
@ -1785,7 +1798,7 @@
throw new Error("null item passed into getPosterViewDisplayName");
}
var name = item.EpisodeTitle || item.Name;
var name = item.EpisodeTitle || item.Name || '';
if (item.Type == "TvChannel") {

View file

@ -221,4 +221,8 @@ $(document).on('pageinitdepends', "#loginPage", function () {
$('.manualLoginForm', page).off('submit', LoginPage.onManualSubmit).on('submit', LoginPage.onManualSubmit);
$('.btnForgotPassword', page).on('click', function () {
Dashboard.navigate('forgotpassword.html');
});
}).on('pageshowready', "#loginPage", LoginPage.onPageShow);

View file

@ -154,7 +154,7 @@
html += '<h1 style="display:inline-block; vertical-align:middle;" class="listHeader">' + Globalize.translate('HeaderLatestMedia') + '</h1>';
if (user.Policy.EnableUserPreferenceAccess && !AppInfo.isNativeApp) {
html += '<a href="mypreferencesdisplay.html" class="accentButton"><i class="fa fa-pencil"></i>' + Globalize.translate('ButtonEdit') + '</a>';
html += '<a href="mypreferencesdisplay.html" class="clearLink" style="margin-left:2em;"><paper-button raised class="secondary mini"><i class="fa fa-pencil"></i>' + Globalize.translate('ButtonEdit') + '</paper-button></a>';
}
html += '</div>';
@ -230,13 +230,13 @@
if (items.length) {
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
var cssClass = index !== 0 ? 'listHeader' : 'listHeader';
html += '<div>';
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + Globalize.translate('HeaderMyMedia') + '</h1>';
if (user.Policy.EnableUserPreferenceAccess && !AppInfo.isNativeApp) {
html += '<a href="mypreferencesdisplay.html" class="accentButton"><i class="fa fa-pencil"></i>' + Globalize.translate('ButtonEdit') + '</a>';
html += '<a href="mypreferencesdisplay.html" class="clearLink" style="margin-left:2em;"><paper-button raised class="secondary mini"><i class="fa fa-pencil"></i>' + Globalize.translate('ButtonEdit') + '</paper-button></a>';
}
html += '</div>';
@ -382,7 +382,7 @@
if (result.Items.length) {
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
var cssClass = index !== 0 ? 'listHeader' : 'listHeader';
html += '<div>';
var text = Globalize.translate('HeaderLatestFromChannel').replace('{0}', channel.Name);
@ -421,7 +421,7 @@
if (result.Items.length) {
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
var cssClass = index !== 0 ? 'listHeader' : 'listHeader';
html += '<div>';
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + Globalize.translate('HeaderLatestTvRecordings') + '</h1>';

View file

@ -1270,12 +1270,16 @@ var Dashboard = {
html += '<h1 class="pageTitle" style="display:inline-block;">' + (document.title || '&nbsp;') + '</h1>';
if (helpUrl) {
html += '<a href="' + helpUrl + '" target="_blank" class="accentButton accentButton-g" style="margin-top:-10px;"><i class="fa fa-info-circle"></i>' + Globalize.translate('ButtonHelp') + '</a>';
html += '<a href="' + helpUrl + '" target="_blank" class="clearLink" style="margin-top:-10px;display:inline-block;vertical-align:middle;margin-left:1em;"><paper-button raised class="secondary mini"><i class="fa fa-info-circle"></i>'+Globalize.translate('ButtonHelp')+'</paper-button></a>';
}
html += '</div>';
$(parent).prepend(html);
if (helpUrl) {
require(['css!thirdparty/paper-button/paper-button-style']);
}
},
setPageTitle: function (title) {
@ -1611,7 +1615,7 @@ var AppInfo = {};
else {
if (!$.browser.tv) {
AppInfo.enableHeadRoom = true;
//AppInfo.enableHeadRoom = true;
}
}
@ -1725,10 +1729,6 @@ var AppInfo = {};
function onDocumentReady() {
if (AppInfo.enableBottomTabs) {
$(document.body).addClass('bottomSecondaryNav');
}
if (AppInfo.isTouchPreferred) {
$(document.body).addClass('touch');
}
@ -1982,6 +1982,15 @@ var AppInfo = {};
$.extend(AppInfo, Dashboard.getAppInfo(appName, deviceId, deviceName));
// Do these now to prevent a flash of content
if (AppInfo.isNativeApp && $.browser.safari) {
require(['css!themes/ios']);
}
if (AppInfo.enableBottomTabs) {
$(document.body).addClass('bottomSecondaryNav');
}
if (Dashboard.isConnectMode()) {
require(['appstorage'], function () {
@ -1999,10 +2008,12 @@ var AppInfo = {};
} else {
createConnectionManager(capabilities);
Dashboard.initPromiseDone = true;
deferred.resolve();
$(onDocumentReady);
$(function() {
onDocumentReady();
Dashboard.initPromiseDone = true;
deferred.resolve();
});
}
}

View file

@ -224,10 +224,8 @@
html += '<div style="margin:1em 0 1.5em;">';
html += '<h1 style="margin: 0;display:inline-block;vertical-align:middle;">' + Globalize.translate('SyncMedia') + '</h1>';
html += '<a class="accentButton accentButton-g" style="display:inline-block;vertical-align:middle;margin-top:0;margin-left: 20px;" href="https://github.com/MediaBrowser/Wiki/wiki/Sync" target="_blank">';
html += '<i class="fa fa-info-circle"></i>';
html += Globalize.translate('ButtonHelp');
html += '</a>';
html += '<a href="https://github.com/MediaBrowser/Wiki/wiki/Sync" target="_blank" class="clearLink" style="margin-top:0;display:inline-block;vertical-align:middle;margin-left:1em;"><paper-button raised class="secondary mini"><i class="fa fa-info-circle"></i>' + Globalize.translate('ButtonHelp') + '</paper-button></a>';
html += '</div>';
html += '<div class="formFields"></div>';
@ -242,6 +240,7 @@
html += '</div>';
$(document.body).append(html);
require(['css!thirdparty/paper-button/paper-button-style']);
var elem = $('.syncPanel').panel({}).trigger('create').panel("open").on("panelclose", function () {
$(this).off("panelclose").remove();
@ -379,12 +378,7 @@
Dashboard.getCurrentUser().done(function (user) {
if (user.Policy.EnableSync) {
$('.categorySyncButton', page).show();
} else {
$('.categorySyncButton', page).hide();
}
$('.categorySyncButton', page).visible(user.Policy.EnableSync);
});
}

View file

@ -28,7 +28,6 @@
$('.globalNav', page).hide();
$('.scopedContent', page).show();
context = 'tv';
$('.nextUpHeader', page).removeClass('firstListHeader');
loadResume(page);
@ -36,7 +35,6 @@
$('.scopedLibraryViewNav', page).hide();
$('.globalNav', page).show();
$('.scopedContent', page).hide();
$('.nextUpHeader', page).addClass('firstListHeader');
}
loadNextUp(page, context || 'home-nextup');
@ -144,7 +142,6 @@
$('#resumableSection', page).show();
} else {
$('#resumableSection', page).hide();
$('.nextUpHeader', page).addClass('firstListHeader');
}
var view = getResumeView();

View file

@ -1,6 +1,20 @@
(function ($, document) {
$(document).on('pageshowready', "#tvUpcomingPage", function () {
$(document).on('pagebeforeshowready', "#tvUpcomingPage", function () {
var page = this;
if (LibraryMenu.getTopParentId()) {
$('.scopedLibraryViewNav', page).show();
$('.globalNav', page).hide();
} else {
$('.scopedLibraryViewNav', page).hide();
$('.globalNav', page).show();
}
}).on('pageshowready', "#tvUpcomingPage", function () {
var page = this;