From 47a439d7d2c8ae559a862f6e7dcee24388054ca8 Mon Sep 17 00:00:00 2001 From: dkanada Date: Sat, 11 Apr 2020 20:32:39 +0900 Subject: [PATCH 01/38] update plugin pages for new manifest properties --- src/addplugin.html | 9 +--- src/controllers/dashboard/plugins/add.js | 54 +++++-------------- .../dashboard/plugins/available.js | 11 +--- .../dashboard/plugins/installed.js | 11 +--- 4 files changed, 19 insertions(+), 66 deletions(-) diff --git a/src/addplugin.html b/src/addplugin.html index 83640033bb..30e42a2c5c 100644 --- a/src/addplugin.html +++ b/src/addplugin.html @@ -8,9 +8,8 @@ ${Help} -

-

-

+

+

@@ -28,7 +27,6 @@
${ServerRestartNeededAfterPluginInstall}
-

@@ -37,9 +35,6 @@
diff --git a/src/controllers/dashboard/plugins/add.js b/src/controllers/dashboard/plugins/add.js index a05cac461b..3b2bf9e765 100644 --- a/src/controllers/dashboard/plugins/add.js +++ b/src/controllers/dashboard/plugins/add.js @@ -7,8 +7,8 @@ define(["jQuery", "loading", "libraryMenu", "globalize", "connectionManager", "e for (var i = 0; i < length; i++) { var version = packageInfo.versions[i]; - html += '

' + version.versionStr + " (" + version.classification + ")

"; - html += '
' + version.description + "
"; + html += '

' + version.version + "

"; + html += '
' + version.changelog + "
"; } $("#revisionHistory", page).html(html); @@ -19,7 +19,7 @@ define(["jQuery", "loading", "libraryMenu", "globalize", "connectionManager", "e for (var i = 0; i < packageInfo.versions.length; i++) { var version = packageInfo.versions[i]; - html += '"; + html += '"; } var selectmenu = $("#selectVersion", page).html(html); @@ -28,16 +28,9 @@ define(["jQuery", "loading", "libraryMenu", "globalize", "connectionManager", "e $("#pCurrentVersion", page).hide().html(""); } - var packageVersion = packageInfo.versions.filter(function (current) { - return "Release" == current.classification; - })[0]; - packageVersion = packageVersion || packageInfo.versions.filter(function (current) { - return "Beta" == current.classification; - })[0]; - + var packageVersion = packageInfo.versions[0]; if (packageVersion) { - var val = packageVersion.versionStr + "|" + packageVersion.classification; - selectmenu.val(val); + selectmenu.val(packageVersion.version); } } @@ -45,44 +38,23 @@ define(["jQuery", "loading", "libraryMenu", "globalize", "connectionManager", "e var installedPlugin = installedPlugins.filter(function (ip) { return ip.Name == pkg.name; })[0]; + populateVersions(pkg, page, installedPlugin); populateHistory(pkg, page); + $(".pluginName", page).html(pkg.name); + $("#btnInstallDiv", page).removeClass("hide"); + $("#pSelectVersion", page).removeClass("hide"); - if ("Server" == pkg.targetSystem) { - $("#btnInstallDiv", page).removeClass("hide"); - $("#nonServerMsg", page).hide(); - $("#pSelectVersion", page).removeClass("hide"); + if (pkg.overview) { + $("#overview", page).show().html(pkg.overview); } else { - $("#btnInstallDiv", page).addClass("hide"); - $("#pSelectVersion", page).addClass("hide"); - var msg = globalize.translate("MessageInstallPluginFromApp"); - $("#nonServerMsg", page).html(msg).show(); + $("#overview", page).hide(); } - if (pkg.shortDescription) { - $("#tagline", page).show().html(pkg.shortDescription); - } else { - $("#tagline", page).hide(); - } - - $("#overview", page).html(pkg.overview || ""); + $("#description", page).html(pkg.description); $("#developer", page).html(pkg.owner); - if (pkg.richDescUrl) { - $("#pViewWebsite", page).show(); - $("#pViewWebsite a", page).attr("href", pkg.richDescUrl); - } else { - $("#pViewWebsite", page).hide(); - } - - if (pkg.previewImage || pkg.thumbImage) { - var img = pkg.previewImage ? pkg.previewImage : pkg.thumbImage; - $("#pPreviewImage", page).show().html(""); - } else { - $("#pPreviewImage", page).hide().html(""); - } - if (installedPlugin) { var currentVersionText = globalize.translate("MessageYouHaveVersionInstalled", "" + installedPlugin.Version + ""); $("#pCurrentVersion", page).show().html(currentVersionText); diff --git a/src/controllers/dashboard/plugins/available.js b/src/controllers/dashboard/plugins/available.js index adccfa3935..aff9b89ed5 100644 --- a/src/controllers/dashboard/plugins/available.js +++ b/src/controllers/dashboard/plugins/available.js @@ -98,21 +98,14 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-button", "emby html += '
'; html += '
'; html += '"; - - if (plugin.thumbImage) { - html += '
"; - html += "
"; - } else { - html += 'folder'; - } - + html += 'folder'; html += "
"; html += "
"; html += '
'; html += "
"; html += plugin.name; html += "
"; - var installedPlugin = plugin.isApp ? null : installedPlugins.filter(function (ip) { + var installedPlugin = installedPlugins.filter(function (ip) { return ip.Id == plugin.guid; })[0]; html += "
"; diff --git a/src/controllers/dashboard/plugins/installed.js b/src/controllers/dashboard/plugins/installed.js index c381b2409e..68a163c38c 100644 --- a/src/controllers/dashboard/plugins/installed.js +++ b/src/controllers/dashboard/plugins/installed.js @@ -42,14 +42,7 @@ define(["loading", "libraryMenu", "dom", "globalize", "cardStyle", "emby-button" html += '"; html += '
'; @@ -57,7 +50,7 @@ define(["loading", "libraryMenu", "dom", "globalize", "cardStyle", "emby-button" html += ''; html += "
"; html += "
"; - html += configPage ? configPage.DisplayName || plugin.Name : plugin.Name; + html += configPage.DisplayName || plugin.Name; html += "
"; html += "
"; html += plugin.Version; From 34aad3e338ca482e3c6db8d84408606921f7fe20 Mon Sep 17 00:00:00 2001 From: dkanada Date: Fri, 24 Apr 2020 22:58:43 +0900 Subject: [PATCH 02/38] update more route locations --- src/controllers/{ => dashboard}/apikeys.js | 0 .../{ => dashboard/devices}/device.js | 0 .../{ => dashboard/devices}/devices.js | 0 .../{ => dashboard/dlna}/dlnaprofile.js | 0 .../{ => dashboard/dlna}/dlnaprofiles.js | 0 .../{ => dashboard/dlna}/dlnasettings.js | 0 .../{ => dashboard}/encodingsettings.js | 0 .../{ => dashboard}/librarydisplay.js | 0 .../{ => dashboard}/medialibrarypage.js | 0 .../{ => dashboard}/metadataimagespage.js | 0 .../{ => dashboard}/metadatanfo.js | 0 .../{ => dashboard}/playbackconfiguration.js | 0 .../{ => dashboard}/serveractivity.js | 0 .../{ => dashboard}/streamingsettings.js | 0 src/scripts/routes.js | 119 +++++++++--------- 15 files changed, 57 insertions(+), 62 deletions(-) rename src/controllers/{ => dashboard}/apikeys.js (100%) rename src/controllers/{ => dashboard/devices}/device.js (100%) rename src/controllers/{ => dashboard/devices}/devices.js (100%) rename src/controllers/{ => dashboard/dlna}/dlnaprofile.js (100%) rename src/controllers/{ => dashboard/dlna}/dlnaprofiles.js (100%) rename src/controllers/{ => dashboard/dlna}/dlnasettings.js (100%) rename src/controllers/{ => dashboard}/encodingsettings.js (100%) rename src/controllers/{ => dashboard}/librarydisplay.js (100%) rename src/controllers/{ => dashboard}/medialibrarypage.js (100%) rename src/controllers/{ => dashboard}/metadataimagespage.js (100%) rename src/controllers/{ => dashboard}/metadatanfo.js (100%) rename src/controllers/{ => dashboard}/playbackconfiguration.js (100%) rename src/controllers/{ => dashboard}/serveractivity.js (100%) rename src/controllers/{ => dashboard}/streamingsettings.js (100%) diff --git a/src/controllers/apikeys.js b/src/controllers/dashboard/apikeys.js similarity index 100% rename from src/controllers/apikeys.js rename to src/controllers/dashboard/apikeys.js diff --git a/src/controllers/device.js b/src/controllers/dashboard/devices/device.js similarity index 100% rename from src/controllers/device.js rename to src/controllers/dashboard/devices/device.js diff --git a/src/controllers/devices.js b/src/controllers/dashboard/devices/devices.js similarity index 100% rename from src/controllers/devices.js rename to src/controllers/dashboard/devices/devices.js diff --git a/src/controllers/dlnaprofile.js b/src/controllers/dashboard/dlna/dlnaprofile.js similarity index 100% rename from src/controllers/dlnaprofile.js rename to src/controllers/dashboard/dlna/dlnaprofile.js diff --git a/src/controllers/dlnaprofiles.js b/src/controllers/dashboard/dlna/dlnaprofiles.js similarity index 100% rename from src/controllers/dlnaprofiles.js rename to src/controllers/dashboard/dlna/dlnaprofiles.js diff --git a/src/controllers/dlnasettings.js b/src/controllers/dashboard/dlna/dlnasettings.js similarity index 100% rename from src/controllers/dlnasettings.js rename to src/controllers/dashboard/dlna/dlnasettings.js diff --git a/src/controllers/encodingsettings.js b/src/controllers/dashboard/encodingsettings.js similarity index 100% rename from src/controllers/encodingsettings.js rename to src/controllers/dashboard/encodingsettings.js diff --git a/src/controllers/librarydisplay.js b/src/controllers/dashboard/librarydisplay.js similarity index 100% rename from src/controllers/librarydisplay.js rename to src/controllers/dashboard/librarydisplay.js diff --git a/src/controllers/medialibrarypage.js b/src/controllers/dashboard/medialibrarypage.js similarity index 100% rename from src/controllers/medialibrarypage.js rename to src/controllers/dashboard/medialibrarypage.js diff --git a/src/controllers/metadataimagespage.js b/src/controllers/dashboard/metadataimagespage.js similarity index 100% rename from src/controllers/metadataimagespage.js rename to src/controllers/dashboard/metadataimagespage.js diff --git a/src/controllers/metadatanfo.js b/src/controllers/dashboard/metadatanfo.js similarity index 100% rename from src/controllers/metadatanfo.js rename to src/controllers/dashboard/metadatanfo.js diff --git a/src/controllers/playbackconfiguration.js b/src/controllers/dashboard/playbackconfiguration.js similarity index 100% rename from src/controllers/playbackconfiguration.js rename to src/controllers/dashboard/playbackconfiguration.js diff --git a/src/controllers/serveractivity.js b/src/controllers/dashboard/serveractivity.js similarity index 100% rename from src/controllers/serveractivity.js rename to src/controllers/dashboard/serveractivity.js diff --git a/src/controllers/streamingsettings.js b/src/controllers/dashboard/streamingsettings.js similarity index 100% rename from src/controllers/streamingsettings.js rename to src/controllers/dashboard/streamingsettings.js diff --git a/src/scripts/routes.js b/src/scripts/routes.js index 9c3db58a7f..72c67e5b71 100644 --- a/src/scripts/routes.js +++ b/src/scripts/routes.js @@ -23,6 +23,35 @@ define([ console.debug("defining core routes"); + defineRoute({ + path: "/addserver.html", + autoFocus: false, + anonymous: true, + startup: true, + controller: "auth/addserver" + }); + defineRoute({ + path: "/selectserver.html", + autoFocus: false, + anonymous: true, + startup: true, + controller: "auth/selectserver", + type: "selectserver" + }); + defineRoute({ + path: "/forgotpassword.html", + anonymous: true, + startup: true, + controller: "auth/forgotpassword" + }); + defineRoute({ + path: "/forgotpasswordpin.html", + autoFocus: false, + anonymous: true, + startup: true, + controller: "auth/forgotpasswordpin" + }); + defineRoute({ path: "/addplugin.html", autoFocus: false, @@ -41,13 +70,6 @@ define([ transition: "fade", controller: "user/profile" }); - defineRoute({ - path: "/addserver.html", - autoFocus: false, - anonymous: true, - startup: true, - controller: "auth/addserver" - }); defineRoute({ path: "/mypreferencesdisplay.html", autoFocus: false, @@ -95,31 +117,31 @@ define([ path: "/devices.html", autoFocus: false, roles: "admin", - controller: "devices" + controller: "dashboard/devices/devices" }); defineRoute({ path: "/device.html", autoFocus: false, roles: "admin", - controller: "device" + controller: "dashboard/devices/device" }); defineRoute({ path: "/dlnaprofile.html", autoFocus: false, roles: "admin", - controller: "dlnaprofile" + controller: "dashboard/dlna/dlnaprofile" }); defineRoute({ path: "/dlnaprofiles.html", autoFocus: false, roles: "admin", - controller: "dlnaprofiles" + controller: "dashboard/dlna/dlnaprofiles" }); defineRoute({ path: "/dlnasettings.html", autoFocus: false, roles: "admin", - controller: "dlnasettings" + controller: "dashboard/dlna/dlnasettings" }); defineRoute({ path: "/edititemmetadata.html", @@ -130,20 +152,7 @@ define([ path: "/encodingsettings.html", autoFocus: false, roles: "admin", - controller: "encodingsettings" - }); - defineRoute({ - path: "/forgotpassword.html", - anonymous: true, - startup: true, - controller: "auth/forgotpassword" - }); - defineRoute({ - path: "/forgotpasswordpin.html", - autoFocus: false, - anonymous: true, - startup: true, - controller: "auth/forgotpasswordpin" + controller: "dashboard/encodingsettings" }); defineRoute({ path: "/home.html", @@ -158,11 +167,6 @@ define([ controller: "list", transition: "fade" }); - defineRoute({ - path: "/index.html", - autoFocus: false, - isDefaultRoute: true - }); defineRoute({ path: "/itemdetails.html", controller: "itemdetailpage", @@ -173,19 +177,13 @@ define([ path: "/library.html", autoFocus: false, roles: "admin", - controller: "medialibrarypage" + controller: "dashboard/medialibrarypage" }); defineRoute({ path: "/librarydisplay.html", autoFocus: false, roles: "admin", - controller: "librarydisplay" - }); - defineRoute({ - path: "/librarysettings.html", - autoFocus: false, - roles: "admin", - controller: "librarysettings" + controller: "dashboard/librarydisplay" }); defineRoute({ path: "/livetv.html", @@ -233,13 +231,13 @@ define([ path: "/metadataimages.html", autoFocus: false, roles: "admin", - controller: "metadataimagespage" + controller: "dashboard/metadataimagespage" }); defineRoute({ path: "/metadatanfo.html", autoFocus: false, roles: "admin", - controller: "metadatanfo" + controller: "dashboard/metadatanfo" }); defineRoute({ path: "/movies.html", @@ -265,20 +263,11 @@ define([ autoFocus: false, roles: "admin" }); - defineRoute({ - path: "/nowplaying.html", - controller: "playback/nowplaying", - autoFocus: false, - transition: "fade", - fullscreen: true, - supportsThemeMedia: true, - enableMediaControl: false - }); defineRoute({ path: "/playbackconfiguration.html", autoFocus: false, roles: "admin", - controller: "playbackconfiguration" + controller: "dashboard/playbackconfiguration" }); defineRoute({ path: "/availableplugins.html", @@ -308,31 +297,23 @@ define([ path: "/search.html", controller: "searchpage" }); - defineRoute({ - path: "/selectserver.html", - autoFocus: false, - anonymous: true, - startup: true, - controller: "auth/selectserver", - type: "selectserver" - }); defineRoute({ path: "/serveractivity.html", autoFocus: false, roles: "admin", - controller: "serveractivity" + controller: "dashboard/serveractivity" }); defineRoute({ path: "/apikeys.html", autoFocus: false, roles: "admin", - controller: "apikeys" + controller: "dashboard/apikeys" }); defineRoute({ path: "/streamingsettings.html", autoFocus: false, roles: "admin", - controller: "streamingsettings" + controller: "dashboard/streamingsettings" }); defineRoute({ path: "/tv.html", @@ -423,6 +404,15 @@ define([ fullscreen: true, enableMediaControl: false }); + defineRoute({ + path: "/nowplaying.html", + controller: "playback/nowplaying", + autoFocus: false, + transition: "fade", + fullscreen: true, + supportsThemeMedia: true, + enableMediaControl: false + }); defineRoute({ path: "/configurationpage", autoFocus: false, @@ -436,4 +426,9 @@ define([ isDefaultRoute: true, autoFocus: false }); + defineRoute({ + path: "/index.html", + autoFocus: false, + isDefaultRoute: true + }); }); From 1843927576e220fd79e4fa664e095438c750c4e1 Mon Sep 17 00:00:00 2001 From: dkanada Date: Fri, 24 Apr 2020 23:37:27 +0900 Subject: [PATCH 03/38] move some files to more reasonable locations --- .../polyfills/focusPreventScroll.js | 0 .../polyfills/objectassign.js | 0 .../headroom/headroom.css | 0 .../headroom/headroom.js | 0 .../navdrawer/navdrawer.css | 0 .../navdrawer/navdrawer.js | 0 .../screensavermanager.js | 0 src/{components => libraries}/scroller.js | 0 .../visibleinviewport.js | 0 .../alphanumericshortcuts.js | 0 src/{components => scripts}/dom.js | 0 src/{components => scripts}/filesystem.js | 0 .../input => scripts}/gamepadtokey.js | 0 .../input => scripts}/keyboardnavigation.js | 2 +- .../input => scripts}/mouseManager.js | 0 src/scripts/site.js | 23 ++++++++++--------- 16 files changed, 13 insertions(+), 12 deletions(-) rename src/{components => legacy}/polyfills/focusPreventScroll.js (100%) rename src/{components => legacy}/polyfills/objectassign.js (100%) rename src/{components => libraries}/headroom/headroom.css (100%) rename src/{components => libraries}/headroom/headroom.js (100%) rename src/{components => libraries}/navdrawer/navdrawer.css (100%) rename src/{components => libraries}/navdrawer/navdrawer.js (100%) rename src/{components => libraries}/screensavermanager.js (100%) rename src/{components => libraries}/scroller.js (100%) rename src/{components => libraries}/visibleinviewport.js (100%) rename src/{components/alphanumericshortcuts => scripts}/alphanumericshortcuts.js (100%) rename src/{components => scripts}/dom.js (100%) rename src/{components => scripts}/filesystem.js (100%) rename src/{components/input => scripts}/gamepadtokey.js (100%) rename src/{components/input => scripts}/keyboardnavigation.js (98%) rename src/{components/input => scripts}/mouseManager.js (100%) diff --git a/src/components/polyfills/focusPreventScroll.js b/src/legacy/polyfills/focusPreventScroll.js similarity index 100% rename from src/components/polyfills/focusPreventScroll.js rename to src/legacy/polyfills/focusPreventScroll.js diff --git a/src/components/polyfills/objectassign.js b/src/legacy/polyfills/objectassign.js similarity index 100% rename from src/components/polyfills/objectassign.js rename to src/legacy/polyfills/objectassign.js diff --git a/src/components/headroom/headroom.css b/src/libraries/headroom/headroom.css similarity index 100% rename from src/components/headroom/headroom.css rename to src/libraries/headroom/headroom.css diff --git a/src/components/headroom/headroom.js b/src/libraries/headroom/headroom.js similarity index 100% rename from src/components/headroom/headroom.js rename to src/libraries/headroom/headroom.js diff --git a/src/components/navdrawer/navdrawer.css b/src/libraries/navdrawer/navdrawer.css similarity index 100% rename from src/components/navdrawer/navdrawer.css rename to src/libraries/navdrawer/navdrawer.css diff --git a/src/components/navdrawer/navdrawer.js b/src/libraries/navdrawer/navdrawer.js similarity index 100% rename from src/components/navdrawer/navdrawer.js rename to src/libraries/navdrawer/navdrawer.js diff --git a/src/components/screensavermanager.js b/src/libraries/screensavermanager.js similarity index 100% rename from src/components/screensavermanager.js rename to src/libraries/screensavermanager.js diff --git a/src/components/scroller.js b/src/libraries/scroller.js similarity index 100% rename from src/components/scroller.js rename to src/libraries/scroller.js diff --git a/src/components/visibleinviewport.js b/src/libraries/visibleinviewport.js similarity index 100% rename from src/components/visibleinviewport.js rename to src/libraries/visibleinviewport.js diff --git a/src/components/alphanumericshortcuts/alphanumericshortcuts.js b/src/scripts/alphanumericshortcuts.js similarity index 100% rename from src/components/alphanumericshortcuts/alphanumericshortcuts.js rename to src/scripts/alphanumericshortcuts.js diff --git a/src/components/dom.js b/src/scripts/dom.js similarity index 100% rename from src/components/dom.js rename to src/scripts/dom.js diff --git a/src/components/filesystem.js b/src/scripts/filesystem.js similarity index 100% rename from src/components/filesystem.js rename to src/scripts/filesystem.js diff --git a/src/components/input/gamepadtokey.js b/src/scripts/gamepadtokey.js similarity index 100% rename from src/components/input/gamepadtokey.js rename to src/scripts/gamepadtokey.js diff --git a/src/components/input/keyboardnavigation.js b/src/scripts/keyboardnavigation.js similarity index 98% rename from src/components/input/keyboardnavigation.js rename to src/scripts/keyboardnavigation.js index 3c80063f4f..a95b750b1e 100644 --- a/src/components/input/keyboardnavigation.js +++ b/src/scripts/keyboardnavigation.js @@ -155,7 +155,7 @@ export function enable() { function attachGamepadScript(e) { console.log("Gamepad connected! Attaching gamepadtokey.js script"); window.removeEventListener("gamepadconnected", attachGamepadScript); - require(["components/input/gamepadtokey"]); + require(["scripts/gamepadtokey"]); } // No need to check for gamepads manually at load time, the eventhandler will be fired for that diff --git a/src/components/input/mouseManager.js b/src/scripts/mouseManager.js similarity index 100% rename from src/components/input/mouseManager.js rename to src/scripts/mouseManager.js diff --git a/src/scripts/site.js b/src/scripts/site.js index ffe006ccc6..46b48f926b 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -376,8 +376,9 @@ var AppInfo = {}; function initRequireWithBrowser(browser) { var bowerPath = getBowerPath(); var componentsPath = getComponentsPath(); + var scriptsPath = getScriptsPath(); - define("filesystem", [componentsPath + "/filesystem"], returnFirstDependency); + define("filesystem", [scriptsPath + "/filesystem"], returnFirstDependency); if (window.IntersectionObserver && !browser.edge) { define("lazyLoader", [componentsPath + "/lazyloader/lazyloader-intersectionobserver"], returnFirstDependency); @@ -662,7 +663,7 @@ var AppInfo = {}; medialibraryeditor: componentsPath + "/medialibraryeditor/medialibraryeditor", imageoptionseditor: componentsPath + "/imageoptionseditor/imageoptionseditor", apphost: componentsPath + "/apphost", - visibleinviewport: componentsPath + "/visibleinviewport", + visibleinviewport: bowerPath + "/visibleinviewport", qualityoptions: componentsPath + "/qualityoptions", focusManager: componentsPath + "/focusManager", itemHelper: componentsPath + "/itemhelper", @@ -766,9 +767,9 @@ var AppInfo = {}; // TODO remove these libraries // all of these have been modified so we need to fix that first - define("headroom", [componentsPath + "/headroom/headroom"], returnFirstDependency); - define("scroller", [componentsPath + "/scroller"], returnFirstDependency); - define("navdrawer", [componentsPath + "/navdrawer/navdrawer"], returnFirstDependency); + define("headroom", [bowerPath + "/headroom/headroom"], returnFirstDependency); + define("scroller", [bowerPath + "/scroller"], returnFirstDependency); + define("navdrawer", [bowerPath + "/navdrawer/navdrawer"], returnFirstDependency); define("emby-button", [elementsPath + "/emby-button/emby-button"], returnFirstDependency); define("paper-icon-button-light", [elementsPath + "/emby-button/paper-icon-button-light"], returnFirstDependency); @@ -808,7 +809,7 @@ var AppInfo = {}; define("playerSettingsMenu", [componentsPath + "/playback/playersettingsmenu"], returnFirstDependency); define("playMethodHelper", [componentsPath + "/playback/playmethodhelper"], returnFirstDependency); define("brightnessOsd", [componentsPath + "/playback/brightnessosd"], returnFirstDependency); - define("alphaNumericShortcuts", [componentsPath + "/alphanumericshortcuts/alphanumericshortcuts"], returnFirstDependency); + define("alphaNumericShortcuts", [scriptsPath + "/alphanumericshortcuts"], returnFirstDependency); define("multiSelect", [componentsPath + "/multiselect/multiselect"], returnFirstDependency); define("alphaPicker", [componentsPath + "/alphapicker/alphapicker"], returnFirstDependency); define("tabbedView", [componentsPath + "/tabbedview/tabbedview"], returnFirstDependency); @@ -830,7 +831,7 @@ var AppInfo = {}; define("itemContextMenu", [componentsPath + "/itemcontextmenu"], returnFirstDependency); define("imageEditor", [componentsPath + "/imageeditor/imageeditor"], returnFirstDependency); define("imageDownloader", [componentsPath + "/imagedownloader/imagedownloader"], returnFirstDependency); - define("dom", [componentsPath + "/dom"], returnFirstDependency); + define("dom", [scriptsPath + "/dom"], returnFirstDependency); define("playerStats", [componentsPath + "/playerstats/playerstats"], returnFirstDependency); define("searchFields", [componentsPath + "/search/searchfields"], returnFirstDependency); define("searchResults", [componentsPath + "/search/searchresults"], returnFirstDependency); @@ -860,8 +861,8 @@ var AppInfo = {}; return viewManager; }); define("slideshow", [componentsPath + "/slideshow/slideshow"], returnFirstDependency); - define("objectassign", [componentsPath + "/polyfills/objectassign"], returnFirstDependency); - define("focusPreventScroll", [componentsPath + "/polyfills/focusPreventScroll"], returnFirstDependency); + define("objectassign", ["legacy/polyfills/objectassign"], returnFirstDependency); + define("focusPreventScroll", ["legacy/polyfills/focusPreventScroll"], returnFirstDependency); define("userdataButtons", [componentsPath + "/userdatabuttons/userdatabuttons"], returnFirstDependency); define("listView", [componentsPath + "/listview/listview"], returnFirstDependency); define("indicators", [componentsPath + "/indicators/indicators"], returnFirstDependency); @@ -879,8 +880,8 @@ var AppInfo = {}; define("dialogHelper", [componentsPath + "/dialogHelper/dialogHelper"], returnFirstDependency); define("serverNotifications", [componentsPath + "/serverNotifications"], returnFirstDependency); define("skinManager", [componentsPath + "/skinManager"], returnFirstDependency); - define("keyboardnavigation", [componentsPath + "/input/keyboardnavigation"], returnFirstDependency); - define("mouseManager", [componentsPath + "/input/mouseManager"], returnFirstDependency); + define("keyboardnavigation", [scriptsPath + "/keyboardnavigation"], returnFirstDependency); + define("mouseManager", [scriptsPath + "/mouseManager"], returnFirstDependency); define("scrollManager", [componentsPath + "/scrollManager"], returnFirstDependency); define("autoFocuser", [componentsPath + "/autoFocuser"], returnFirstDependency); define("connectionManager", [], function () { From 9243301fdb15c62816b5c31ff48955747297be9b Mon Sep 17 00:00:00 2001 From: dkanada Date: Sat, 25 Apr 2020 10:43:27 +0900 Subject: [PATCH 04/38] remove object assign and headroom files --- .../{polyfills => }/focusPreventScroll.js | 0 src/legacy/polyfills/objectassign.js | 24 -- src/libraries/headroom/headroom.css | 11 - src/libraries/headroom/headroom.js | 343 ------------------ src/scripts/site.js | 6 +- 5 files changed, 1 insertion(+), 383 deletions(-) rename src/legacy/{polyfills => }/focusPreventScroll.js (100%) delete mode 100644 src/legacy/polyfills/objectassign.js delete mode 100644 src/libraries/headroom/headroom.css delete mode 100644 src/libraries/headroom/headroom.js diff --git a/src/legacy/polyfills/focusPreventScroll.js b/src/legacy/focusPreventScroll.js similarity index 100% rename from src/legacy/polyfills/focusPreventScroll.js rename to src/legacy/focusPreventScroll.js diff --git a/src/legacy/polyfills/objectassign.js b/src/legacy/polyfills/objectassign.js deleted file mode 100644 index 85f55aa144..0000000000 --- a/src/legacy/polyfills/objectassign.js +++ /dev/null @@ -1,24 +0,0 @@ -if (typeof Object.assign != 'function') { - (function () { - Object.assign = function (target) { - 'use strict'; - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - - var output = Object(target); - for (var index = 1; index < arguments.length; index++) { - var source = arguments[index]; - if (source !== undefined && source !== null) { - for (var nextKey in source) { - // eslint-disable-next-line no-prototype-builtins - if (source.hasOwnProperty(nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - } - return output; - }; - })(); -} diff --git a/src/libraries/headroom/headroom.css b/src/libraries/headroom/headroom.css deleted file mode 100644 index df985892ff..0000000000 --- a/src/libraries/headroom/headroom.css +++ /dev/null @@ -1,11 +0,0 @@ -.headroom { - transition: transform 140ms linear; -} - -.headroom--pinned { - transform: none; -} - -.headroom--unpinned:not(.headroomDisabled) { - transform: translateY(-100%); -} diff --git a/src/libraries/headroom/headroom.js b/src/libraries/headroom/headroom.js deleted file mode 100644 index 3c0ada3ce9..0000000000 --- a/src/libraries/headroom/headroom.js +++ /dev/null @@ -1,343 +0,0 @@ -/*! - * headroom.js v0.7.0 - Give your page some headroom. Hide your header until you need it - * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/headroom.js - * License: MIT - */ - -define(['dom', 'layoutManager', 'browser', 'css!./headroom'], function (dom, layoutManager, browser) { - - 'use strict'; - - /* exported features */ - - var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; - - /** - * Handles debouncing of events via requestAnimationFrame - * @see http://www.html5rocks.com/en/tutorials/speed/animations/ - * @param {Function} callback The callback to handle whichever event - */ - function Debouncer(callback) { - this.callback = callback; - this.ticking = false; - } - Debouncer.prototype = { - constructor: Debouncer, - - /** - * dispatches the event to the supplied callback - * @private - */ - update: function () { - if (this.callback) { - this.callback(); - } - this.ticking = false; - }, - - /** - * Attach this as the event listeners - */ - handleEvent: function () { - if (!this.ticking) { - requestAnimationFrame(this.rafCallback || (this.rafCallback = this.update.bind(this))); - this.ticking = true; - } - } - }; - - function onHeadroomClearedExternally() { - this.state = null; - } - - /** - * UI enhancement for fixed headers. - * Hides header when scrolling down - * Shows header when scrolling up - * @constructor - * @param {DOMElement} elem the header element - * @param {Object} options options for the widget - */ - function Headroom(elems, options) { - options = Object.assign(Headroom.options, options || {}); - - this.lastKnownScrollY = 0; - this.elems = elems; - - this.scroller = options.scroller; - - this.debouncer = onScroll.bind(this); - this.offset = options.offset; - this.initialised = false; - - this.initialClass = options.initialClass; - this.unPinnedClass = options.unPinnedClass; - this.pinnedClass = options.pinnedClass; - - this.state = 'clear'; - - this.options = { - offset: 0, - scroller: window, - initialClass: 'headroom', - unPinnedClass: 'headroom--unpinned', - pinnedClass: 'headroom--pinned' - }; - - this.add = function (elem) { - - if (browser.supportsCssAnimation()) { - elem.classList.add(this.initialClass); - elem.addEventListener('clearheadroom', onHeadroomClearedExternally.bind(this)); - this.elems.push(elem); - } - }; - - this.remove = function (elem) { - - elem.classList.remove(this.unPinnedClass); - elem.classList.remove(this.initialClass); - elem.classList.remove(this.pinnedClass); - - var i = this.elems.indexOf(elem); - if (i !== -1) { - this.elems.splice(i, 1); - } - }; - - this.pause = function () { - this.paused = true; - }; - - this.resume = function () { - this.paused = false; - }; - - /** - * Unattaches events and removes any classes that were added - */ - this.destroy = function () { - - this.initialised = false; - - for (var i = 0, length = this.elems.length; i < length; i++) { - - var classList = this.elems[i].classList; - - classList.remove(this.unPinnedClass); - classList.remove(this.initialClass); - classList.remove(this.pinnedClass); - } - - var scrollEventName = this.scroller.getScrollEventName ? this.scroller.getScrollEventName() : 'scroll'; - - dom.removeEventListener(this.scroller, scrollEventName, this.debouncer, { - capture: false, - passive: true - }); - }; - - /** - * Attaches the scroll event - * @private - */ - this.attachEvent = function () { - if (!this.initialised) { - this.lastKnownScrollY = this.getScrollY(); - this.initialised = true; - - var scrollEventName = this.scroller.getScrollEventName ? this.scroller.getScrollEventName() : 'scroll'; - - dom.addEventListener(this.scroller, scrollEventName, this.debouncer, { - capture: false, - passive: true - }); - - this.update(); - } - }; - - /** - * Unpins the header if it's currently pinned - */ - this.clear = function () { - - if (this.state === 'clear') { - return; - } - - this.state = 'clear'; - - var unpinnedClass = this.unPinnedClass; - var pinnedClass = this.pinnedClass; - - for (var i = 0, length = this.elems.length; i < length; i++) { - var classList = this.elems[i].classList; - - classList.remove(unpinnedClass); - //classList.remove(pinnedClass); - } - }; - - /** - * Unpins the header if it's currently pinned - */ - this.pin = function () { - - if (this.state === 'pin') { - return; - } - - this.state = 'pin'; - - var unpinnedClass = this.unPinnedClass; - var pinnedClass = this.pinnedClass; - - for (var i = 0, length = this.elems.length; i < length; i++) { - var classList = this.elems[i].classList; - - classList.remove(unpinnedClass); - classList.add(pinnedClass); - } - }; - - /** - * Unpins the header if it's currently pinned - */ - this.unpin = function () { - - if (this.state === 'unpin') { - return; - } - - this.state = 'unpin'; - - var unpinnedClass = this.unPinnedClass; - var pinnedClass = this.pinnedClass; - - for (var i = 0, length = this.elems.length; i < length; i++) { - var classList = this.elems[i].classList; - - classList.add(unpinnedClass); - //classList.remove(pinnedClass); - } - }; - - /** - * Gets the Y scroll position - * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY - * @return {Number} pixels the page has scrolled along the Y-axis - */ - this.getScrollY = function () { - - var scroller = this.scroller; - - if (scroller.getScrollPosition) { - return scroller.getScrollPosition(); - } - - var pageYOffset = scroller.pageYOffset; - if (pageYOffset !== undefined) { - return pageYOffset; - } - - var scrollTop = scroller.scrollTop; - if (scrollTop !== undefined) { - return scrollTop; - } - - return (document.documentElement || document.body).scrollTop; - }; - - /** - * determine if it is appropriate to unpin - * @param {int} currentScrollY the current y scroll position - * @return {bool} true if should unpin, false otherwise - */ - this.shouldUnpin = function (currentScrollY) { - var scrollingDown = currentScrollY > this.lastKnownScrollY; - var pastOffset = currentScrollY >= this.offset; - - return scrollingDown && pastOffset; - }; - - /** - * determine if it is appropriate to pin - * @param {int} currentScrollY the current y scroll position - * @return {bool} true if should pin, false otherwise - */ - this.shouldPin = function (currentScrollY) { - var scrollingUp = currentScrollY < this.lastKnownScrollY; - var pastOffset = currentScrollY <= this.offset; - - return scrollingUp || pastOffset; - }; - - /** - * Handles updating the state of the widget - */ - this.update = function () { - - if (this.paused) { - return; - } - - var currentScrollY = this.getScrollY(); - - var lastKnownScrollY = this.lastKnownScrollY; - - var isTv = layoutManager.tv; - - if (currentScrollY <= (isTv ? 120 : 10)) { - this.clear(); - } else if (this.shouldUnpin(currentScrollY)) { - this.unpin(); - } else if (this.shouldPin(currentScrollY)) { - - var toleranceExceeded = Math.abs(currentScrollY - lastKnownScrollY) >= 14; - - if (currentScrollY && isTv) { - this.unpin(); - } else if (toleranceExceeded) { - this.clear(); - } - } else if (isTv) { - //this.clear(); - } - - this.lastKnownScrollY = currentScrollY; - }; - - if (browser.supportsCssAnimation()) { - for (var i = 0, length = this.elems.length; i < length; i++) { - this.elems[i].classList.add(this.initialClass); - this.elems[i].addEventListener('clearheadroom', onHeadroomClearedExternally.bind(this)); - } - - this.attachEvent(); - } - } - - function onScroll() { - - if (this.paused) { - return; - } - - requestAnimationFrame(this.rafCallback || (this.rafCallback = this.update.bind(this))); - } - - /** - * Default options - * @type {Object} - */ - Headroom.options = { - offset: 0, - scroller: window, - initialClass: 'headroom', - unPinnedClass: 'headroom--unpinned', - pinnedClass: 'headroom--pinned' - }; - - return Headroom; -}); diff --git a/src/scripts/site.js b/src/scripts/site.js index 46b48f926b..917d75fafd 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -431,9 +431,6 @@ var AppInfo = {}; if (!window.fetch) { promises.push(require(["fetch"])); } - if ("function" != typeof Object.assign) { - promises.push(require(["objectassign"])); - } Promise.all(promises).then(function () { createConnectionManager().then(function () { @@ -861,8 +858,7 @@ var AppInfo = {}; return viewManager; }); define("slideshow", [componentsPath + "/slideshow/slideshow"], returnFirstDependency); - define("objectassign", ["legacy/polyfills/objectassign"], returnFirstDependency); - define("focusPreventScroll", ["legacy/polyfills/focusPreventScroll"], returnFirstDependency); + define("focusPreventScroll", ["legacy/focusPreventScroll"], returnFirstDependency); define("userdataButtons", [componentsPath + "/userdatabuttons/userdatabuttons"], returnFirstDependency); define("listView", [componentsPath + "/listview/listview"], returnFirstDependency); define("indicators", [componentsPath + "/indicators/indicators"], returnFirstDependency); From 6ec256154e1ba1c817dc49bdd0573f35b9c8cf2b Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 12:06:58 +0200 Subject: [PATCH 05/38] Check appSettings for undefined Prevents infinite loading on the Playback settings page --- src/scripts/settings/appSettings.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/scripts/settings/appSettings.js b/src/scripts/settings/appSettings.js index 03ceb346a2..dd2f972a30 100644 --- a/src/scripts/settings/appSettings.js +++ b/src/scripts/settings/appSettings.js @@ -12,7 +12,7 @@ import events from 'events'; } export function enableAutoLogin(val) { - if (val != null) { + if (val !== undefined || null) { this.set('enableAutoLogin', val.toString()); } @@ -20,7 +20,7 @@ import events from 'events'; } export function enableSystemExternalPlayers(val) { - if (val !== null) { + if (val !== undefined || null) { this.set('enableSystemExternalPlayers', val.toString()); } @@ -29,7 +29,7 @@ import events from 'events'; export function enableAutomaticBitrateDetection(isInNetwork, mediaType, val) { var key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork; - if (val != null) { + if (val !== undefined || null) { if (isInNetwork && mediaType === 'Audio') { val = true; } @@ -46,7 +46,7 @@ import events from 'events'; export function maxStreamingBitrate(isInNetwork, mediaType, val) { var key = 'maxbitrate-' + mediaType + '-' + isInNetwork; - if (val != null) { + if (val !== undefined || null) { if (isInNetwork && mediaType === 'Audio') { // nothing to do, this is always a max value } else { @@ -63,7 +63,7 @@ import events from 'events'; } export function maxStaticMusicBitrate(val) { - if (val !== undefined) { + if (val !== undefined || null) { this.set('maxStaticMusicBitrate', val); } @@ -72,7 +72,7 @@ import events from 'events'; } export function maxChromecastBitrate(val) { - if (val != null) { + if (val !== undefined || null) { this.set('chromecastBitrate1', val); } @@ -81,7 +81,7 @@ import events from 'events'; } export function syncOnlyOnWifi(val) { - if (val != null) { + if (val !== undefined || null) { this.set('syncOnlyOnWifi', val.toString()); } @@ -89,7 +89,7 @@ import events from 'events'; } export function syncPath(val) { - if (val != null) { + if (val !== undefined || null) { this.set('syncPath', val); } @@ -97,7 +97,7 @@ import events from 'events'; } export function cameraUploadServers(val) { - if (val != null) { + if (val !== undefined || null) { this.set('cameraUploadServers', val.join(',')); } @@ -110,7 +110,7 @@ import events from 'events'; } export function runAtStartup(val) { - if (val != null) { + if (val !== undefined || null) { this.set('runatstartup', val.toString()); } From 9a08d8dbc4a9baa8e5e834444de3aeec2f493531 Mon Sep 17 00:00:00 2001 From: Delgan Date: Sat, 25 Apr 2020 10:11:38 +0000 Subject: [PATCH 06/38] Fix pointer missing in "create new lib" link --- src/components/homesections/homesections.js | 2 +- src/elements/emby-button/emby-button.css | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/homesections/homesections.js b/src/components/homesections/homesections.js index cb4866a1cc..77ffb47814 100644 --- a/src/components/homesections/homesections.js +++ b/src/components/homesections/homesections.js @@ -64,7 +64,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la } else { var noLibDescription; if (user['Policy'] && user['Policy']['IsAdministrator']) { - noLibDescription = Globalize.translate("NoCreatedLibraries", '', ''); + noLibDescription = Globalize.translate("NoCreatedLibraries", '
', ''); } else { noLibDescription = Globalize.translate("AskAdminToCreateLibrary"); } diff --git a/src/elements/emby-button/emby-button.css b/src/elements/emby-button/emby-button.css index a19ce571e2..b3ee4db157 100644 --- a/src/elements/emby-button/emby-button.css +++ b/src/elements/emby-button/emby-button.css @@ -49,6 +49,7 @@ .button-link { background: transparent; + cursor: pointer; margin: 0; padding: 0; vertical-align: initial; From 1548f21901b32612b8565e81a41e1399a22b0ebe Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 12:17:27 +0200 Subject: [PATCH 07/38] Check for null or undefined in userSettings --- src/scripts/settings/userSettings.js | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/scripts/settings/userSettings.js b/src/scripts/settings/userSettings.js index 6f115eeffa..b2f1c69eda 100644 --- a/src/scripts/settings/userSettings.js +++ b/src/scripts/settings/userSettings.js @@ -93,7 +93,7 @@ import events from 'events'; } export function enableNextVideoInfoOverlay(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('enableNextVideoInfoOverlay', val.toString()); } @@ -102,7 +102,7 @@ import events from 'events'; } export function enableThemeSongs(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('enableThemeSongs', val.toString(), false); } @@ -111,7 +111,7 @@ import events from 'events'; } export function enableThemeVideos(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('enableThemeVideos', val.toString(), false); } @@ -120,7 +120,7 @@ import events from 'events'; } export function enableFastFadein(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('fastFadein', val.toString(), false); } @@ -129,7 +129,7 @@ import events from 'events'; } export function enableBackdrops(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('enableBackdrops', val.toString(), false); } @@ -138,7 +138,7 @@ import events from 'events'; } export function language(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('language', val.toString(), false); } @@ -146,7 +146,7 @@ import events from 'events'; } export function dateTimeLocale(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('datetimelocale', val.toString(), false); } @@ -154,7 +154,7 @@ import events from 'events'; } export function skipBackLength(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('skipBackLength', val.toString()); } @@ -162,7 +162,7 @@ import events from 'events'; } export function skipForwardLength(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('skipForwardLength', val.toString()); } @@ -170,7 +170,7 @@ import events from 'events'; } export function dashboardTheme(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('dashboardTheme', val); } @@ -178,7 +178,7 @@ import events from 'events'; } export function skin(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('skin', val, false); } @@ -186,7 +186,7 @@ import events from 'events'; } export function theme(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('appTheme', val, false); } @@ -194,7 +194,7 @@ import events from 'events'; } export function screensaver(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('screensaver', val, false); } @@ -202,7 +202,7 @@ import events from 'events'; } export function libraryPageSize(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('libraryPageSize', parseInt(val, 10), false); } @@ -216,7 +216,7 @@ import events from 'events'; } export function soundEffects(val) { - if (val != null) { + if (val !== undefined || null) { return this.set('soundeffects', val, false); } From 9981e7da4fd195625e45929e4a5edcf2f1ffb4ff Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 14:05:01 +0200 Subject: [PATCH 08/38] Update eslintignore --- .eslintignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 52369be1e3..8e3aee83fb 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,5 @@ -libraries/ +node_modules +dist +.idea +.vscode +src/libraries From 441d0517b05a5c8f2cfe018ae6ca142f251470bf Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 14:05:29 +0200 Subject: [PATCH 09/38] Add JSON to EditorConfig --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 81eba8ccc9..92cf9dc590 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,6 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true end_of_line = lf + +[json] +indent_size = 2 From 5f04c783e544925b002cd2c99040cd7436605e82 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 14:06:56 +0200 Subject: [PATCH 10/38] Convert ESLint config to JavaScript --- .eslintrc.js | 205 ++++++++++++++++++++++++++++++++++++++++++++++++++ .eslintrc.yml | 171 ----------------------------------------- 2 files changed, 205 insertions(+), 171 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 .eslintrc.yml diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..78aa240e67 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,205 @@ +module.exports = { + root: true, + plugins: [ + 'promise', + 'import', + 'eslint-comments' + ], + env: { + node: true, + es6: true, + es2017: true, + es2020: true + }, + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module', + ecmaFeatures: { + impliedStrict: true + } + }, + extends: [ + 'eslint:recommended', + // 'plugin:promise/recommended', + 'plugin:import/errors', + 'plugin:import/warnings', + 'plugin:eslint-comments/recommended', + 'plugin:compat/recommended' + ], + rules: { + 'block-spacing': ["error"], + 'brace-style': ["error"], + 'comma-dangle': ["error", "never"], + 'comma-spacing': ["error"], + 'eol-last': ["error"], + 'indent': ["error", 4, { "SwitchCase": 1 }], + 'keyword-spacing': ["error"], + 'max-statements-per-line': ["error"], + 'no-floating-decimal': ["error"], + 'no-multi-spaces': ["error"], + 'no-multiple-empty-lines': ["error", { "max": 1 }], + 'no-trailing-spaces': ["error"], + 'one-var': ["error", "never"], + 'semi': ["error"], + 'space-before-blocks': ["error"] + }, + overrides: [ + { + files: [ + './src/**/*.js' + ], + env: { + node: false, + amd: true, + browser: true, + es6: true, + es2017: true, + es2020: true + }, + globals: { + // Browser globals + 'MediaMetadata': 'readonly', + // Tizen globals + 'tizen': 'readonly', + 'webapis': 'readonly', + // WebOS globals + 'webOS': 'readonly', + // Dependency globals + '$': 'readonly', + 'jQuery': 'readonly', + 'requirejs': 'readonly', + // Jellyfin globals + 'ApiClient': 'writable', + 'AppInfo': 'writable', + 'chrome': 'writable', + 'ConnectionManager': 'writable', + 'DlnaProfilePage': 'writable', + 'Dashboard': 'writable', + 'DashboardPage': 'writable', + 'Emby': 'readonly', + 'Events': 'writable', + 'getParameterByName': 'writable', + 'getWindowLocationSearch': 'writable', + 'Globalize': 'writable', + 'Hls': 'writable', + 'dfnshelper': 'writable', + 'LibraryMenu': 'writable', + 'LinkParser': 'writable', + 'LiveTvHelpers': 'writable', + 'MetadataEditor': 'writable', + 'pageClassOn': 'writable', + 'pageIdOn': 'writable', + 'PlaylistViewer': 'writable', + 'UserParentalControlPage': 'writable', + 'Windows': 'readonly' + }, + rules: { + 'block-spacing': ["error"], + 'brace-style': ["error"], + 'comma-dangle': ["error", "never"], + 'comma-spacing': ["error"], + 'eol-last': ["error"], + 'indent': ["error", 4, { "SwitchCase": 1 }], + 'keyword-spacing': ["error"], + 'max-statements-per-line': ["error"], + 'no-floating-decimal': ["error"], + 'no-multi-spaces': ["error"], + 'no-multiple-empty-lines': ["error", { "max": 1 }], + 'no-trailing-spaces': ["error"], + 'one-var': ["error", "never"], + 'semi': ["error"], + 'space-before-blocks': ["error"], + // TODO: Fix warnings and remove these rules + 'no-redeclare': ["warn"], + 'no-unused-vars': ["warn"], + 'no-useless-escape': ["warn"], + // TODO: Remove after ES6 migration is complete + 'import/no-unresolved': ["warn"] + }, + settings: { + polyfills: [ + // Native Promises Only + 'Promise', + // whatwg-fetch + 'fetch', + // document-register-element + 'document.registerElement', + // resize-observer-polyfill + 'ResizeObserver', + // fast-text-encoding + 'TextEncoder', + // intersection-observer + 'IntersectionObserver', + // Core-js + 'Object.assign', + 'Object.is', + 'Object.setPrototypeOf', + 'Object.toString', + 'Object.freeze', + 'Object.seal', + 'Object.preventExtensions', + 'Object.isFrozen', + 'Object.isSealed', + 'Object.isExtensible', + 'Object.getOwnPropertyDescriptor', + 'Object.getPrototypeOf', + 'Object.keys', + 'Object.getOwnPropertyNames', + 'Function.name', + 'Function.hasInstance', + 'Array.from', + 'Array.arrayOf', + 'Array.copyWithin', + 'Array.fill', + 'Array.find', + 'Array.findIndex', + 'Array.iterator', + 'String.fromCodePoint', + 'String.raw', + 'String.iterator', + 'String.codePointAt', + 'String.endsWith', + 'String.includes', + 'String.repeat', + 'String.startsWith', + 'String.trim', + 'String.anchor', + 'String.big', + 'String.blink', + 'String.bold', + 'String.fixed', + 'String.fontcolor', + 'String.fontsize', + 'String.italics', + 'String.link', + 'String.small', + 'String.strike', + 'String.sub', + 'String.sup', + 'RegExp', + 'Number', + 'Math', + 'Date', + 'async', + 'Symbol', + 'Map', + 'Set', + 'WeakMap', + 'WeakSet', + 'ArrayBuffer', + 'DataView', + 'Int8Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array', + 'Reflect' + ] + } + } + ] +} diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 0b92c0c9b0..0000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,171 +0,0 @@ -env: - amd: true - browser: true - es6: true - es2017: true - es2020: true - -parserOptions: - ecmaVersion: 2020 - sourceType: module - ecmaFeatures: - impliedStrict: true - -plugins: - - promise - - import - - eslint-comments - -extends: - - eslint:recommended - - plugin:promise/recommended - - plugin:import/errors - - plugin:import/warnings - - plugin:eslint-comments/recommended - - plugin:compat/recommended - -globals: - # Browser globals - MediaMetadata: readonly - # Tizen globals - tizen: readonly - webapis: readonly - # WebOS globals - webOS: readonly - # Dependency globals - $: readonly - jQuery: readonly - requirejs: readonly - # Jellyfin globals - ApiClient: writable - AppInfo: writable - chrome: writable - ConnectionManager: writable - DlnaProfilePage: writable - Dashboard: writable - DashboardPage: writable - Emby: readonly - Events: writable - getParameterByName: writable - getWindowLocationSearch: writable - Globalize: writable - Hls: writable - dfnshelper: writable - LibraryMenu: writable - LinkParser: writable - LiveTvHelpers: writable - MetadataEditor: writable - pageClassOn: writable - pageIdOn: writable - PlaylistViewer: writable - UserParentalControlPage: writable - Windows: readonly - -rules: - block-spacing: ["error"] - brace-style: ["error"] - comma-dangle: ["error", "never"] - comma-spacing: ["error"] - eol-last: ["error"] - indent: ["error", 4, { "SwitchCase": 1 }] - keyword-spacing: ["error"] - max-statements-per-line: ["error"] - no-floating-decimal: ["error"] - no-multi-spaces: ["error"] - no-multiple-empty-lines: ["error", { "max": 1 }] - no-trailing-spaces: ["error"] - one-var: ["error", "never"] - semi: ["error"] - space-before-blocks: ["error"] - # TODO: Fix warnings and remove these rules - no-redeclare: ["warn"] - no-unused-vars: ["warn"] - no-useless-escape: ["warn"] - promise/catch-or-return: ["warn"] - promise/always-return: ["warn"] - promise/no-return-wrap: ["warn"] - # TODO: Remove after ES6 migration is complete - import/no-unresolved: ["warn"] - -settings: - polyfills: - # Native Promises Only - - Promise - # whatwg-fetch - - fetch - # document-register-element - - document.registerElement - # resize-observer-polyfill - - ResizeObserver - # fast-text-encoding - - TextEncoder - # intersection-observer - - IntersectionObserver - # Core-js - - Object.assign - - Object.is - - Object.setPrototypeOf - - Object.toString - - Object.freeze - - Object.seal - - Object.preventExtensions - - Object.isFrozen - - Object.isSealed - - Object.isExtensible - - Object.getOwnPropertyDescriptor - - Object.getPrototypeOf - - Object.keys - - Object.getOwnPropertyNames - - Function.name - - Function.hasInstance - - Array.from - - Array.arrayOf - - Array.copyWithin - - Array.fill - - Array.find - - Array.findIndex - - Array.iterator - - String.fromCodePoint - - String.raw - - String.iterator - - String.codePointAt - - String.endsWith - - String.includes - - String.repeat - - String.startsWith - - String.trim - - String.anchor - - String.big - - String.blink - - String.bold - - String.fixed - - String.fontcolor - - String.fontsize - - String.italics - - String.link - - String.small - - String.strike - - String.sub - - String.sup - - RegExp - - Number - - Math - - Date - - async - - Symbol - - Map - - Set - - WeakMap - - WeakSet - - ArrayBuffer - - DataView - - Int8Array - - Uint8Array - - Uint8ClampedArray - - Int16Array - - Uint16Array - - Int32Array - - Uint32Array - - Float32Array - - Float64Array - - Reflect From 380d66c3d7f28ef6f1c3d2127f6f7bb2ddd36364 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 14:07:20 +0200 Subject: [PATCH 11/38] Fix linting issues in webpack config --- webpack.dev.js | 2 +- webpack.prod.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webpack.dev.js b/webpack.dev.js index beca8ea4fb..78bdb54867 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -28,7 +28,7 @@ module.exports = merge(common, { { test: /\.(woff|woff2|eot|ttf|otf)$/, use: [ - 'file-loader', + 'file-loader' ] } ] diff --git a/webpack.prod.js b/webpack.prod.js index 80d40f3450..c2d5e97915 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -21,7 +21,7 @@ module.exports = merge(common, { { test: /\.(woff|woff2|eot|ttf|otf)$/, use: [ - 'file-loader', + 'file-loader' ] } ] From 1c5419000c91427fe1a8e6846d48179aa28f46e1 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 14:07:34 +0200 Subject: [PATCH 12/38] Fix linting issues in Gulgfile --- gulpfile.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 4556e71bc8..0e97324553 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,5 +1,3 @@ -'use strict'; - const { src, dest, series, parallel, watch } = require('gulp'); const browserSync = require('browser-sync').create(); const del = require('del'); From 519fde1abad0ce87ca71f005d6f1e98ae0e4da52 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 14:07:55 +0200 Subject: [PATCH 13/38] Fix linting issues in PostCSS config --- postcss.config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/postcss.config.js b/postcss.config.js index 23159fd295..cd27a85952 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -2,10 +2,10 @@ const postcssPresetEnv = require('postcss-preset-env'); const cssnano = require('cssnano'); const config = () => ({ - plugins: [ - postcssPresetEnv(), - cssnano() - ] + plugins: [ + postcssPresetEnv(), + cssnano() + ] }); -module.exports = config +module.exports = config; From dc74e21363895bfb1b2239781032cd4caaf77530 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 14:08:28 +0200 Subject: [PATCH 14/38] Lint all JS files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4e79ea3c39..70e338459c 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "build:development": "gulp --development", "build:production": "gulp --production", "build:standalone": "gulp standalone --development", - "lint": "eslint \"src\"", + "lint": "eslint \".\"", "stylelint": "stylelint \"src/**/*.css\"" } } From bbd1a4aa288a7f90b6fee152f3048508680255df Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 14:47:20 +0200 Subject: [PATCH 15/38] Add Autoprefixer Apprently it got the axe when moving to Gulp. Oops. --- .eslintrc.js | 17 +---------------- package.json | 2 +- postcss.config.js | 2 ++ yarn.lock | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 78aa240e67..6a01fe5bf7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -94,27 +94,12 @@ module.exports = { 'Windows': 'readonly' }, rules: { - 'block-spacing': ["error"], - 'brace-style': ["error"], - 'comma-dangle': ["error", "never"], - 'comma-spacing': ["error"], - 'eol-last': ["error"], - 'indent': ["error", 4, { "SwitchCase": 1 }], - 'keyword-spacing': ["error"], - 'max-statements-per-line': ["error"], - 'no-floating-decimal': ["error"], - 'no-multi-spaces': ["error"], - 'no-multiple-empty-lines': ["error", { "max": 1 }], - 'no-trailing-spaces': ["error"], - 'one-var': ["error", "never"], - 'semi': ["error"], - 'space-before-blocks': ["error"], // TODO: Fix warnings and remove these rules 'no-redeclare': ["warn"], 'no-unused-vars': ["warn"], 'no-useless-escape': ["warn"], // TODO: Remove after ES6 migration is complete - 'import/no-unresolved': ["warn"] + 'import/no-unresolved': ["off"] }, settings: { polyfills: [ diff --git a/package.json b/package.json index 70e338459c..19681c5f9c 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@babel/plugin-transform-modules-amd": "^7.8.3", "@babel/polyfill": "^7.8.7", "@babel/preset-env": "^7.8.6", - "autoprefixer": "^9.7.4", + "autoprefixer": "^9.7.6", "babel-loader": "^8.0.6", "browser-sync": "^2.26.7", "clean-webpack-plugin": "^3.0.0", diff --git a/postcss.config.js b/postcss.config.js index cd27a85952..9ce2e16af6 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,9 +1,11 @@ const postcssPresetEnv = require('postcss-preset-env'); +const autoprefixer = require('autoprefixer'); const cssnano = require('cssnano'); const config = () => ({ plugins: [ postcssPresetEnv(), + autoprefixer(), cssnano() ] }); diff --git a/yarn.lock b/yarn.lock index 55d6a104d0..47485dd258 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1553,6 +1553,19 @@ autoprefixer@^9.0.0, autoprefixer@^9.6.1, autoprefixer@^9.7.4: postcss "^7.0.27" postcss-value-parser "^4.0.3" +autoprefixer@^9.7.6: + version "9.7.6" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.6.tgz#63ac5bbc0ce7934e6997207d5bb00d68fa8293a4" + integrity sha512-F7cYpbN7uVVhACZTeeIeealwdGM6wMtfWARVLTy5xmKtgVdBNJvbDRoCK3YO1orcs7gv/KwYlb3iXwu9Ug9BkQ== + dependencies: + browserslist "^4.11.1" + caniuse-lite "^1.0.30001039" + chalk "^2.4.2" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + postcss "^7.0.27" + postcss-value-parser "^4.0.3" + aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -1970,6 +1983,16 @@ browserslist@^4.0.0, browserslist@^4.11.0, browserslist@^4.6.4, browserslist@^4. node-releases "^1.1.52" pkg-up "^3.1.0" +browserslist@^4.11.1: + version "4.12.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.12.0.tgz#06c6d5715a1ede6c51fc39ff67fd647f740b656d" + integrity sha512-UH2GkcEDSI0k/lRkuDSzFl9ZZ87skSy9w2XAn1MsZnL+4c4rqbBd3e82UWHbYDpztABrPBhZsTEeuxVfHppqDg== + dependencies: + caniuse-lite "^1.0.30001043" + electron-to-chromium "^1.3.413" + node-releases "^1.1.53" + pkg-up "^2.0.0" + browserslist@^4.8.2: version "4.11.1" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.11.1.tgz#92f855ee88d6e050e7e7311d987992014f1a1f1b" @@ -2240,6 +2263,11 @@ caniuse-lite@^1.0.30001038: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001039.tgz#b3814a1c38ffeb23567f8323500c09526a577bbe" integrity sha512-SezbWCTT34eyFoWHgx8UWso7YtvtM7oosmFoXbCkdC6qJzRfBTeTgE9REtKtiuKXuMwWTZEvdnFNGAyVMorv8Q== +caniuse-lite@^1.0.30001039, caniuse-lite@^1.0.30001043: + version "1.0.30001046" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001046.tgz#7a06d3e8fd8aa7f4d21c9a2e313f35f2d06b013e" + integrity sha512-CsGjBRYWG6FvgbyGy+hBbaezpwiqIOLkxQPY4A4Ea49g1eNsnQuESB+n4QM0BKii1j80MyJ26Ir5ywTQkbRE4g== + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -3667,6 +3695,11 @@ electron-to-chromium@^1.3.390: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.397.tgz#db640c2e67b08d590a504c20b56904537aa2bafa" integrity sha512-zcUd1p/7yzTSdWkCTrqGvbnEOASy96d0RJL/lc5BDJoO23Z3G/VHd0yIPbguDU9n8QNUTCigLO7oEdtOb7fp2A== +electron-to-chromium@^1.3.413: + version "1.3.418" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.418.tgz#840021191f466b803a873e154113620c9f53cec6" + integrity sha512-i2QrQtHes5fK/F9QGG5XacM5WKEuR322fxTYF9e8O9Gu0mc0WmjjwGpV8c7Htso6Zf2Di18lc3SIPxmMeRFBug== + elliptic@^6.0.0: version "6.5.2" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762" From 96d49d39687fe31bef6036711a3778d8aa2a1e21 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 25 Apr 2020 15:02:42 +0200 Subject: [PATCH 16/38] Add more filetypes to gitattributes --- .gitattributes | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 80f9bc36ed..9e495a4df0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,35 @@ -/CONTRIBUTORS.md merge=union +* text=auto + +CONTRIBUTORS.md merge=union +README.md text +LICENSE text + +*.css text +*.eot binary +*.gif binary +*.html text diff=html +*.ico binary +*.*ignore text +*.jpg binary +*.js text +*.json text +*.lock text -diff +*.map text -diff +*.md text +*.otf binary +*.png binary +*.py text diff=python +*.svg binary +*.ts text +*.ttf binary +*.sass text +*.vue text +*.webp binary +*.woff binary +*.woff2 binary + +.editorconfig text +.gitattributes export-ignore +.gitignore export-ignore + +*.gitattributes linguist-language=gitattributes From 9bc718628e443adeae703440ed08b1234d2d3916 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sat, 25 Apr 2020 18:39:54 +0300 Subject: [PATCH 17/38] Fix keyboard navigation --- src/nowplaying.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nowplaying.html b/src/nowplaying.html index 0f34e5ba32..6eaf0252fb 100644 --- a/src/nowplaying.html +++ b/src/nowplaying.html @@ -26,9 +26,9 @@
-
+
-
+