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-22 15:16:14 -04:00
parent 7e55abc130
commit 3818349496
27 changed files with 510 additions and 443 deletions

View file

@ -106,7 +106,7 @@
};
function triggerPlayerChange(newPlayer, newTarget) {
$(self).trigger('playerchange', [newPlayer, newTarget]);
}
@ -142,8 +142,8 @@
throw new Error('null player');
}
player.tryPair(targetInfo).done(function() {
player.tryPair(targetInfo).done(function () {
currentPlayer = player;
currentTargetInfo = targetInfo;
@ -176,7 +176,7 @@
}
};
self.getPlayers = function() {
self.getPlayers = function () {
return players;
};
@ -220,22 +220,35 @@
return deferred.promise();
};
function doWithPlaybackValidation(fn) {
requirejs(["scripts/registrationservices"], function () {
RegistrationServices.validateFeature('playback').done(fn);
});
}
self.play = function (options) {
if (typeof (options) === 'string') {
options = { ids: [options] };
}
doWithPlaybackValidation(function() {
if (typeof (options) === 'string') {
options = { ids: [options] };
}
currentPlayer.play(options);
currentPlayer.play(options);
});
};
self.shuffle = function (id) {
currentPlayer.shuffle(id);
doWithPlaybackValidation(function () {
currentPlayer.shuffle(id);
});
};
self.instantMix = function (id) {
currentPlayer.instantMix(id);
doWithPlaybackValidation(function () {
currentPlayer.instantMix(id);
});
};
self.queue = function (options) {
@ -370,10 +383,6 @@
currentPlayer.volumeUp();
};
self.shuffle = function (id) {
currentPlayer.shuffle(id);
};
self.playlist = function () {
return currentPlayer.playlist || [];
};
@ -458,12 +467,12 @@
return bottomText ? topText + '<br/>' + bottomText : topText;
};
self.showPlaybackInfoErrorMessage = function(errorCode) {
self.showPlaybackInfoErrorMessage = function (errorCode) {
// This timeout is messy, but if jqm is in the act of hiding a popup, it will not show a new one
// If we're coming from the popup play menu, this will be a problem
setTimeout(function() {
setTimeout(function () {
Dashboard.alert({
message: Globalize.translate('MessagePlaybackError' + errorCode),
title: Globalize.translate('HeaderPlaybackError')