lazy load scripts

This commit is contained in:
Luke Pulverenti 2015-05-18 21:46:31 -04:00
parent ca3ad030a0
commit 463ad6cfb1
13 changed files with 101 additions and 91 deletions

View File

@ -4,7 +4,7 @@
<title>${TitlePlugins}</title> <title>${TitlePlugins}</title>
</head> </head>
<body> <body>
<div id="addPluginPage" data-role="page" class="page type-interior pluginConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Plugins" data-require="scripts/registrationservices"> <div id="addPluginPage" data-role="page" class="page type-interior pluginConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Plugins" data-require="scripts/registrationservices,scripts/ratingdialog">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">

View File

@ -4,7 +4,7 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="editItemImagesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}"> <div id="editItemImagesPage" data-role="page" class="page libraryPage metadataEditorPage" data-contextname="${HeaderMetadataManager}" data-require="scripts/edititemimages">
<div data-role="content editPageContent"> <div data-role="content editPageContent">
<div class="editPageSidebar"> <div class="editPageSidebar">
<div class="libraryTree"> <div class="libraryTree">
@ -60,7 +60,7 @@
</div> </div>
<div data-role="popup" id="popupUpload" data-theme="a"> <div data-role="popup" id="popupUpload" data-theme="a">
<form id="uploadItemImageForm" style="max-width: 100%; margin: 0 1.5em 1.5em;"> <form class="uploadItemImageForm" style="max-width: 100%; margin: 0 1.5em 1.5em;">
<h2>${HeaderAddUpdateImage}</h2> <h2>${HeaderAddUpdateImage}</h2>
<div> <div>
<p>${LabelJpgPngOnly}</p> <p>${LabelJpgPngOnly}</p>
@ -146,10 +146,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('#uploadItemImageForm').on('submit', EditItemImagesPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View File

@ -4,7 +4,7 @@
<title>${TitlePlugins}</title> <title>${TitlePlugins}</title>
</head> </head>
<body> <body>
<div id="pluginCatalogPage" data-role="page" class="page type-interior pluginConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Plugins"> <div id="pluginCatalogPage" data-role="page" class="page type-interior pluginConfigurationPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Plugins" data-require="scripts/ratingdialog">
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" data-mini="true"> <div data-role="controlgroup" data-type="horizontal" data-mini="true">

View File

@ -440,12 +440,7 @@
reload(page); reload(page);
} }
function editItemImages() { function onSubmit() {
var self = this;
self.onSubmit = function () {
var file = currentFile; var file = currentFile;
if (!file) { if (!file) {
@ -471,7 +466,11 @@
}); });
return false; return false;
}; }
function editItemImages() {
var self = this;
self.deleteImage = function (type, index) { self.deleteImage = function (type, index) {
@ -515,7 +514,7 @@
window.EditItemImagesPage = new editItemImages(); window.EditItemImagesPage = new editItemImages();
$(document).on('pageinit', "#editItemImagesPage", function () { $(document).on('pageinitdepends', "#editItemImagesPage", function () {
var page = this; var page = this;
@ -567,7 +566,10 @@
reloadBrowsableImages(page); reloadBrowsableImages(page);
}); });
}).on('pagebeforeshow', "#editItemImagesPage", function () { $('.uploadItemImageForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshown', "#editItemImagesPage", function () {
var page = this; var page = this;

View File

@ -595,9 +595,14 @@
requiresLibraryMenuRefresh = true; requiresLibraryMenuRefresh = true;
initializeApiClient(apiClient); initializeApiClient(apiClient);
}).on('localusersignedin localusersignedout', function () { }).on('localusersignedin', function () {
requiresLibraryMenuRefresh = true; requiresLibraryMenuRefresh = true;
}).on('localusersignedout', function () {
$('.viewMenuBar').remove();
requiresLibraryMenuRefresh = true;
}); });
$(function () { $(function () {

View File

@ -1083,6 +1083,11 @@
return s.Type == 'Subtitle'; return s.Type == 'Subtitle';
}); });
// Reports of stuttering with h264 stream copy in IE
if (streamInfo.playMethod == 'Transcode' && videoUrl.indexOf('.m3u8') == -1) {
videoUrl += 'EnableAutoStreamCopy=false';
}
var posterCode = self.getPosterUrl(item); var posterCode = self.getPosterUrl(item);
posterCode = posterCode ? (' poster="' + posterCode + '"') : ''; posterCode = posterCode ? (' poster="' + posterCode + '"') : '';
//======================================================================================> //======================================================================================>

View File

@ -771,6 +771,7 @@
var startPositionInSeekParam = startPosition ? (startPosition / 10000000) : 0; var startPositionInSeekParam = startPosition ? (startPosition / 10000000) : 0;
var seekParam = startPositionInSeekParam ? '#t=' + startPositionInSeekParam : ''; var seekParam = startPositionInSeekParam ? '#t=' + startPositionInSeekParam : '';
var playMethod = 'Transcode';
if (type == 'Video') { if (type == 'Video') {
@ -778,6 +779,7 @@
if (mediaSource.enableDirectPlay) { if (mediaSource.enableDirectPlay) {
mediaUrl = mediaSource.Path; mediaUrl = mediaSource.Path;
playMethod = 'DirectPlay';
} else { } else {
if (mediaSource.SupportsDirectStream) { if (mediaSource.SupportsDirectStream) {
@ -789,6 +791,7 @@
}); });
mediaUrl += seekParam; mediaUrl += seekParam;
playMethod = 'DirectStream';
} else { } else {
startTimeTicksOffset = startPosition || 0; startTimeTicksOffset = startPosition || 0;
@ -813,6 +816,7 @@
mediaUrl = mediaSource.Path; mediaUrl = mediaSource.Path;
playMethod = 'DirectPlay';
} else { } else {
var isDirectStream = mediaSource.SupportsDirectStream; var isDirectStream = mediaSource.SupportsDirectStream;
@ -827,6 +831,8 @@
api_key: ApiClient.accessToken() api_key: ApiClient.accessToken()
}); });
mediaUrl += "&static=true" + seekParam; mediaUrl += "&static=true" + seekParam;
playMethod = 'DirectStream';
} else { } else {
contentType = 'audio/' + mediaSource.TranscodingContainer; contentType = 'audio/' + mediaSource.TranscodingContainer;
@ -842,7 +848,8 @@
url: mediaUrl, url: mediaUrl,
contentType: contentType, contentType: contentType,
startTimeTicksOffset: startTimeTicksOffset, startTimeTicksOffset: startTimeTicksOffset,
startPositionInSeekParam: startPositionInSeekParam startPositionInSeekParam: startPositionInSeekParam,
playMethod: playMethod
}; };
}; };

View File

@ -208,11 +208,16 @@ var Dashboard = {
function onLogoutDone() { function onLogoutDone() {
var loginPage = !Dashboard.isConnectMode() ? var loginPage = 'login.html';
'login.html' :
'connectlogin.html';
window.location.href = loginPage; if (Dashboard.isConnectMode()) {
loginPage = 'connectlogin.html';
window.ApiClient = null;
} else {
}
Dashboard.navigate(loginPage);
} }
if (logoutWithServer === false) { if (logoutWithServer === false) {
@ -1511,7 +1516,7 @@ var AppInfo = {};
function setAppInfo() { function setAppInfo() {
if (isTouchDevice()) { if (isTouchDevice() && $.browser.mobile) {
AppInfo.isTouchPreferred = true; AppInfo.isTouchPreferred = true;
} }

View File

@ -72,17 +72,7 @@
}); });
} }
$(document).on('pageshow', "#wizardSettingsPage", function () { function onSubmit() {
var page = this;
reload(page);
});
window.WizardSettingsPage = {
onSubmit: function () {
var form = this; var form = this;
save(form); save(form);
@ -90,6 +80,15 @@
return false; return false;
} }
}; $(document).on('pageinitdepends', "#wizardSettingsPage", function () {
$('.wizardSettingsForm', page).off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshown', "#wizardSettingsPage", function () {
var page = this;
reload(page);
});
})(jQuery, document, window); })(jQuery, document, window);

View File

@ -48,21 +48,19 @@
}).done(onUpdateUserComplete); }).done(onUpdateUserComplete);
} }
function wizardUserPage() { function onSubmit() {
var self = this;
self.onSubmit = function () {
var form = this; var form = this;
submit(form); submit(form);
return false; return false;
};
} }
$(document).on('pageshow', "#wizardUserPage", function () { $(document).on('pageinitdepends', "#wizardUserPage", function () {
$('.wizardUserForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshown', "#wizardUserPage", function () {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
@ -80,6 +78,4 @@
}); });
window.WizardUserPage = new wizardUserPage();
})(jQuery, document, window); })(jQuery, document, window);

View File

@ -166,13 +166,13 @@
self.unpause = function () { self.unpause = function () {
sendMessageToDevice({ sendMessageToDevice({
command: 'unpause' command: 'Unpause'
}); });
}; };
self.pause = function () { self.pause = function () {
sendMessageToDevice({ sendMessageToDevice({
command: 'pause' command: 'Pause'
}); });
}; };
@ -222,7 +222,7 @@
self.stop = function () { self.stop = function () {
sendMessageToDevice({ sendMessageToDevice({
command: 'stop' command: 'Stop'
}); });
}; };
@ -236,7 +236,7 @@
self.mute = function () { self.mute = function () {
sendMessageToDevice({ sendMessageToDevice({
command: 'mute' command: 'Mute'
}); });
}; };
@ -383,7 +383,7 @@
sendMessageToDevice({ sendMessageToDevice({
options: { options: {
volume: (vol / 100) volume: vol
}, },
command: 'SetVolume' command: 'SetVolume'
}); });

View File

@ -4,14 +4,15 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="wizardSettingsPage" data-role="page" class="page standalonePage wizardPage mediaLibraryPage"> <div id="wizardSettingsPage" data-role="page" class="page standalonePage wizardPage mediaLibraryPage" data-require="scripts/wizardsettings">
<div data-role="content"> <div data-role="content">
<div class="ui-corner-all ui-shadow wizardContent"> <div class="ui-corner-all ui-shadow wizardContent">
<form class="wizardSettingsForm"> <form class="wizardSettingsForm">
<h2> <h2>
<img src="css/images/mblogoicon.png" />${LabelConfigureSettings}</h2> <img src="css/images/mblogoicon.png" />${LabelConfigureSettings}
</h2>
<br /> <br />
<div style="margin: 1em 0;"> <div style="margin: 1em 0;">
@ -45,9 +46,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('.wizardSettingsForm').off('submit', WizardSettingsPage.onSubmit).on('submit', WizardSettingsPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>

View File

@ -4,14 +4,15 @@
<title>Emby</title> <title>Emby</title>
</head> </head>
<body> <body>
<div id="wizardUserPage" data-role="page" class="page standalonePage wizardPage"> <div id="wizardUserPage" data-role="page" class="page standalonePage wizardPage" data-require="scripts/wizarduserpage">
<div data-role="content"> <div data-role="content">
<div class="ui-corner-all ui-shadow wizardContent"> <div class="ui-corner-all ui-shadow wizardContent">
<form id="wizardUserForm"> <form class="wizardUserForm">
<h2> <h2>
<img src="css/images/mblogoicon.png" style="height: 30px;" />${TellUsAboutYourself}</h2> <img src="css/images/mblogoicon.png" style="height: 30px;" />${TellUsAboutYourself}
</h2>
<p>${UserProfilesIntro}</p> <p>${UserProfilesIntro}</p>
@ -43,10 +44,6 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$('#wizardUserForm').on('submit', WizardUserPage.onSubmit);
</script>
</div> </div>
</body> </body>
</html> </html>