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

more deminification and update dashboard button on header

This commit is contained in:
dkanada 2019-01-22 02:33:17 +09:00
parent cb9f250d32
commit c51d005a4d
2 changed files with 106 additions and 98 deletions

View file

@ -108,110 +108,118 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett
}
function onAppVisible() {
_isHidden && (_isHidden = !1, console.log("triggering app resume event"), events.trigger(appHost, "resume"))
isHidden && (isHidden = false, console.log("triggering app resume event"), events.trigger(appHost, "resume"));
}
function onAppHidden() {
_isHidden || (_isHidden = !0, console.log("app is hidden"))
isHidden || (isHidden = true, console.log("app is hidden"));
}
var htmlMediaAutoplayAppStorageKey = "supportshtmlmediaautoplay0";
supportedFeatures = function() {
var features = [];
navigator.share && features.push("sharing");
browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload");
browser.operaTv || browser.tizen || browser.orsay || browser.web0s
? features.push("exit")
: (features.push("exitmenu"), features.push("plugins"));
browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.ps4 || (features.push("externallinks"), features.push("externalpremium"));
browser.operaTv || features.push("externallinkdisplay");
supportsVoiceInput() && features.push("voiceinput");
!browser.tv && !browser.xboxOne && browser.ps4, supportsHtmlMediaAutoplay() && (features.push("htmlaudioautoplay"), features.push("htmlvideoautoplay"));
browser.edgeUwp && features.push("sync");
supportsFullscreen() && features.push("fullscreenchange");
(browser.chrome || browser.edge && !browser.slow) && (browser.noAnimation || browser.edgeUwp || browser.xboxOne || features.push("imageanalysis"));
(browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) && features.push("physicalvolumecontrol");
browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol");
browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo");
features.push("otherapppromotions");
features.push("targetblank");
browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings");
browser.orsay || browser.tizen || features.push("subtitleburnsettings");
browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput");
browser.chrome && features.push("chromecast");
return features;
}();
if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) {
require(["autoPlayDetect"], function(autoPlayDetect) {
autoPlayDetect.supportsHtmlMediaAutoplay().then(function() {
appSettings.set(htmlMediaAutoplayAppStorageKey, "true");
supportedFeatures.push("htmlvideoautoplay");
supportedFeatures.push("htmlaudioautoplay");
}, function() {
appSettings.set(htmlMediaAutoplayAppStorageKey, "false");
});
}
});
var deviceId, deviceName, visibilityChange, visibilityState, appVersion = window.dashboardVersion || "3.0",
appHost = {
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 -1 !== supportedFeatures.indexOf(command.toLowerCase())
},
preferVisualCards: browser.android || browser.chrome,
moreIcon: browser.android ? "dots-vert" : "dots-horiz",
getSyncProfile: getSyncProfile,
getDefaultLayout: getDefaultLayout,
getDeviceProfile: getDeviceProfile,
init: function() {
return deviceName = getDeviceName(), getDeviceId().then(function(resolvedDeviceId) {
deviceId = resolvedDeviceId
})
},
deviceName: function() {
return deviceName
},
deviceId: function() {
return deviceId
},
appName: function() {
return "Jellyfin Web"
},
appVersion: function() {
return appVersion
},
getPushTokenInfo: function() {
return {}
},
setThemeColor: function(color) {
var metaThemeColor = document.querySelector("meta[name=theme-color]");
metaThemeColor && metaThemeColor.setAttribute("content", color)
},
setUserScalable: function(scalable) {
if (!browser.tv) {
var att = scalable ? "width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes" : "width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no";
document.querySelector("meta[name=viewport]").setAttribute("content", att)
}
},
deviceIconUrl: function() {
return browser.edgeUwp, browser.edgeUwp ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/windowsrt.png" : browser.opera || browser.operaTv ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/opera.png" : browser.orsay || browser.tizen ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/samsungtv.png" : browser.web0s ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/lgtv.png" : browser.ps4 ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/ps4.png" : browser.chromecast ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chromecast.png" : browser.chrome ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chrome.png" : browser.edge ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/edge.png" : browser.firefox ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/firefox.png" : browser.msie ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/internetexplorer.png" : browser.safari ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/safari.png" : "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/html5.png"
var supportedFeatures = function() {
var features = [];
navigator.share && features.push("sharing");
browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload");
browser.operaTv || browser.tizen || browser.orsay || browser.web0s
? features.push("exit")
: (features.push("exitmenu"), features.push("plugins"));
browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.ps4 || (features.push("externallinks"), features.push("externalpremium"));
browser.operaTv || features.push("externallinkdisplay");
supportsVoiceInput() && features.push("voiceinput");
!browser.tv && !browser.xboxOne && browser.ps4, supportsHtmlMediaAutoplay() && (features.push("htmlaudioautoplay"), features.push("htmlvideoautoplay"));
browser.edgeUwp && features.push("sync");
supportsFullscreen() && features.push("fullscreenchange");
(browser.chrome || browser.edge && !browser.slow) && (browser.noAnimation || browser.edgeUwp || browser.xboxOne || features.push("imageanalysis"));
(browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) && features.push("physicalvolumecontrol");
browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol");
browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo");
features.push("otherapppromotions");
features.push("targetblank");
browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings");
browser.orsay || browser.tizen || features.push("subtitleburnsettings");
browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput");
browser.chrome && features.push("chromecast");
return features;
}();
if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) {
require(["autoPlayDetect"], function(autoPlayDetect) {
autoPlayDetect.supportsHtmlMediaAutoplay().then(function() {
appSettings.set(htmlMediaAutoplayAppStorageKey, "true");
supportedFeatures.push("htmlvideoautoplay");
supportedFeatures.push("htmlaudioautoplay");
}, function() {
appSettings.set(htmlMediaAutoplayAppStorageKey, "false");
});
}
});
var deviceId;
var deviceName;
var visibilityChange;
var visibilityState;
var appVersion = window.dashboardVersion || "3.0";
var appHost = {
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 -1 !== supportedFeatures.indexOf(command.toLowerCase())
},
preferVisualCards: browser.android || browser.chrome,
moreIcon: browser.android ? "dots-vert" : "dots-horiz",
getSyncProfile: getSyncProfile,
getDefaultLayout: getDefaultLayout,
getDeviceProfile: getDeviceProfile,
init: function() {
return deviceName = getDeviceName(), getDeviceId().then(function(resolvedDeviceId) {
deviceId = resolvedDeviceId
})
},
deviceName: function() {
return deviceName
},
deviceId: function() {
return deviceId
},
appName: function() {
return "Jellyfin Web"
},
appVersion: function() {
return appVersion
},
getPushTokenInfo: function() {
return {}
},
setThemeColor: function(color) {
var metaThemeColor = document.querySelector("meta[name=theme-color]");
metaThemeColor && metaThemeColor.setAttribute("content", color)
},
setUserScalable: function(scalable) {
if (!browser.tv) {
var att = scalable ? "width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes" : "width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no";
document.querySelector("meta[name=viewport]").setAttribute("content", att)
}
},
doc = self.document;
deviceIconUrl: function() {
return browser.edgeUwp, browser.edgeUwp ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/windowsrt.png" : browser.opera || browser.operaTv ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/opera.png" : browser.orsay || browser.tizen ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/samsungtv.png" : browser.web0s ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/lgtv.png" : browser.ps4 ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/ps4.png" : browser.chromecast ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chromecast.png" : browser.chrome ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chrome.png" : browser.edge ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/edge.png" : browser.firefox ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/firefox.png" : browser.msie ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/internetexplorer.png" : browser.safari ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/safari.png" : "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/html5.png"
}
};
var doc = self.document;
doc && (void 0 !== doc.visibilityState ? (visibilityChange = "visibilitychange", visibilityState = "hidden") : void 0 !== doc.mozHidden ? (visibilityChange = "mozvisibilitychange", visibilityState = "mozVisibilityState") : void 0 !== doc.msHidden ? (visibilityChange = "msvisibilitychange", visibilityState = "msVisibilityState") : void 0 !== doc.webkitHidden && (visibilityChange = "webkitvisibilitychange", visibilityState = "webkitVisibilityState"));
var _isHidden = !1;
return doc && doc.addEventListener(visibilityChange, function() {
var isHidden = false;
doc && doc.addEventListener(visibilityChange, function() {
document[visibilityState] ? onAppHidden() : onAppVisible()
}), self.addEventListener && (self.addEventListener("focus", onAppVisible), self.addEventListener("blur", onAppHidden)), appHost
}), self.addEventListener && (self.addEventListener("focus", onAppVisible), self.addEventListener("blur", onAppHidden));
return appHost;
});