mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update script loading
This commit is contained in:
parent
7b5f61d2d2
commit
94c3abe443
8 changed files with 67 additions and 156 deletions
|
@ -18,81 +18,3 @@
|
|||
};
|
||||
|
||||
})(window);
|
||||
|
||||
//(function () {
|
||||
|
||||
// function useJqueryEvents(elems, eventName) {
|
||||
|
||||
// eventName = eventName.type || eventName;
|
||||
|
||||
// if (typeof eventName == 'string') {
|
||||
// if (eventName.indexOf('page') == 0) {
|
||||
// return true;
|
||||
// }
|
||||
// if (eventName.indexOf('loadercreate') == 0) {
|
||||
// return true;
|
||||
// }
|
||||
// } else {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// //console.log('bean: ' + eventName);
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// $.fn.jTrigger = $.fn.trigger;
|
||||
// $.fn.jOn = $.fn.on;
|
||||
// $.fn.jOff = $.fn.off;
|
||||
|
||||
// $.fn.off = function (eventName, selector, fn, ex1, ex2, ex3) {
|
||||
|
||||
// if (arguments.length > 3 || useJqueryEvents(this, eventName)) {
|
||||
// this.jOff(eventName, selector, fn, ex1, ex2, ex3);
|
||||
// return this;
|
||||
// }
|
||||
|
||||
// for (var i = 0, length = this.length; i < length; i++) {
|
||||
// bean.off(this[i], eventName, selector, fn);
|
||||
// }
|
||||
// return this;
|
||||
// };
|
||||
|
||||
// $.fn.on = function (eventName, selector, fn, ex1, ex2, ex3) {
|
||||
|
||||
// if (arguments.length > 3 || useJqueryEvents(this, eventName)) {
|
||||
// this.jOn(eventName, selector, fn, ex1, ex2, ex3);
|
||||
// return this;
|
||||
// }
|
||||
|
||||
// for (var i = 0, length = this.length; i < length; i++) {
|
||||
// bean.on(this[i], eventName, selector, fn);
|
||||
// }
|
||||
// return this;
|
||||
// };
|
||||
|
||||
// $.fn.trigger = function (eventName, params) {
|
||||
|
||||
// if (useJqueryEvents(this, eventName)) {
|
||||
// this.jTrigger(eventName, params);
|
||||
// return this;
|
||||
// }
|
||||
|
||||
// var i, length;
|
||||
|
||||
// // Need to push an extra param to make the argument order consistent with jquery
|
||||
// var newParams = [];
|
||||
// newParams.push({});
|
||||
|
||||
// if (params && params.length) {
|
||||
// for (i = 0, length = params.length; i < length; i++) {
|
||||
// newParams.push(params[i]);
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (i = 0, length = this.length; i < length; i++) {
|
||||
// bean.fire(this[i], eventName, newParams);
|
||||
// }
|
||||
// return this;
|
||||
// };
|
||||
|
||||
//})();
|
|
@ -1614,3 +1614,13 @@ progress {
|
|||
.scheduledTaskPaperIconItem paper-progress {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.imageDropZone {
|
||||
border: 2px dashed #bbb;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
padding: 25px;
|
||||
text-align: center;
|
||||
color: #bbb;
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
/* User Image */
|
||||
.imageDropZone {
|
||||
border: 2px dashed #bbb;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
padding: 25px;
|
||||
text-align: center;
|
||||
color: #bbb;
|
||||
}
|
|
@ -1,16 +1,4 @@
|
|||
$.fn.checked = function (value) {
|
||||
if (value === true || value === false) {
|
||||
// Set the value of the checkbox
|
||||
return $(this).each(function () {
|
||||
this.checked = value;
|
||||
});
|
||||
} else {
|
||||
// Return check state
|
||||
return this.length && this[0].checked;
|
||||
}
|
||||
};
|
||||
|
||||
function getWindowLocationSearch(win) {
|
||||
function getWindowLocationSearch(win) {
|
||||
|
||||
var search = (win || window).location.search;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var LibraryBrowser = (function (window, document, $, screen) {
|
||||
var LibraryBrowser = (function (window, document, screen) {
|
||||
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
||||
|
@ -2839,7 +2839,7 @@
|
|||
document.body.appendChild(dlg);
|
||||
|
||||
dlg.addEventListener('iron-overlay-closed', function () {
|
||||
$(dlg).remove();
|
||||
dlg.parentNode.removeChild(dlg);
|
||||
});
|
||||
|
||||
require(['components/paperdialoghelper'], function () {
|
||||
|
@ -3539,26 +3539,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
renderBudget: function (elem, item) {
|
||||
|
||||
if (item.Budget) {
|
||||
|
||||
elem.show().html(Globalize.translate('ValueBudget', '$' + item.Budget));
|
||||
} else {
|
||||
elem.hide();
|
||||
}
|
||||
},
|
||||
|
||||
renderRevenue: function (elem, item) {
|
||||
|
||||
if (item.Revenue) {
|
||||
|
||||
elem.show().html(Globalize.translate('ValueRevenue', '$' + item.Revenue));
|
||||
} else {
|
||||
elem.hide();
|
||||
}
|
||||
},
|
||||
|
||||
renderAwardSummary: function (elem, item) {
|
||||
if (item.AwardSummary) {
|
||||
elem.show().html(Globalize.translate('ValueAwards', item.AwardSummary));
|
||||
|
@ -3615,4 +3595,4 @@
|
|||
|
||||
return libraryBrowser;
|
||||
|
||||
})(window, document, jQuery, screen);
|
||||
})(window, document, screen);
|
|
@ -1,4 +1,4 @@
|
|||
(function ($, window) {
|
||||
(function (window) {
|
||||
|
||||
var currentDisplayInfo;
|
||||
function mirrorItem(info) {
|
||||
|
@ -238,7 +238,9 @@
|
|||
|
||||
var keys = new bindKeys(self);
|
||||
|
||||
$(window).on("keydown", keys.keyBinding).on("keypress", keys.keyPrevent).on("keyup", keys.keyPrevent);
|
||||
window.addEventListener('keydown', keys.keyBinding);
|
||||
window.addEventListener('keypress', keys.keyPrevent);
|
||||
window.addEventListener('keyup', keys.keyPrevent);
|
||||
|
||||
self.registerPlayer = function (player) {
|
||||
|
||||
|
@ -253,11 +255,11 @@
|
|||
};
|
||||
|
||||
function onBeforePlaybackStart(e, state) {
|
||||
$(self).trigger('beforeplaybackstart', [state, this]);
|
||||
Events.trigger(self, 'beforeplaybackstart', [state, this]);
|
||||
}
|
||||
|
||||
function onPlaybackStop(e, state) {
|
||||
$(self).trigger('playbackstop', [state, this]);
|
||||
Events.trigger(self, 'playbackstop', [state, this]);
|
||||
}
|
||||
|
||||
self.getPlayerInfo = function () {
|
||||
|
@ -278,7 +280,7 @@
|
|||
|
||||
function triggerPlayerChange(newPlayer, newTarget) {
|
||||
|
||||
$(self).trigger('playerchange', [newPlayer, newTarget]);
|
||||
Events.trigger(self, 'playerchange', [newPlayer, newTarget]);
|
||||
}
|
||||
|
||||
self.setActivePlayer = function (player, targetInfo) {
|
||||
|
@ -1033,4 +1035,4 @@
|
|||
mirrorIfEnabled(info);
|
||||
});
|
||||
|
||||
})(jQuery, window);
|
||||
})(this);
|
|
@ -1,4 +1,4 @@
|
|||
(function (document, setTimeout, clearTimeout, screen, $, setInterval, window) {
|
||||
(function (document, setTimeout, clearTimeout, screen, setInterval, window) {
|
||||
|
||||
function mediaPlayer() {
|
||||
|
||||
|
@ -1997,4 +1997,4 @@
|
|||
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
||||
|
||||
|
||||
})(document, setTimeout, clearTimeout, screen, $, setInterval, window);
|
||||
})(document, setTimeout, clearTimeout, screen, setInterval, window);
|
|
@ -365,7 +365,7 @@ var Dashboard = {
|
|||
|
||||
options.id = options.id || "notification" + new Date().getTime() + parseInt(Math.random());
|
||||
|
||||
if (!$(".footer").length) {
|
||||
if (!document.querySelector(".footer")) {
|
||||
|
||||
var footerHtml = '<div id="footer" class="footer" data-theme="b" class="ui-bar-b">';
|
||||
|
||||
|
@ -479,11 +479,14 @@ var Dashboard = {
|
|||
|
||||
getModalLoadingMsg: function () {
|
||||
|
||||
var elem = $('.modalLoading');
|
||||
var elem = document.querySelector('.modalLoading');
|
||||
|
||||
if (!elem.length) {
|
||||
if (!elem) {
|
||||
|
||||
elem = $('<div class="modalLoading" style="display:none;"></div>').appendTo(document.body);
|
||||
elem = document.createElement('modalLoading');
|
||||
elem.classList.add('modalLoading');
|
||||
elem.style.display = 'none';
|
||||
document.body.appendChild(elem);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1079,7 +1082,7 @@ var Dashboard = {
|
|||
Dashboard.onBrowseCommand(cmd.Arguments);
|
||||
break;
|
||||
case 'GoToSearch':
|
||||
Search.showSearchPanel($.mobile.activePage);
|
||||
Search.showSearchPanel();
|
||||
break;
|
||||
case 'DisplayMessage':
|
||||
{
|
||||
|
@ -1444,7 +1447,7 @@ var Dashboard = {
|
|||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
|
||||
}
|
||||
|
||||
$(select).html(html);
|
||||
select.innerHTML = html;
|
||||
},
|
||||
|
||||
populateCountries: function (select, allCountries) {
|
||||
|
@ -1460,7 +1463,7 @@ var Dashboard = {
|
|||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
|
||||
}
|
||||
|
||||
$(select).html(html);
|
||||
select.innerHTML = html;
|
||||
},
|
||||
|
||||
getSupportedRemoteCommands: function () {
|
||||
|
@ -1783,7 +1786,7 @@ var AppInfo = {};
|
|||
window.ConnectionManager.clearData();
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, newApiClient) {
|
||||
Events.on(ConnectionManager, 'apiclientcreated', function (e, newApiClient) {
|
||||
|
||||
initializeApiClient(newApiClient);
|
||||
});
|
||||
|
@ -1925,7 +1928,8 @@ var AppInfo = {};
|
|||
isMobile: 'bower_components/isMobile/isMobile.min',
|
||||
headroom: 'bower_components/headroom.js/dist/headroom.min',
|
||||
masonry: 'bower_components/masonry/dist/masonry.pkgd.min',
|
||||
humanedate: 'components/humanedate'
|
||||
humanedate: 'components/humanedate',
|
||||
jQuery: 'bower_components/jquery/dist/jquery.min'
|
||||
};
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
|
@ -1944,11 +1948,6 @@ var AppInfo = {};
|
|||
|
||||
function init(promiseResolve, capabilities, appName, appVersion, deviceId, deviceName) {
|
||||
|
||||
// Required since jQuery is loaded before requireJs
|
||||
define('jquery', [], function () {
|
||||
return jQuery;
|
||||
});
|
||||
|
||||
if (Dashboard.isRunningInCordova() && browserInfo.android) {
|
||||
define("appstorage", ["cordova/android/appstorage"]);
|
||||
} else {
|
||||
|
@ -2109,10 +2108,27 @@ var AppInfo = {};
|
|||
deps.push('scripts/mediacontroller');
|
||||
deps.push('scripts/globalize');
|
||||
deps.push('apiclient/events');
|
||||
deps.push('jQuery');
|
||||
|
||||
require(deps, function () {
|
||||
|
||||
$.extend(AppInfo, Dashboard.getAppInfo(appName, appVersion, deviceId, deviceName));
|
||||
// TODO: This needs to be deprecated, but it's used heavily
|
||||
$.fn.checked = function (value) {
|
||||
if (value === true || value === false) {
|
||||
// Set the value of the checkbox
|
||||
return $(this).each(function () {
|
||||
this.checked = value;
|
||||
});
|
||||
} else {
|
||||
// Return check state
|
||||
return this.length && this[0].checked;
|
||||
}
|
||||
};
|
||||
|
||||
var baseInfo = Dashboard.getAppInfo(appName, appVersion, deviceId, deviceName);
|
||||
for (var i in baseInfo) {
|
||||
AppInfo[i] = baseInfo[i];
|
||||
}
|
||||
|
||||
initAfterDependencies(promiseResolve, capabilities);
|
||||
});
|
||||
|
@ -2151,6 +2167,8 @@ var AppInfo = {};
|
|||
deps.push('apiclient/credentials');
|
||||
deps.push('apiclient/md5');
|
||||
|
||||
deps.push('thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.js');
|
||||
|
||||
require(deps, function () {
|
||||
|
||||
if (Dashboard.isRunningInCordova() && browserInfo.android) {
|
||||
|
@ -2286,6 +2304,8 @@ var AppInfo = {};
|
|||
|
||||
require(deps, function () {
|
||||
|
||||
$.mobile.filterHtml = Dashboard.filterHtml;
|
||||
|
||||
$.mobile.initializePage();
|
||||
promiseResolve();
|
||||
|
||||
|
@ -2407,10 +2427,10 @@ var AppInfo = {};
|
|||
var initialDependencies = [];
|
||||
|
||||
initialDependencies.push('isMobile');
|
||||
initialDependencies.push('thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.js');
|
||||
initialDependencies.push('apiclient/logger');
|
||||
initialDependencies.push('apiclient/store');
|
||||
initialDependencies.push('apiclient/device');
|
||||
initialDependencies.push('scripts/extensions');
|
||||
|
||||
var supportsNativeWebComponents = 'registerElement' in document && 'content' in document.createElement('template');
|
||||
|
||||
|
@ -2424,8 +2444,6 @@ var AppInfo = {};
|
|||
|
||||
require(initialDependencies, function (isMobile) {
|
||||
|
||||
$.mobile.filterHtml = Dashboard.filterHtml;
|
||||
|
||||
Dashboard.initPromise = new Promise(function (resolve, reject) {
|
||||
|
||||
function onWebComponentsReady() {
|
||||
|
@ -2477,24 +2495,25 @@ function pageIdOn(eventName, id, fn) {
|
|||
|
||||
pageClassOn('pagecreate', "page", function () {
|
||||
|
||||
var page = $(this);
|
||||
var jPage = $(this);
|
||||
var page = this;
|
||||
|
||||
var current = page.data('theme');
|
||||
var current = jPage.data('theme');
|
||||
|
||||
if (!current) {
|
||||
|
||||
var newTheme;
|
||||
|
||||
if (page.hasClass('libraryPage')) {
|
||||
if (page.classList.contains('libraryPage')) {
|
||||
newTheme = 'b';
|
||||
} else {
|
||||
newTheme = 'a';
|
||||
}
|
||||
|
||||
current = page.page("option", "theme");
|
||||
current = jPage.page("option", "theme");
|
||||
|
||||
if (current && current != newTheme) {
|
||||
page.page("option", "theme", newTheme);
|
||||
jPage.page("option", "theme", newTheme);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue