lazy load scripts

This commit is contained in:
Luke Pulverenti 2015-05-15 14:28:34 -04:00
parent b9884940ef
commit a3b2f32a2a
10 changed files with 19 additions and 15 deletions

View File

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="liveTvChannelsPage" data-role="page" class="page libraryPage liveTvPage" data-contextname="${HeaderLiveTv}">
<div id="liveTvChannelsPage" data-role="page" class="page libraryPage liveTvPage" data-contextname="${HeaderLiveTv}" data-require="scripts/livetvchannels">
<div class="libraryViewNav">
<a href="livetvsuggested.html">${TabSuggestions}</a>
<a href="livetvguide.html">${TabGuide}</a>

View File

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="liveTvRecordingsPage" data-role="page" class="page libraryPage liveTvPage" data-contextname="${HeaderLiveTv}">
<div id="liveTvRecordingsPage" data-role="page" class="page libraryPage liveTvPage" data-contextname="${HeaderLiveTv}" data-require="scripts/livetvrecordings">
<div class="libraryViewNav">
<a href="livetvsuggested.html">${TabSuggestions}</a>
<a href="livetvguide.html">${TabGuide}</a>

View File

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="liveTvSeriesTimersPage" data-role="page" class="page libraryPage liveTvPage" data-contextname="${HeaderLiveTv}">
<div id="liveTvSeriesTimersPage" data-role="page" class="page libraryPage liveTvPage" data-contextname="${HeaderLiveTv}" data-require="scripts/livetvseriestimers">
<div class="libraryViewNav">
<a href="livetvsuggested.html">${TabSuggestions}</a>
<a href="livetvguide.html">${TabGuide}</a>

View File

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="liveTvSuggestedPage" data-role="page" class="page libraryPage liveTvPage backdropPage globalBackdropPage" data-contextname="${HeaderLiveTv}" data-backdroptype="series,movie">
<div id="liveTvSuggestedPage" data-role="page" class="page libraryPage liveTvPage backdropPage globalBackdropPage" data-contextname="${HeaderLiveTv}" data-backdroptype="series,movie" data-require="scripts/livetvsuggested">
<div class="libraryViewNav">
<a href="#" class="ui-btn-active">${TabSuggestions}</a>
<a href="livetvguide.html">${TabGuide}</a>

View File

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="liveTvTimersPage" data-role="page" class="page libraryPage liveTvPage" data-contextname="${HeaderLiveTv}">
<div id="liveTvTimersPage" data-role="page" class="page libraryPage liveTvPage" data-contextname="${HeaderLiveTv}" data-require="scripts/livetvtimers">
<div class="libraryViewNav">
<a href="livetvsuggested.html">${TabSuggestions}</a>
<a href="livetvguide.html">${TabGuide}</a>

View File

@ -74,7 +74,7 @@
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
}
$(document).on('pageinit', "#liveTvChannelsPage", function () {
$(document).on('pageinitdepends', "#liveTvChannelsPage", function () {
var page = this;
@ -109,7 +109,7 @@
reloadItems(page);
});
}).on('pageshow', "#liveTvChannelsPage", function () {
}).on('pageshown', "#liveTvChannelsPage", function () {
// Can't use pagebeforeshow here or the loading popup won't center correctly
var page = this;

View File

@ -102,7 +102,7 @@
});
}
$(document).on('pagebeforeshow', "#liveTvRecordingsPage", function () {
$(document).on('pageshown', "#liveTvRecordingsPage", function () {
var page = this;

View File

@ -116,7 +116,7 @@
}).checkboxradio('refresh');
}
$(document).on('pagebeforeshow', "#liveTvSeriesTimersPage", function () {
$(document).on('pageshown', "#liveTvSeriesTimersPage", function () {
var page = this;
@ -138,8 +138,6 @@
reload(page);
});
}).on('pageshow', "#liveTvSeriesTimersPage", function () {
updateFilterControls(this);
});

View File

@ -1,7 +1,7 @@
(function ($, document) {
function reload(page) {
function loadRecommendedPrograms(page) {
Dashboard.showLoadingMsg();
ApiClient.getLiveTvRecommendedPrograms({
@ -25,7 +25,13 @@
});
$('.activeProgramItems', page).html(html).lazyChildren();
Dashboard.hideLoadingMsg();
});
}
function reload(page) {
loadRecommendedPrograms(page);
ApiClient.getLiveTvRecommendedPrograms({
@ -98,7 +104,7 @@
});
}
$(document).on('pagebeforeshow', "#liveTvSuggestedPage", function () {
$(document).on('pageshown', "#liveTvSuggestedPage", function () {
var page = this;

View File

@ -107,7 +107,7 @@
});
}
$(document).on('pagebeforeshow', "#liveTvTimersPage", function () {
$(document).on('pageshown', "#liveTvTimersPage", function () {
var page = this;