mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update resource loading
This commit is contained in:
parent
9ce277ff9d
commit
33736c5616
7 changed files with 77 additions and 63 deletions
|
@ -55,6 +55,7 @@ define(['browser'], function (browser) {
|
||||||
|
|
||||||
if (isPluginpage || (newView.classList && newView.classList.contains('type-interior'))) {
|
if (isPluginpage || (newView.classList && newView.classList.contains('type-interior'))) {
|
||||||
dependencies.push('scripts/notifications');
|
dependencies.push('scripts/notifications');
|
||||||
|
dependencies.push('css!css/notifications.css');
|
||||||
dependencies.push('dashboardcss');
|
dependencies.push('dashboardcss');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
function getWindowLocationSearch(win) {
|
|
||||||
|
|
||||||
var search = (win || window).location.search;
|
|
||||||
|
|
||||||
if (!search) {
|
|
||||||
|
|
||||||
var index = window.location.href.indexOf('?');
|
|
||||||
if (index != -1) {
|
|
||||||
search = window.location.href.substring(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return search || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getParameterByName(name, url) {
|
|
||||||
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
|
||||||
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
|
||||||
var regex = new RegExp(regexS, "i");
|
|
||||||
|
|
||||||
var results = regex.exec(url || getWindowLocationSearch());
|
|
||||||
if (results == null)
|
|
||||||
return "";
|
|
||||||
else
|
|
||||||
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
|
||||||
}
|
|
||||||
|
|
||||||
function replaceQueryString(url, param, value) {
|
|
||||||
var re = new RegExp("([?|&])" + param + "=.*?(&|$)", "i");
|
|
||||||
if (url.match(re))
|
|
||||||
return url.replace(re, '$1' + param + "=" + value + '$2');
|
|
||||||
else if (value) {
|
|
||||||
|
|
||||||
if (url.indexOf('?') == -1) {
|
|
||||||
return url + '?' + param + "=" + value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return url + '&' + param + "=" + value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}
|
|
|
@ -810,6 +810,22 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function replaceQueryString(url, param, value) {
|
||||||
|
var re = new RegExp("([?|&])" + param + "=.*?(&|$)", "i");
|
||||||
|
if (url.match(re))
|
||||||
|
return url.replace(re, '$1' + param + "=" + value + '$2');
|
||||||
|
else if (value) {
|
||||||
|
|
||||||
|
if (url.indexOf('?') == -1) {
|
||||||
|
return url + '?' + param + "=" + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url + '&' + param + "=" + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
self.updateTextStreamUrls = function (startPositionTicks) {
|
self.updateTextStreamUrls = function (startPositionTicks) {
|
||||||
|
|
||||||
if (!self.supportsTextTracks()) {
|
if (!self.supportsTextTracks()) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['scrollHelper', 'viewManager', 'appSettings', 'appStorage', 'apphost', 'datetime', 'itemHelper', 'mediaInfo', 'scroller', 'indicators', 'dom', 'scrollStyles'], function (scrollHelper, viewManager, appSettings, appStorage, appHost, datetime, itemHelper, mediaInfo, scroller, indicators, dom) {
|
define(['viewManager', 'appSettings', 'appStorage', 'apphost', 'datetime', 'itemHelper', 'mediaInfo', 'scroller', 'indicators', 'dom', 'scrollStyles'], function (viewManager, appSettings, appStorage, appHost, datetime, itemHelper, mediaInfo, scroller, indicators, dom) {
|
||||||
|
|
||||||
function fadeInRight(elem) {
|
function fadeInRight(elem) {
|
||||||
|
|
||||||
|
|
|
@ -802,6 +802,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function replaceQueryString(url, param, value) {
|
||||||
|
var re = new RegExp("([?|&])" + param + "=.*?(&|$)", "i");
|
||||||
|
if (url.match(re))
|
||||||
|
return url.replace(re, '$1' + param + "=" + value + '$2');
|
||||||
|
else if (value) {
|
||||||
|
|
||||||
|
if (url.indexOf('?') == -1) {
|
||||||
|
return url + '?' + param + "=" + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url + '&' + param + "=" + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
function updateTabLinks(page) {
|
function updateTabLinks(page) {
|
||||||
|
|
||||||
var elems = page.querySelectorAll('.scopedLibraryViewNav a');
|
var elems = page.querySelectorAll('.scopedLibraryViewNav a');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['appStorage'], function (appStorage) {
|
define(['appStorage', 'events'], function (appStorage, events) {
|
||||||
|
|
||||||
var currentDisplayInfo;
|
var currentDisplayInfo;
|
||||||
var datetime;
|
var datetime;
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
function monitorPlayer(player) {
|
function monitorPlayer(player) {
|
||||||
|
|
||||||
Events.on(player, 'playbackstart', function (e, state) {
|
events.on(player, 'playbackstart', function (e, state) {
|
||||||
|
|
||||||
var info = {
|
var info = {
|
||||||
QueueableMediaTypes: state.NowPlayingItem.MediaType,
|
QueueableMediaTypes: state.NowPlayingItem.MediaType,
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(player, 'playbackstop', function (e, state) {
|
events.on(player, 'playbackstop', function (e, state) {
|
||||||
|
|
||||||
var stopInfo = {
|
var stopInfo = {
|
||||||
itemId: state.NowPlayingItem.Id,
|
itemId: state.NowPlayingItem.Id,
|
||||||
|
@ -284,16 +284,16 @@
|
||||||
monitorPlayer(player);
|
monitorPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.on(player, 'playbackstop', onPlaybackStop);
|
events.on(player, 'playbackstop', onPlaybackStop);
|
||||||
Events.on(player, 'beforeplaybackstart', onBeforePlaybackStart);
|
events.on(player, 'beforeplaybackstart', onBeforePlaybackStart);
|
||||||
};
|
};
|
||||||
|
|
||||||
function onBeforePlaybackStart(e, state) {
|
function onBeforePlaybackStart(e, state) {
|
||||||
Events.trigger(self, 'beforeplaybackstart', [state, this]);
|
events.trigger(self, 'beforeplaybackstart', [state, this]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlaybackStop(e, state) {
|
function onPlaybackStop(e, state) {
|
||||||
Events.trigger(self, 'playbackstop', [state, this]);
|
events.trigger(self, 'playbackstop', [state, this]);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getPlayerInfo = function () {
|
self.getPlayerInfo = function () {
|
||||||
|
@ -314,7 +314,7 @@
|
||||||
|
|
||||||
function triggerPlayerChange(newPlayer, newTarget, previousPlayer) {
|
function triggerPlayerChange(newPlayer, newTarget, previousPlayer) {
|
||||||
|
|
||||||
Events.trigger(self, 'playerchange', [newPlayer, newTarget, previousPlayer]);
|
events.trigger(self, 'playerchange', [newPlayer, newTarget, previousPlayer]);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setActivePlayer = function (player, targetInfo) {
|
self.setActivePlayer = function (player, targetInfo) {
|
||||||
|
@ -1076,8 +1076,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeApiClient(apiClient) {
|
function initializeApiClient(apiClient) {
|
||||||
Events.off(apiClient, "websocketmessage", onWebSocketMessageReceived);
|
events.off(apiClient, "websocketmessage", onWebSocketMessageReceived);
|
||||||
Events.on(apiClient, "websocketmessage", onWebSocketMessageReceived);
|
events.on(apiClient, "websocketmessage", onWebSocketMessageReceived);
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaController.init = function () {
|
MediaController.init = function () {
|
||||||
|
@ -1091,7 +1091,7 @@
|
||||||
initializeApiClient(window.ApiClient);
|
initializeApiClient(window.ApiClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.on(ConnectionManager, 'apiclientcreated', function (e, apiClient) {
|
events.on(ConnectionManager, 'apiclientcreated', function (e, apiClient) {
|
||||||
initializeApiClient(apiClient);
|
initializeApiClient(apiClient);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,31 @@
|
||||||
var Dashboard = {
|
function getWindowLocationSearch(win) {
|
||||||
|
|
||||||
|
var search = (win || window).location.search;
|
||||||
|
|
||||||
|
if (!search) {
|
||||||
|
|
||||||
|
var index = window.location.href.indexOf('?');
|
||||||
|
if (index != -1) {
|
||||||
|
search = window.location.href.substring(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return search || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getParameterByName(name, url) {
|
||||||
|
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||||||
|
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
||||||
|
var regex = new RegExp(regexS, "i");
|
||||||
|
|
||||||
|
var results = regex.exec(url || getWindowLocationSearch());
|
||||||
|
if (results == null)
|
||||||
|
return "";
|
||||||
|
else
|
||||||
|
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||||
|
}
|
||||||
|
|
||||||
|
var Dashboard = {
|
||||||
|
|
||||||
isConnectMode: function () {
|
isConnectMode: function () {
|
||||||
|
|
||||||
|
@ -1306,7 +1333,8 @@ var AppInfo = {};
|
||||||
var localApiClient;
|
var localApiClient;
|
||||||
function bindConnectionManagerEvents(connectionManager, events) {
|
function bindConnectionManagerEvents(connectionManager, events) {
|
||||||
|
|
||||||
Events.on(ConnectionManager, 'apiclientcreated', onApiClientCreated);
|
window.Events = events;
|
||||||
|
events.on(ConnectionManager, 'apiclientcreated', onApiClientCreated);
|
||||||
|
|
||||||
connectionManager.currentApiClient = function () {
|
connectionManager.currentApiClient = function () {
|
||||||
|
|
||||||
|
@ -1967,13 +1995,10 @@ var AppInfo = {};
|
||||||
define("buttonenabled", ["legacy/buttonenabled"]);
|
define("buttonenabled", ["legacy/buttonenabled"]);
|
||||||
|
|
||||||
var deps = [];
|
var deps = [];
|
||||||
deps.push('events');
|
|
||||||
|
|
||||||
deps.push('scripts/mediacontroller');
|
deps.push('scripts/mediacontroller');
|
||||||
|
|
||||||
require(deps, function (events) {
|
require(deps, function () {
|
||||||
|
|
||||||
window.Events = events;
|
|
||||||
|
|
||||||
initAfterDependencies();
|
initAfterDependencies();
|
||||||
});
|
});
|
||||||
|
@ -1990,7 +2015,6 @@ var AppInfo = {};
|
||||||
function initAfterDependencies() {
|
function initAfterDependencies() {
|
||||||
|
|
||||||
var deps = [];
|
var deps = [];
|
||||||
deps.push('scripts/extensions');
|
|
||||||
|
|
||||||
if (!window.fetch) {
|
if (!window.fetch) {
|
||||||
deps.push('fetch');
|
deps.push('fetch');
|
||||||
|
@ -2923,7 +2947,6 @@ var AppInfo = {};
|
||||||
|
|
||||||
postInitDependencies.push('scripts/thememediaplayer');
|
postInitDependencies.push('scripts/thememediaplayer');
|
||||||
postInitDependencies.push('scripts/remotecontrol');
|
postInitDependencies.push('scripts/remotecontrol');
|
||||||
postInitDependencies.push('css!css/notifications.css');
|
|
||||||
postInitDependencies.push('css!css/chromecast.css');
|
postInitDependencies.push('css!css/chromecast.css');
|
||||||
postInitDependencies.push('scripts/autobackdrops');
|
postInitDependencies.push('scripts/autobackdrops');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue