diff --git a/src/components/apphost.js b/src/components/apphost.js
index 718d8f7db1..9f61e83c0a 100644
--- a/src/components/apphost.js
+++ b/src/components/apphost.js
@@ -275,7 +275,8 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
features.push("displaylanguage");
features.push("otherapppromotions");
features.push("displaymode");
- features.push("targetblank"); // allows users to connect to more than one server
+ features.push("targetblank");
+ // allows users to connect to more than one server
//features.push("multiserver");
if (!browser.orsay && !browser.tizen && !browser.msie && (browser.firefox || browser.ps4 || browser.edge || cueSupported())) {
@@ -311,9 +312,11 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
var deviceId;
var deviceName;
+ var appName = "Jellyfin Web";
+ var appVersion = "10.3.6";
var visibilityChange;
var visibilityState;
- var appVersion = window.dashboardVersion || "3.0";
+
var appHost = {
getWindowState: function () {
return document.windowState || "Normal";
@@ -358,9 +361,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
}
deviceName = getDeviceName();
- return getDeviceId().then(function (resolvedDeviceId) {
- deviceId = resolvedDeviceId;
- });
+ deviceId = getDeviceId();
},
deviceName: function () {
return window.NativeShell ? window.NativeShell.AppHost.deviceName() : deviceName;
@@ -369,7 +370,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
return window.NativeShell ? window.NativeShell.AppHost.deviceId() : deviceId;
},
appName: function () {
- return window.NativeShell ? window.NativeShell.AppHost.appName() : "Jellyfin Web";
+ return window.NativeShell ? window.NativeShell.AppHost.appName() : appName;
},
appVersion: function () {
return window.NativeShell ? window.NativeShell.AppHost.appVersion() : appVersion;
@@ -389,53 +390,6 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
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 () {
- if (browser.edgeUwp) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/windowsrt.png";
- }
-
- if (browser.opera || browser.operaTv) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/opera.png";
- }
-
- if (browser.orsay || browser.tizen) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/samsungtv.png";
- }
-
- if (browser.web0s) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/lgtv.png";
- }
-
- if (browser.ps4) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/ps4.png";
- }
-
- if (browser.chromecast) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chromecast.png";
- }
-
- if (browser.chrome) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chrome.png";
- }
-
- if (browser.edge) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/edge.png";
- }
-
- if (browser.firefox) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/firefox.png";
- }
-
- if (browser.msie) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/internetexplorer.png";
- }
-
- if (browser.safari) {
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/safari.png";
- }
-
- return "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/html5.png";
}
};
var doc = self.document;
diff --git a/src/components/cardbuilder/cardBuilder.js b/src/components/cardbuilder/cardBuilder.js
index 1faacff764..0344300d39 100644
--- a/src/components/cardbuilder/cardBuilder.js
+++ b/src/components/cardbuilder/cardBuilder.js
@@ -1,5 +1,5 @@
-define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusManager', 'indicators', 'globalize', 'layoutManager', 'apphost', 'dom', 'browser', 'playbackManager', 'itemShortcuts', 'css!./card', 'paper-icon-button-light', 'programStyles'],
- function (datetime, imageLoader, connectionManager, itemHelper, focusManager, indicators, globalize, layoutManager, appHost, dom, browser, playbackManager, itemShortcuts) {
+define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusManager', 'indicators', 'globalize', 'layoutManager', 'apphost', 'dom', 'browser', 'playbackManager', 'itemShortcuts', 'scripts/imagehelper', 'css!./card', 'paper-icon-button-light', 'programStyles'],
+ function (datetime, imageLoader, connectionManager, itemHelper, focusManager, indicators, globalize, layoutManager, appHost, dom, browser, playbackManager, itemShortcuts, imageHelper) {
'use strict';
var devicePixelRatio = window.devicePixelRatio || 1;
@@ -1546,28 +1546,8 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana
}
function getCardDefaultText(item, options) {
-
- var collectionType = item.CollectionType;
- if (collectionType === 'livetv') {
- return '';
- }
- if (collectionType === 'movies') {
- return '';
- }
- if (collectionType === 'tvshows') {
- return '';
- }
- if (collectionType === 'homevideos' || collectionType === 'photos') {
- return '';
- }
- if (collectionType === 'music') {
- return '';
- }
- if (collectionType === 'musicvideos') {
- return '';
- }
- if (collectionType === 'books') {
- return '';
+ if (item.CollectionType) {
+ return '' + imageHelper.getLibraryIcon(item.CollectionType) + ''
}
if (item.Type === 'MusicAlbum') {
return '';
diff --git a/src/components/homesections/homesections.js b/src/components/homesections/homesections.js
index 141a558cd6..cf1456a12a 100644
--- a/src/components/homesections/homesections.js
+++ b/src/components/homesections/homesections.js
@@ -1,4 +1,4 @@
-define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'layoutManager', 'imageLoader', 'globalize', 'itemShortcuts', 'itemHelper', 'appRouter', 'paper-icon-button-light', 'emby-itemscontainer', 'emby-scroller', 'emby-button', 'css!./homesections'], function (connectionManager, cardBuilder, appSettings, dom, appHost, layoutManager, imageLoader, globalize, itemShortcuts, itemHelper, appRouter) {
+define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'layoutManager', 'imageLoader', 'globalize', 'itemShortcuts', 'itemHelper', 'appRouter', 'scripts/imagehelper','paper-icon-button-light', 'emby-itemscontainer', 'emby-scroller', 'emby-button', 'css!./homesections'], function (connectionManager, cardBuilder, appSettings, dom, appHost, layoutManager, imageLoader, globalize, itemShortcuts, itemHelper, appRouter, imageHelper) {
'use strict';
function getDefaultSection(index) {
@@ -156,49 +156,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
html += '
';
- // "My Library" backgrounds
+ // library card background images
for (var i = 0, length = items.length; i < length; i++) {
var item = items[i];
- var icon;
- switch (item.CollectionType) {
- case "movies":
- icon = "video_library";
- break;
- case "music":
- icon = "library_music";
- break;
- case "photos":
- icon = "photo_library";
- break;
- case "livetv":
- icon = "live_tv";
- break;
- case "tvshows":
- icon = "tv";
- break;
- case "trailers":
- icon = "local_movies";
- break;
- case "homevideos":
- icon = "photo_library";
- break;
- case "musicvideos":
- icon = "music_video";
- break;
- case "books":
- icon = "library_books";
- break;
- case "channels":
- icon = "videocam";
- break;
- case "playlists":
- icon = "view_list";
- break;
- default:
- icon = "folder";
- break;
- }
-
+ var icon = imageHelper.getLibraryIcon(item.CollectionType);
html += '
' + icon + '' + item.Name + '';
}
diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js
index 382b82d0ed..304eec7e08 100644
--- a/src/components/notifications/notifications.js
+++ b/src/components/notifications/notifications.js
@@ -160,9 +160,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
}
function getIconUrl(name) {
-
name = name || 'notificationicon.png';
-
return require.toUrl('.').split('?')[0] + '/' + name;
}
diff --git a/src/controllers/dashboardpage.js b/src/controllers/dashboardpage.js
index a3b11f4427..7c443e3087 100644
--- a/src/controllers/dashboardpage.js
+++ b/src/controllers/dashboardpage.js
@@ -1,4 +1,4 @@
-define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globalize", "loading", "connectionManager", "playMethodHelper", "cardBuilder", "imageLoader", "components/activitylog", "humanedate", "listViewStyle", "emby-button", "flexStyles", "emby-button", "emby-itemscontainer"], function (datetime, events, itemHelper, serverNotifications, dom, globalize, loading, connectionManager, playMethodHelper, cardBuilder, imageLoader, ActivityLog) {
+define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globalize", "loading", "connectionManager", "playMethodHelper", "cardBuilder", "imageLoader", "components/activitylog", "scripts/imagehelper", "humanedate", "listViewStyle", "emby-button", "flexStyles", "emby-button", "emby-itemscontainer"], function (datetime, events, itemHelper, serverNotifications, dom, globalize, loading, connectionManager, playMethodHelper, cardBuilder, imageLoader, ActivityLog, imageHelper) {
"use strict";
function buttonEnabled(elem, enabled) {
@@ -622,17 +622,8 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
}
},
getClientImage: function (connection) {
- var iconUrl = (connection.Client.toLowerCase(), connection.DeviceName.toLowerCase(), connection.AppIconUrl);
-
- if (iconUrl) {
- if (-1 === iconUrl.indexOf("://")) {
- iconUrl = ApiClient.getUrl(iconUrl);
- }
-
- return "

";
- }
-
- return null;
+ var iconUrl = imageHelper.getDeviceIcon(connection.DeviceName);
+ return "

";
},
getNowPlayingImageUrl: function (item) {
if (item && item.BackdropImageTags && item.BackdropImageTags.length) {
diff --git a/src/controllers/devices.js b/src/controllers/devices.js
index d85b6e9017..ef24f19172 100644
--- a/src/controllers/devices.js
+++ b/src/controllers/devices.js
@@ -1,4 +1,4 @@
-define(["loading", "dom", "libraryMenu", "globalize", "humanedate", "emby-button", "emby-itemscontainer", "cardStyle"], function(loading, dom, libraryMenu, globalize) {
+define(["loading", "dom", "libraryMenu", "globalize", "scripts/imagehelper", "humanedate", "emby-button", "emby-itemscontainer", "cardStyle"], function(loading, dom, libraryMenu, globalize, imageHelper) {
"use strict";
function canDelete(deviceId) {
@@ -57,10 +57,45 @@ define(["loading", "dom", "libraryMenu", "globalize", "humanedate", "emby-button
var html = "";
html += devices.map(function(device) {
var deviceHtml = "";
- deviceHtml += "
", deviceHtml += '
', deviceHtml += '
", deviceHtml += '", deviceHtml += "
", deviceHtml += "
"
- }).join(""), page.querySelector(".devicesList").innerHTML = html
+ deviceHtml += "
";
+ deviceHtml += '
';
+ deviceHtml += '
";
+ deviceHtml += '";
+ deviceHtml += "
";
+ deviceHtml += "
";
+ return deviceHtml;
+ }).join("");
+ page.querySelector(".devicesList").innerHTML = html;
}
function loadData(page) {
diff --git a/src/controllers/medialibrarypage.js b/src/controllers/medialibrarypage.js
index 488ff94f4c..405d38bfa7 100644
--- a/src/controllers/medialibrarypage.js
+++ b/src/controllers/medialibrarypage.js
@@ -1,4 +1,4 @@
-define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "globalize", "dom", "indicators", "cardStyle", "emby-itemrefreshindicator"], function($, appHost, taskButton, loading, libraryMenu, globalize, dom, indicators) {
+define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "globalize", "dom", "indicators", "scripts/imagehelper", "cardStyle", "emby-itemrefreshindicator"], function($, appHost, taskButton, loading, libraryMenu, globalize, dom, indicators, imageHelper) {
"use strict";
function addVirtualFolder(page) {
@@ -217,35 +217,6 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl
}]
}
- function getIcon(type) {
- switch (type) {
- case "movies":
- return "video_library";
- case "music":
- return "library_music";
- case "photos":
- return "photo_library";
- case "livetv":
- return "live_tv";
- case "tvshows":
- return "tv";
- case "trailers":
- return "local_movies";
- case "homevideos":
- return "photo_library";
- case "musicvideos":
- return "video_library";
- case "books":
- return "library_books";
- case "channels":
- return "videocam";
- case "playlists":
- return "view_list";
- default:
- return "folder";
- }
- }
-
function getVirtualFolderHtml(page, virtualFolder, index) {
var html = "";
var style = "";
@@ -267,7 +238,7 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl
hasCardImageContainer = true;
} else if (!virtualFolder.showNameWithIcon) {
html += '
';
- html += '
' + (virtualFolder.icon || getIcon(virtualFolder.CollectionType)) + "";
+ html += '
' + (virtualFolder.icon || imageHelper.getLibraryIcon(virtualFolder.CollectionType)) + "";
hasCardImageContainer = true;
}
if (hasCardImageContainer) {
@@ -278,7 +249,7 @@ define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "gl
}
if (!imgUrl && virtualFolder.showNameWithIcon) {
html += '
';
- html += '' + (virtualFolder.icon || getIcon(virtualFolder.CollectionType)) + "";
+ html += '' + (virtualFolder.icon || imageHelper.getLibraryIcon(virtualFolder.CollectionType)) + "";
virtualFolder.showNameWithIcon && (html += '
', html += virtualFolder.Name, html += "
");
html += "";
}
diff --git a/src/img/devices/chrome.svg b/src/img/devices/chrome.svg
new file mode 100644
index 0000000000..fab308dc20
--- /dev/null
+++ b/src/img/devices/chrome.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/edge.svg b/src/img/devices/edge.svg
new file mode 100644
index 0000000000..8a552924d7
--- /dev/null
+++ b/src/img/devices/edge.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/firefox.svg b/src/img/devices/firefox.svg
new file mode 100644
index 0000000000..f6087e5e8c
--- /dev/null
+++ b/src/img/devices/firefox.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/html5.svg b/src/img/devices/html5.svg
new file mode 100644
index 0000000000..63704799cb
--- /dev/null
+++ b/src/img/devices/html5.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/msie.svg b/src/img/devices/msie.svg
new file mode 100644
index 0000000000..f5b362d7c1
--- /dev/null
+++ b/src/img/devices/msie.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/opera.svg b/src/img/devices/opera.svg
new file mode 100644
index 0000000000..dd57f924a9
--- /dev/null
+++ b/src/img/devices/opera.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/other.svg b/src/img/devices/other.svg
new file mode 100644
index 0000000000..b588696794
--- /dev/null
+++ b/src/img/devices/other.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/playstation.svg b/src/img/devices/playstation.svg
new file mode 100644
index 0000000000..c6595340eb
--- /dev/null
+++ b/src/img/devices/playstation.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/safari.svg b/src/img/devices/safari.svg
new file mode 100644
index 0000000000..12abbb95fd
--- /dev/null
+++ b/src/img/devices/safari.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/samsungtv.svg b/src/img/devices/samsungtv.svg
new file mode 100644
index 0000000000..afdd19e24e
--- /dev/null
+++ b/src/img/devices/samsungtv.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/windows.svg b/src/img/devices/windows.svg
new file mode 100644
index 0000000000..531e72e1d1
--- /dev/null
+++ b/src/img/devices/windows.svg
@@ -0,0 +1 @@
+
diff --git a/src/img/devices/xbox.svg b/src/img/devices/xbox.svg
new file mode 100644
index 0000000000..640dd34a5b
--- /dev/null
+++ b/src/img/devices/xbox.svg
@@ -0,0 +1 @@
+
diff --git a/src/scripts/imagehelper.js b/src/scripts/imagehelper.js
new file mode 100644
index 0000000000..486a030a54
--- /dev/null
+++ b/src/scripts/imagehelper.js
@@ -0,0 +1,64 @@
+define(["browser"], function (browser) {
+ "use strict";
+
+ function getDeviceIcon(device) {
+ var baseUrl = "img/devices/";
+ switch (device) {
+ case "Opera":
+ case "Opera TV":
+ return baseUrl + "opera.svg";
+ case "Samsung Smart TV":
+ return baseUrl + "samsung.svg";
+ case "Xbox One":
+ return baseUrl + "xbox.svg";
+ case "Sony PS4":
+ return baseUrl + "playstation.svg";
+ case "Chrome":
+ return baseUrl + "chrome.svg";
+ case "Firefox":
+ return baseUrl + "firefox.svg";
+ case "Edge":
+ return baseUrl + "edge.svg";
+ case "Internet Explorer":
+ return baseUrl + "msie.svg";
+ case "Web Browser":
+ return baseUrl + "html5.svg";
+ default:
+ return baseUrl + "other.svg";
+ }
+ }
+
+ function getLibraryIcon(library) {
+ switch (library) {
+ case "movies":
+ return "video_library";
+ case "music":
+ return "library_music";
+ case "photos":
+ return "photo_library";
+ case "livetv":
+ return "live_tv";
+ case "tvshows":
+ return "tv";
+ case "trailers":
+ return "local_movies";
+ case "homevideos":
+ return "photo_library";
+ case "musicvideos":
+ return "music_video";
+ case "books":
+ return "library_books";
+ case "channels":
+ return "videocam";
+ case "playlists":
+ return "view_list";
+ default:
+ return "folder";
+ }
+ }
+
+ return {
+ getDeviceIcon: getDeviceIcon,
+ getLibraryIcon: getLibraryIcon
+ };
+});
\ No newline at end of file
diff --git a/src/scripts/librarymenu.js b/src/scripts/librarymenu.js
index 59275c218c..89f672ca02 100644
--- a/src/scripts/librarymenu.js
+++ b/src/scripts/librarymenu.js
@@ -1,4 +1,4 @@
-define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "viewManager", "libraryBrowser", "appRouter", "apphost", "playbackManager", "browser", "globalize", "paper-icon-button-light", "material-icons", "scrollStyles", "flexStyles"], function (dom, layoutManager, inputManager, connectionManager, events, viewManager, libraryBrowser, appRouter, appHost, playbackManager, browser, globalize) {
+define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "viewManager", "libraryBrowser", "appRouter", "apphost", "playbackManager", "browser", "globalize", "scripts/imagehelper", "paper-icon-button-light", "material-icons", "scrollStyles", "flexStyles"], function (dom, layoutManager, inputManager, connectionManager, events, viewManager, libraryBrowser, appRouter, appHost, playbackManager, browser, globalize, imageHelper) {
"use strict";
function getCurrentApiClient() {
@@ -532,48 +532,11 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
html += globalize.translate("HeaderMedia");
html += "";
html += items.map(function (i) {
- var icon = "folder";
+ var icon = i.icon || imageHelper.getLibraryIcon(i.CollectionType);
var itemId = i.Id;
-
- if ("channels" === i.CollectionType) {
- itemId = "channels";
- }
- else if ("livetv" === i.CollectionType) {
- itemId = "livetv";
- }
- else if ("music" === i.CollectionType) {
- icon = "library_music";
- }
- else if ("musicvideos" === i.CollectionType) {
- icon = "music_video";
- }
- else if ("books" === i.CollectionType) {
- icon = "library_books";
- }
- else if ("playlists" === i.CollectionType) {
- icon = "view_list";
- }
- else if ("movies" === i.CollectionType) {
- icon = "video_library";
- }
- else if ("homevideos" === i.CollectionType || "photos" === i.CollectionType) {
- icon = "photo_library";
- }
- else if ("channels" === i.CollectionType || "Channel" === i.Type) {
- icon = "videocam";
- }
- else if ("tvshows" === i.CollectionType) {
- icon = "tv";
- }
- else if ("livetv" === i.CollectionType) {
- icon = "live_tv";
- }
- icon = i.icon || icon;
-
if (i.onclick) {
i.onclick;
}
-
return '";
}).join("");
libraryMenuOptions.innerHTML = html;
diff --git a/src/scripts/site.js b/src/scripts/site.js
index 2bcd8615e8..d41f14122b 100644
--- a/src/scripts/site.js
+++ b/src/scripts/site.js
@@ -213,17 +213,14 @@ var Dashboard = {
}
},
capabilities: function (appHost) {
- var caps = {
+ var capabilities = {
PlayableMediaTypes: ["Audio", "Video"],
SupportedCommands: ["MoveUp", "MoveDown", "MoveLeft", "MoveRight", "PageUp", "PageDown", "PreviousLetter", "NextLetter", "ToggleOsd", "ToggleContextMenu", "Select", "Back", "SendKey", "SendString", "GoHome", "GoToSettings", "VolumeUp", "VolumeDown", "Mute", "Unmute", "ToggleMute", "SetVolume", "SetAudioStreamIndex", "SetSubtitleStreamIndex", "DisplayContent", "GoToSearch", "DisplayMessage", "SetRepeatMode", "ChannelUp", "ChannelDown", "PlayMediaSource", "PlayTrailers"],
SupportsPersistentIdentifier: "cordova" === self.appMode || "android" === self.appMode,
SupportsMediaControl: true
};
- caps.IconUrl = appHost.deviceIconUrl();
- caps.SupportsSync = appHost.supports("sync");
- caps.SupportsContentUploading = appHost.supports("cameraupload");
appHost.getPushTokenInfo();
- return caps = Object.assign(caps, appHost.getPushTokenInfo());
+ return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo());
}
};
var AppInfo = {};
@@ -1155,7 +1152,7 @@ var AppInfo = {};
})();
require(["css!css/site"]);
-
+
return require(["browser"], onWebComponentsReady);
}();
pageClassOn("viewshow", "standalonePage", function () {