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

auto-organize fix

This commit is contained in:
Luke Pulverenti 2015-06-08 17:32:20 -04:00
parent bbfda77868
commit f64e0c7c53
54 changed files with 838 additions and 666 deletions

View file

@ -50,6 +50,7 @@ var Dashboard = {
$.event.special.swipe.verticalDistanceThreshold = 40;
$.mobile.loader.prototype.options.disabled = true;
//$.mobile.page.prototype.options.domCache = true;
},
isConnectMode: function () {
@ -1453,25 +1454,6 @@ var Dashboard = {
return deferred.promise();
},
loadLocalAssetManager: function () {
var deferred = DeferredBuilder.Deferred();
var file = 'thirdparty/apiclient/localassetmanager';
if (AppInfo.isNativeApp && $.browser.android) {
file = 'thirdparty/cordova/android/localassetmanager';
}
require([
file
], function () {
deferred.resolve();
});
return deferred.promise();
},
ready: function (fn) {
if (Dashboard.initPromiseDone) {
@ -1506,6 +1488,14 @@ var Dashboard = {
});
return deferred.promise();
},
exitOnBack: function () {
return $($.mobile.activePage).is('#indexPage');
},
exit: function () {
Dashboard.logout();
}
};
@ -1601,6 +1591,8 @@ var AppInfo = {};
function initializeApiClient(apiClient) {
apiClient.enableAppStorePolicy = AppInfo.enableAppStorePolicy;
apiClient.getDefaultImageQuality = Dashboard.getDefaultImageQuality;
apiClient.normalizeImageOptions = Dashboard.normalizeImageOptions;
$(apiClient).off('.dashboard')
.on("websocketmessage.dashboard", Dashboard.onWebSocketMessageReceived)
@ -1619,37 +1611,35 @@ var AppInfo = {};
initializeApiClient(newApiClient);
});
var apiClient;
var deferred = DeferredBuilder.Deferred();
if (Dashboard.isConnectMode()) {
apiClient = ConnectionManager.getLastUsedApiClient();
var server = ConnectionManager.getLastUsedServer();
if (!Dashboard.isServerlessPage()) {
if (apiClient && apiClient.serverAddress() && apiClient.getCurrentUserId() && apiClient.accessToken()) {
initializeApiClient(apiClient);
if (server && server.UserId && server.AccessToken) {
ConnectionManager.connectToServer(server).done(function (result) {
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
window.ApiClient = result.ApiClient;
}
deferred.resolve();
});
return deferred.promise();
}
}
deferred.resolve();
} else {
apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId);
var apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId);
apiClient.enableAutomaticNetworking = false;
ConnectionManager.addApiClient(apiClient);
Dashboard.importCss(apiClient.getUrl('Branding/Css'));
window.ApiClient = apiClient;
}
window.ApiClient = apiClient;
if (window.ApiClient) {
ApiClient.getDefaultImageQuality = Dashboard.getDefaultImageQuality;
ApiClient.normalizeImageOptions = Dashboard.normalizeImageOptions;
if (!AppInfo.isNativeApp) {
Dashboard.importCss(ApiClient.getUrl('Branding/Css'));
}
}
return deferred.promise();
}
function initFastClick() {
@ -1833,7 +1823,7 @@ var AppInfo = {};
});
if (Dashboard.isRunningInCordova()) {
requirejs(['thirdparty/cordova/connectsdk', 'scripts/registrationservices']);
requirejs(['thirdparty/cordova/connectsdk', 'scripts/registrationservices', 'thirdparty/cordova/volume', 'thirdparty/cordova/back']);
if ($.browser.android) {
requirejs(['thirdparty/cordova/android/androidcredentials', 'thirdparty/cordova/android/immersive', 'thirdparty/cordova/android/filesystem']);
@ -1853,7 +1843,7 @@ var AppInfo = {};
}
}
function init(deferred, capabilities, appName, deviceId, deviceName, resolveOnReady) {
function init(deferred, capabilities, appName, deviceId, deviceName) {
requirejs.config({
map: {
@ -1861,7 +1851,11 @@ var AppInfo = {};
'css': 'thirdparty/requirecss' // or whatever the path to require-css is
}
},
urlArgs: "v=" + window.dashboardVersion
urlArgs: "v=" + window.dashboardVersion,
paths: {
"velocity": "thirdparty/velocity.min"
}
});
// Required since jQuery is loaded before requireJs
@ -1869,37 +1863,61 @@ var AppInfo = {};
return jQuery;
});
if (Dashboard.isRunningInCordova() && $.browser.android) {
define("appstorage", ["thirdparty/cordova/android/appstorage"]);
} else {
define('appstorage', [], function () {
return appStorage;
});
}
if (Dashboard.isRunningInCordova()) {
define("serverdiscovery", ["thirdparty/cordova/serverdiscovery"]);
define("wakeonlan", ["thirdparty/cordova/wakeonlan"]);
} else {
define("serverdiscovery", ["thirdparty/apiclient/serverdiscovery"]);
define("wakeonlan", ["thirdparty/apiclient/wakeonlan"]);
}
if (Dashboard.isRunningInCordova() && $.browser.android) {
define("localassetmanager", ["thirdparty/cordova/android/localassetmanager"]);
} else {
define("localassetmanager", ["thirdparty/apiclient/localassetmanager"]);
}
define("connectservice", ["thirdparty/apiclient/connectservice"]);
//requirejs(['http://viblast.com/player/free-version/qy2fdwajo1/viblast.js']);
setAppInfo();
$.extend(AppInfo, Dashboard.getAppInfo(appName, deviceId, deviceName));
createConnectionManager(capabilities);
if (Dashboard.isConnectMode()) {
if (!resolveOnReady) {
require(['appstorage'], function () {
capabilities.DeviceProfile = MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width));
createConnectionManager(capabilities).done(function() {
$(function () {
onDocumentReady();
Dashboard.initPromiseDone = true;
deferred.resolve();
});
});
});
} else {
createConnectionManager(capabilities);
Dashboard.initPromiseDone = true;
deferred.resolve();
}
$(function () {
onDocumentReady();
if (resolveOnReady) {
Dashboard.initPromiseDone = true;
deferred.resolve();
}
});
$(onDocumentReady);
}
}
function initCordovaWithDeviceId(deferred, deviceId) {
var screenWidth = Math.max(screen.height, screen.width);
initCordovaWithDeviceProfile(deferred, deviceId, MediaPlayer.getDeviceProfile(screenWidth));
}
function initCordovaWithDeviceProfile(deferred, deviceId, deviceProfile) {
if ($.browser.android) {
requirejs(['thirdparty/cordova/android/imagestore.js']);
} else {
@ -1908,9 +1926,7 @@ var AppInfo = {};
var capablities = Dashboard.capabilities();
capablities.DeviceProfile = deviceProfile;
init(deferred, capablities, "Emby Mobile", deviceId, device.model, true);
init(deferred, capablities, "Emby Mobile", deviceId, device.model);
}
function initCordova(deferred) {