mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
minify resources
This commit is contained in:
parent
8a6884abef
commit
661eeac16e
201 changed files with 203 additions and 52376 deletions
|
@ -1,245 +1 @@
|
|||
define(['appStorage', 'browser'], function (appStorage, browser) {
|
||||
'use strict';
|
||||
|
||||
function getDeviceProfile() {
|
||||
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
function getCapabilities() {
|
||||
|
||||
var caps = {
|
||||
PlayableMediaTypes: ['Audio', 'Video'],
|
||||
|
||||
SupportsPersistentIdentifier: false,
|
||||
DeviceProfile: getDeviceProfile()
|
||||
};
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
function generateDeviceId() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(["cryptojs-sha1"], function () {
|
||||
|
||||
var keys = [];
|
||||
keys.push(navigator.userAgent);
|
||||
keys.push(new Date().getTime());
|
||||
|
||||
resolve(CryptoJS.SHA1(keys.join('|')).toString());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getDeviceId() {
|
||||
var key = '_deviceId2';
|
||||
var deviceId = appStorage.getItem(key);
|
||||
|
||||
if (deviceId) {
|
||||
return Promise.resolve(deviceId);
|
||||
} else {
|
||||
return generateDeviceId().then(function (deviceId) {
|
||||
appStorage.setItem(key, deviceId);
|
||||
return deviceId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getDeviceName() {
|
||||
var deviceName;
|
||||
|
||||
if (browser.tizen) {
|
||||
deviceName = "Samsung Smart TV";
|
||||
} else if (browser.web0S) {
|
||||
deviceName = "LG Smart TV";
|
||||
} else if (browser.operaTv) {
|
||||
deviceName = "Opera TV";
|
||||
} else if (browser.xboxOne) {
|
||||
deviceName = "Xbox One";
|
||||
} else if (browser.ps4) {
|
||||
deviceName = "Sony PS4";
|
||||
} else if (browser.chrome) {
|
||||
deviceName = "Chrome";
|
||||
} else if (browser.edge) {
|
||||
deviceName = "Edge";
|
||||
} else if (browser.firefox) {
|
||||
deviceName = "Firefox";
|
||||
} else if (browser.msie) {
|
||||
deviceName = "Internet Explorer";
|
||||
} else {
|
||||
deviceName = "Web Browser";
|
||||
}
|
||||
|
||||
if (browser.version) {
|
||||
deviceName += " " + browser.version;
|
||||
}
|
||||
|
||||
if (browser.ipad) {
|
||||
deviceName += " Ipad";
|
||||
} else if (browser.iphone) {
|
||||
deviceName += " Iphone";
|
||||
} else if (browser.android) {
|
||||
deviceName += " Android";
|
||||
}
|
||||
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
function supportsVoiceInput() {
|
||||
|
||||
if (browser.tv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return window.SpeechRecognition ||
|
||||
window.webkitSpeechRecognition ||
|
||||
window.mozSpeechRecognition ||
|
||||
window.oSpeechRecognition ||
|
||||
window.msSpeechRecognition;
|
||||
}
|
||||
|
||||
function supportsFullscreen() {
|
||||
|
||||
if (browser.tv) {
|
||||
return false;
|
||||
};
|
||||
|
||||
var element = document.documentElement;
|
||||
|
||||
return element.requestFullscreen ||
|
||||
element.mozRequestFullScreen ||
|
||||
element.webkitRequestFullscreen ||
|
||||
element.msRequestFullscreen;
|
||||
}
|
||||
|
||||
function getSyncProfile() {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['browserdeviceprofile', 'qualityoptions', 'appSettings'], function (profileBuilder, qualityoptions, appSettings) {
|
||||
|
||||
var profile = profileBuilder();
|
||||
|
||||
profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate();
|
||||
|
||||
resolve(profile);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var supportedFeatures = function () {
|
||||
|
||||
var features = [
|
||||
'filedownload',
|
||||
'sharing',
|
||||
'externalpremium'
|
||||
];
|
||||
|
||||
if (browser.operaTv || browser.tizen || browser.web0s) {
|
||||
features.push('exit');
|
||||
} else {
|
||||
features.push('exitmenu');
|
||||
}
|
||||
|
||||
if (!browser.operaTv) {
|
||||
features.push('externallinks');
|
||||
}
|
||||
|
||||
if (supportsVoiceInput()) {
|
||||
features.push('voiceinput');
|
||||
}
|
||||
|
||||
if (!browser.mobile || browser.edgeUwp) {
|
||||
features.push('htmlaudioautoplay');
|
||||
features.push('htmlvideoautoplay');
|
||||
}
|
||||
|
||||
if (window.SyncRegistered) {
|
||||
//features.push('sync');
|
||||
}
|
||||
|
||||
if (supportsFullscreen()) {
|
||||
features.push('fullscreenchange');
|
||||
}
|
||||
|
||||
if (browser.chrome || (browser.edge && !browser.slow)) {
|
||||
features.push('imageanalysis');
|
||||
}
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
features.push('multiserver');
|
||||
}
|
||||
|
||||
if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) {
|
||||
features.push('physicalvolumecontrol');
|
||||
}
|
||||
|
||||
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
|
||||
features.push('remotecontrol');
|
||||
}
|
||||
|
||||
return features;
|
||||
}();
|
||||
|
||||
var appInfo;
|
||||
var version = window.dashboardVersion || '3.0';
|
||||
|
||||
return {
|
||||
getWindowState: function () {
|
||||
return document.windowState || 'Normal';
|
||||
},
|
||||
setWindowState: function (state) {
|
||||
alert('setWindowState is not supported and should not be called');
|
||||
},
|
||||
exit: function () {
|
||||
|
||||
if (browser.tizen) {
|
||||
try {
|
||||
tizen.application.getCurrentApplication().exit();
|
||||
} catch (err) {
|
||||
console.log('error closing application: ' + err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
window.close();
|
||||
},
|
||||
supports: function (command) {
|
||||
|
||||
return supportedFeatures.indexOf(command.toLowerCase()) != -1;
|
||||
},
|
||||
unlockedFeatures: function () {
|
||||
|
||||
var features = [];
|
||||
|
||||
features.push('playback');
|
||||
features.push('livetv');
|
||||
|
||||
return features;
|
||||
},
|
||||
appInfo: function () {
|
||||
|
||||
if (appInfo) {
|
||||
return Promise.resolve(appInfo);
|
||||
}
|
||||
|
||||
return getDeviceId().then(function (deviceId) {
|
||||
|
||||
appInfo = {
|
||||
deviceId: deviceId,
|
||||
deviceName: getDeviceName(),
|
||||
appName: 'Emby Mobile',
|
||||
appVersion: version
|
||||
};
|
||||
|
||||
return appInfo;
|
||||
});
|
||||
},
|
||||
capabilities: getCapabilities,
|
||||
preferVisualCards: browser.android || browser.chrome,
|
||||
moreIcon: browser.safari || browser.edge ? 'dots-horiz' : 'dots-vert',
|
||||
getSyncProfile: getSyncProfile
|
||||
};
|
||||
});
|
||||
define(["appStorage","browser"],function(appStorage,browser){"use strict";function getDeviceProfile(){return null}function getCapabilities(){var caps={PlayableMediaTypes:["Audio","Video"],SupportsPersistentIdentifier:!1,DeviceProfile:getDeviceProfile()};return caps}function generateDeviceId(){return new Promise(function(resolve,reject){require(["cryptojs-sha1"],function(){var keys=[];keys.push(navigator.userAgent),keys.push((new Date).getTime()),resolve(CryptoJS.SHA1(keys.join("|")).toString())})})}function getDeviceId(){var key="_deviceId2",deviceId=appStorage.getItem(key);return deviceId?Promise.resolve(deviceId):generateDeviceId().then(function(deviceId){return appStorage.setItem(key,deviceId),deviceId})}function getDeviceName(){var deviceName;return deviceName=browser.tizen?"Samsung Smart TV":browser.web0S?"LG Smart TV":browser.operaTv?"Opera TV":browser.xboxOne?"Xbox One":browser.ps4?"Sony PS4":browser.chrome?"Chrome":browser.edge?"Edge":browser.firefox?"Firefox":browser.msie?"Internet Explorer":"Web Browser",browser.version&&(deviceName+=" "+browser.version),browser.ipad?deviceName+=" Ipad":browser.iphone?deviceName+=" Iphone":browser.android&&(deviceName+=" Android"),deviceName}function supportsVoiceInput(){return!browser.tv&&(window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.oSpeechRecognition||window.msSpeechRecognition)}function supportsFullscreen(){if(browser.tv)return!1;var element=document.documentElement;return element.requestFullscreen||element.mozRequestFullScreen||element.webkitRequestFullscreen||element.msRequestFullscreen}function getSyncProfile(){return new Promise(function(resolve,reject){require(["browserdeviceprofile","qualityoptions","appSettings"],function(profileBuilder,qualityoptions,appSettings){var profile=profileBuilder();profile.MaxStaticMusicBitrate=appSettings.maxStaticMusicBitrate(),resolve(profile)})})}var appInfo,supportedFeatures=function(){var features=["filedownload","sharing","externalpremium"];return browser.operaTv||browser.tizen||browser.web0s?features.push("exit"):features.push("exitmenu"),browser.operaTv||features.push("externallinks"),supportsVoiceInput()&&features.push("voiceinput"),browser.mobile&&!browser.edgeUwp||(features.push("htmlaudioautoplay"),features.push("htmlvideoautoplay")),window.SyncRegistered,supportsFullscreen()&&features.push("fullscreenchange"),(browser.chrome||browser.edge&&!browser.slow)&&features.push("imageanalysis"),Dashboard.isConnectMode()&&features.push("multiserver"),(browser.tv||browser.xboxOne||browser.ps4||browser.mobile)&&features.push("physicalvolumecontrol"),browser.tv||browser.xboxOne||browser.ps4||features.push("remotecontrol"),features}(),version=window.dashboardVersion||"3.0";return{getWindowState:function(){return document.windowState||"Normal"},setWindowState:function(state){alert("setWindowState is not supported and should not be called")},exit:function(){if(browser.tizen)try{tizen.application.getCurrentApplication().exit()}catch(err){console.log("error closing application: "+err)}else window.close()},supports:function(command){return supportedFeatures.indexOf(command.toLowerCase())!=-1},unlockedFeatures:function(){var features=[];return features.push("playback"),features.push("livetv"),features},appInfo:function(){return appInfo?Promise.resolve(appInfo):getDeviceId().then(function(deviceId){return appInfo={deviceId:deviceId,deviceName:getDeviceName(),appName:"Emby Mobile",appVersion:version}})},capabilities:getCapabilities,preferVisualCards:browser.android||browser.chrome,moreIcon:browser.safari||browser.edge?"dots-horiz":"dots-vert",getSyncProfile:getSyncProfile}});
|
Loading…
Add table
Add a link
Reference in a new issue