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:
parent
cb9f250d32
commit
c51d005a4d
2 changed files with 106 additions and 98 deletions
|
@ -108,110 +108,118 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAppVisible() {
|
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() {
|
function onAppHidden() {
|
||||||
_isHidden || (_isHidden = !0, console.log("app is hidden"))
|
isHidden || (isHidden = true, console.log("app is hidden"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var htmlMediaAutoplayAppStorageKey = "supportshtmlmediaautoplay0";
|
var htmlMediaAutoplayAppStorageKey = "supportshtmlmediaautoplay0";
|
||||||
supportedFeatures = function() {
|
var supportedFeatures = function() {
|
||||||
var features = [];
|
var features = [];
|
||||||
navigator.share && features.push("sharing");
|
navigator.share && features.push("sharing");
|
||||||
browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload");
|
browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload");
|
||||||
browser.operaTv || browser.tizen || browser.orsay || browser.web0s
|
browser.operaTv || browser.tizen || browser.orsay || browser.web0s
|
||||||
? features.push("exit")
|
? features.push("exit")
|
||||||
: (features.push("exitmenu"), features.push("plugins"));
|
: (features.push("exitmenu"), features.push("plugins"));
|
||||||
browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.ps4 || (features.push("externallinks"), features.push("externalpremium"));
|
browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.ps4 || (features.push("externallinks"), features.push("externalpremium"));
|
||||||
browser.operaTv || features.push("externallinkdisplay");
|
browser.operaTv || features.push("externallinkdisplay");
|
||||||
supportsVoiceInput() && features.push("voiceinput");
|
supportsVoiceInput() && features.push("voiceinput");
|
||||||
!browser.tv && !browser.xboxOne && browser.ps4, supportsHtmlMediaAutoplay() && (features.push("htmlaudioautoplay"), features.push("htmlvideoautoplay"));
|
!browser.tv && !browser.xboxOne && browser.ps4, supportsHtmlMediaAutoplay() && (features.push("htmlaudioautoplay"), features.push("htmlvideoautoplay"));
|
||||||
browser.edgeUwp && features.push("sync");
|
browser.edgeUwp && features.push("sync");
|
||||||
supportsFullscreen() && features.push("fullscreenchange");
|
supportsFullscreen() && features.push("fullscreenchange");
|
||||||
(browser.chrome || browser.edge && !browser.slow) && (browser.noAnimation || browser.edgeUwp || browser.xboxOne || features.push("imageanalysis"));
|
(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 || browser.mobile) && features.push("physicalvolumecontrol");
|
||||||
browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol");
|
browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol");
|
||||||
browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo");
|
browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo");
|
||||||
features.push("otherapppromotions");
|
features.push("otherapppromotions");
|
||||||
features.push("targetblank");
|
features.push("targetblank");
|
||||||
browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings");
|
browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings");
|
||||||
browser.orsay || browser.tizen || features.push("subtitleburnsettings");
|
browser.orsay || browser.tizen || features.push("subtitleburnsettings");
|
||||||
browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput");
|
browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput");
|
||||||
browser.chrome && features.push("chromecast");
|
browser.chrome && features.push("chromecast");
|
||||||
return features;
|
return features;
|
||||||
}();
|
}();
|
||||||
if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) {
|
if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) {
|
||||||
require(["autoPlayDetect"], function(autoPlayDetect) {
|
require(["autoPlayDetect"], function(autoPlayDetect) {
|
||||||
autoPlayDetect.supportsHtmlMediaAutoplay().then(function() {
|
autoPlayDetect.supportsHtmlMediaAutoplay().then(function() {
|
||||||
appSettings.set(htmlMediaAutoplayAppStorageKey, "true");
|
appSettings.set(htmlMediaAutoplayAppStorageKey, "true");
|
||||||
supportedFeatures.push("htmlvideoautoplay");
|
supportedFeatures.push("htmlvideoautoplay");
|
||||||
supportedFeatures.push("htmlaudioautoplay");
|
supportedFeatures.push("htmlaudioautoplay");
|
||||||
}, function() {
|
}, function() {
|
||||||
appSettings.set(htmlMediaAutoplayAppStorageKey, "false");
|
appSettings.set(htmlMediaAutoplayAppStorageKey, "false");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var deviceId, deviceName, visibilityChange, visibilityState, appVersion = window.dashboardVersion || "3.0",
|
|
||||||
appHost = {
|
var deviceId;
|
||||||
getWindowState: function() {
|
var deviceName;
|
||||||
return document.windowState || "Normal"
|
var visibilityChange;
|
||||||
},
|
var visibilityState;
|
||||||
setWindowState: function(state) {
|
var appVersion = window.dashboardVersion || "3.0";
|
||||||
alert("setWindowState is not supported and should not be called")
|
var appHost = {
|
||||||
},
|
getWindowState: function() {
|
||||||
exit: function() {
|
return document.windowState || "Normal"
|
||||||
if (browser.tizen) try {
|
},
|
||||||
tizen.application.getCurrentApplication().exit()
|
setWindowState: function(state) {
|
||||||
} catch (err) {
|
alert("setWindowState is not supported and should not be called")
|
||||||
console.log("error closing application: " + err)
|
},
|
||||||
} else window.close()
|
exit: function() {
|
||||||
},
|
if (browser.tizen) try {
|
||||||
supports: function(command) {
|
tizen.application.getCurrentApplication().exit()
|
||||||
return -1 !== supportedFeatures.indexOf(command.toLowerCase())
|
} catch (err) {
|
||||||
},
|
console.log("error closing application: " + err)
|
||||||
preferVisualCards: browser.android || browser.chrome,
|
} else window.close()
|
||||||
moreIcon: browser.android ? "dots-vert" : "dots-horiz",
|
},
|
||||||
getSyncProfile: getSyncProfile,
|
supports: function(command) {
|
||||||
getDefaultLayout: getDefaultLayout,
|
return -1 !== supportedFeatures.indexOf(command.toLowerCase())
|
||||||
getDeviceProfile: getDeviceProfile,
|
},
|
||||||
init: function() {
|
preferVisualCards: browser.android || browser.chrome,
|
||||||
return deviceName = getDeviceName(), getDeviceId().then(function(resolvedDeviceId) {
|
moreIcon: browser.android ? "dots-vert" : "dots-horiz",
|
||||||
deviceId = resolvedDeviceId
|
getSyncProfile: getSyncProfile,
|
||||||
})
|
getDefaultLayout: getDefaultLayout,
|
||||||
},
|
getDeviceProfile: getDeviceProfile,
|
||||||
deviceName: function() {
|
init: function() {
|
||||||
return deviceName
|
return deviceName = getDeviceName(), getDeviceId().then(function(resolvedDeviceId) {
|
||||||
},
|
deviceId = resolvedDeviceId
|
||||||
deviceId: function() {
|
})
|
||||||
return deviceId
|
},
|
||||||
},
|
deviceName: function() {
|
||||||
appName: function() {
|
return deviceName
|
||||||
return "Jellyfin Web"
|
},
|
||||||
},
|
deviceId: function() {
|
||||||
appVersion: function() {
|
return deviceId
|
||||||
return appVersion
|
},
|
||||||
},
|
appName: function() {
|
||||||
getPushTokenInfo: function() {
|
return "Jellyfin Web"
|
||||||
return {}
|
},
|
||||||
},
|
appVersion: function() {
|
||||||
setThemeColor: function(color) {
|
return appVersion
|
||||||
var metaThemeColor = document.querySelector("meta[name=theme-color]");
|
},
|
||||||
metaThemeColor && metaThemeColor.setAttribute("content", color)
|
getPushTokenInfo: function() {
|
||||||
},
|
return {}
|
||||||
setUserScalable: function(scalable) {
|
},
|
||||||
if (!browser.tv) {
|
setThemeColor: function(color) {
|
||||||
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";
|
var metaThemeColor = document.querySelector("meta[name=theme-color]");
|
||||||
document.querySelector("meta[name=viewport]").setAttribute("content", att)
|
metaThemeColor && metaThemeColor.setAttribute("content", color)
|
||||||
}
|
},
|
||||||
},
|
setUserScalable: function(scalable) {
|
||||||
deviceIconUrl: function() {
|
if (!browser.tv) {
|
||||||
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 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"));
|
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;
|
var isHidden = false;
|
||||||
return doc && doc.addEventListener(visibilityChange, function() {
|
doc && doc.addEventListener(visibilityChange, function() {
|
||||||
document[visibilityState] ? onAppHidden() : onAppVisible()
|
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;
|
||||||
});
|
});
|
||||||
|
|
|
@ -919,7 +919,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
|
||||||
html += '<button is="paper-icon-button-light" class="headerButton headerButtonRight headerUserButton hide"><i class="md-icon"></i></button>';
|
html += '<button is="paper-icon-button-light" class="headerButton headerButtonRight headerUserButton hide"><i class="md-icon"></i></button>';
|
||||||
|
|
||||||
if (!layoutManager.mobile) {
|
if (!layoutManager.mobile) {
|
||||||
html += '<button is="paper-icon-button-light" class="headerButton headerButtonRight headerSettingsButton hide"><i class="md-icon"></i></button>';
|
html += '<button is="paper-icon-button-light" class="headerButton headerButtonRight headerSettingsButton hide"><i class="md-icon">dashboard</i></button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue