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

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

@ -440,39 +440,38 @@
reload(page);
}
function onSubmit() {
var file = currentFile;
if (!file) {
return false;
}
if (file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/jpeg") {
return false;
}
Dashboard.showLoadingMsg();
var page = $.mobile.activePage;
var imageType = $('#selectImageType', page).val();
ApiClient.uploadItemImage(currentItem.Id, imageType, file).done(function () {
$('#uploadImage', page).val('').trigger('change');
$('#popupUpload', page).popup("close");
processImageChangeResult(page);
});
return false;
}
function editItemImages() {
var self = this;
self.onSubmit = function () {
var file = currentFile;
if (!file) {
return false;
}
if (file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/jpeg") {
return false;
}
Dashboard.showLoadingMsg();
var page = $.mobile.activePage;
var imageType = $('#selectImageType', page).val();
ApiClient.uploadItemImage(currentItem.Id, imageType, file).done(function () {
$('#uploadImage', page).val('').trigger('change');
$('#popupUpload', page).popup("close");
processImageChangeResult(page);
});
return false;
};
self.deleteImage = function (type, index) {
var page = $.mobile.activePage;
@ -515,7 +514,7 @@
window.EditItemImagesPage = new editItemImages();
$(document).on('pageinit', "#editItemImagesPage", function () {
$(document).on('pageinitdepends', "#editItemImagesPage", function () {
var page = this;
@ -567,7 +566,10 @@
reloadBrowsableImages(page);
});
}).on('pagebeforeshow', "#editItemImagesPage", function () {
$('.uploadItemImageForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshown', "#editItemImagesPage", function () {
var page = this;

View file

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

View file

@ -1083,6 +1083,11 @@
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);
posterCode = posterCode ? (' poster="' + posterCode + '"') : '';
//======================================================================================>

View file

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

View file

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

View file

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

View file

@ -48,21 +48,19 @@
}).done(onUpdateUserComplete);
}
function wizardUserPage() {
function onSubmit() {
var form = this;
var self = this;
submit(form);
self.onSubmit = function () {
var form = this;
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();
@ -80,6 +78,4 @@
});
window.WizardUserPage = new wizardUserPage();
})(jQuery, document, window);