From 08df4531e3e1353143b54f3550f4c1be7d09c1cc Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 21 Jan 2019 17:47:10 +0900 Subject: [PATCH 1/9] deminify site.js a small amount --- src/scripts/site.js | 275 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 230 insertions(+), 45 deletions(-) diff --git a/src/scripts/site.js b/src/scripts/site.js index 3c67c7dfc4..af92dfe8e2 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -189,8 +189,8 @@ var Dashboard = { function createConnectionManager() { return new Promise(function(resolve, reject) { require(["connectionManagerFactory", "apphost", "credentialprovider", "events", "userSettings"], function(ConnectionManager, apphost, credentialProvider, events, userSettings) { - var credentialProviderInstance = new credentialProvider, - promises = [apphost.getSyncProfile(), apphost.init()]; + var credentialProviderInstance = new credentialProvider; + var promises = [apphost.getSyncProfile(), apphost.init()]; Promise.all(promises).then(function(responses) { var deviceProfile = responses[0], capabilities = Dashboard.capabilities(apphost); @@ -202,9 +202,9 @@ var Dashboard = { apiClient.enableAutomaticNetworking = !1, apiClient.manualAddressOnly = !0, connectionManager.addApiClient(apiClient), window.ApiClient = apiClient, localApiClient = apiClient, console.log("loaded ApiClient singleton"), resolve() }); resolve() - }) - }) - }) + }); + }); + }); } function returnFirstDependency(obj) { @@ -212,51 +212,65 @@ var Dashboard = { } function getSettingsBuilder(UserSettings, layoutManager, browser) { - return UserSettings.prototype.enableThemeVideos = function(val) { - return null != val ? this.set("enableThemeVideos", val.toString(), !1) : (val = this.get("enableThemeVideos", !1), val ? "false" !== val : !layoutManager.mobile && !browser.slow) - }, UserSettings + UserSettings.prototype.enableThemeVideos = function(val) { + return null != val + ? this.set("enableThemeVideos", val.toString(), !1) + : (val = this.get("enableThemeVideos", !1), val ? "false" !== val : !layoutManager.mobile && !browser.slow); + }; + return UserSettings; } function getBowerPath() { - return "bower_components" + return "bower_components"; } function getPlaybackManager(playbackManager) { - return window.addEventListener("beforeunload", function(e) { + window.addEventListener("beforeunload", function(e) { try { - playbackManager.onAppClose() + playbackManager.onAppClose(); } catch (err) { - console.log("error in onAppClose: " + err) + console.log("error in onAppClose: " + err); } - }), playbackManager + }); + return playbackManager; } function getLayoutManager(layoutManager, appHost) { - return appHost.getDefaultLayout && (layoutManager.defaultLayout = appHost.getDefaultLayout()), layoutManager.init(), layoutManager + if (appHost.getDefaultLayout) { + layoutManager.defaultLayout = appHost.getDefaultLayout(); + } + layoutManager.init(); + return layoutManager; } function getAppStorage(basePath) { try { - return localStorage.setItem("_test", "0"), localStorage.removeItem("_test"), basePath + "/appstorage-localstorage" + localStorage.setItem("_test", "0"); + localStorage.removeItem("_test"); + return basePath + "/appstorage-localstorage"; } catch (e) { - return basePath + "/appstorage-memory" + return basePath + "/appstorage-memory"; } } function createWindowHeadroom(Headroom) { var headroom = new Headroom([], {}); - return headroom.init(), headroom + headroom.init(); + return headroom; } function getCastSenderApiLoader() { - var ccLoaded = !1; + var ccLoaded = false; return { load: function() { return ccLoaded ? Promise.resolve() : new Promise(function(resolve, reject) { var fileref = document.createElement("script"); - fileref.setAttribute("type", "text/javascript"), fileref.onload = function() { + fileref.setAttribute("type", "text/javascript"); + fileref.onload = function() { ccLoaded = !0, resolve() - }, fileref.setAttribute("src", "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"), document.querySelector("head").appendChild(fileref) + }; + fileref.setAttribute("src", "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"); + document.querySelector("head").appendChild(fileref); }) } } @@ -271,11 +285,11 @@ var Dashboard = { } function createSharedAppFooter(appFooter) { - return new appFooter({}) + return new appFooter({}); } function onRequireJsError(requireType, requireModules) { - console.log("RequireJS error: " + (requireType || "unknown") + ". Failed modules: " + (requireModules || []).join(",")) + console.log("RequireJS error: " + (requireType || "unknown") + ". Failed modules: " + (requireModules || []).join(",")); } function defineResizeObserver() { @@ -405,19 +419,24 @@ var Dashboard = { var deps = ["apphost"]; browser.tv && !browser.android ? (console.log("Using system fonts with explicit sizes"), deps.push("systemFontsSizedCss")) : (console.log("Using default fonts"), deps.push("systemFontsCss")), deps.push("css!css/librarybrowser"), require(deps, function(appHost) { loadPlugins([], appHost, browser).then(function() { - onAppReady(browser) + onAppReady(browser); }) }) } function defineRoute(newRoute, dictionary) { - var baseRoute = Emby.Page.baseUrl(), - path = newRoute.path; - path = path.replace(baseRoute, ""), console.log("Defining route: " + path), newRoute.dictionary = newRoute.dictionary || dictionary || "core", Emby.Page.addRoute(path, newRoute) + var baseRoute = Emby.Page.baseUrl(); + var path = newRoute.path; + + path = path.replace(baseRoute, ""); + console.log("Defining route: " + path); + newRoute.dictionary = newRoute.dictionary || dictionary || "core"; + Emby.Page.addRoute(path, newRoute); } function defineCoreRoutes(appHost) { - console.log("Defining core routes"), defineRoute({ + console.log("Defining core routes"); + defineRoute({ path: "/addplugin.html", dependencies: [], autoFocus: !1, @@ -933,11 +952,11 @@ var Dashboard = { } var localApiClient; ! function() { - var urlArgs = "v=" + (window.dashboardVersion || (new Date).getDate()), - bowerPath = getBowerPath(), - apiClientBowerPath = bowerPath + "/emby-apiclient", - embyWebComponentsBowerPath = bowerPath + "/emby-webcomponents", - paths = { + var urlArgs = "v=" + (window.dashboardVersion || (new Date).getDate()); + var bowerPath = getBowerPath(); + var apiClientBowerPath = bowerPath + "/emby-apiclient"; + var embyWebComponentsBowerPath = bowerPath + "/emby-webcomponents"; + var paths = { velocity: bowerPath + "/velocity/velocity.min", vibrant: bowerPath + "/vibrant/dist/vibrant", staticBackdrops: embyWebComponentsBowerPath + "/staticbackdrops", @@ -973,10 +992,109 @@ var Dashboard = { nowPlayingHelper: embyWebComponentsBowerPath + "/playback/nowplayinghelper", pluginManager: embyWebComponentsBowerPath + "/pluginmanager", packageManager: embyWebComponentsBowerPath + "/packagemanager" - }; - paths.hlsjs = bowerPath + "/hlsjs/dist/hls.min", paths.flvjs = embyWebComponentsBowerPath + "/flvjs/flv.min", paths.shaka = embyWebComponentsBowerPath + "/shaka/shaka-player.compiled", define("chromecastHelper", [embyWebComponentsBowerPath + "/chromecast/chromecasthelpers"], returnFirstDependency), define("mediaSession", [embyWebComponentsBowerPath + "/playback/mediasession"], returnFirstDependency), define("webActionSheet", [embyWebComponentsBowerPath + "/actionsheet/actionsheet"], returnFirstDependency), define("libjass", [bowerPath + "/libjass/libjass.min", "css!" + bowerPath + "/libjass/libjass"], returnFirstDependency), define("tunerPicker", ["components/tunerpicker"], returnFirstDependency), define("mainTabsManager", [embyWebComponentsBowerPath + "/maintabsmanager"], returnFirstDependency), define("imageLoader", [embyWebComponentsBowerPath + "/images/imagehelper"], returnFirstDependency), define("appFooter", [embyWebComponentsBowerPath + "/appfooter/appfooter"], returnFirstDependency), define("directorybrowser", ["components/directorybrowser/directorybrowser"], returnFirstDependency), define("metadataEditor", [embyWebComponentsBowerPath + "/metadataeditor/metadataeditor"], returnFirstDependency), define("personEditor", [embyWebComponentsBowerPath + "/metadataeditor/personeditor"], returnFirstDependency), define("playerSelectionMenu", [embyWebComponentsBowerPath + "/playback/playerselection"], returnFirstDependency), define("playerSettingsMenu", [embyWebComponentsBowerPath + "/playback/playersettingsmenu"], returnFirstDependency), define("playMethodHelper", [embyWebComponentsBowerPath + "/playback/playmethodhelper"], returnFirstDependency), define("brightnessOsd", [embyWebComponentsBowerPath + "/playback/brightnessosd"], returnFirstDependency), define("libraryMenu", ["scripts/librarymenu"], returnFirstDependency), define("emby-collapse", [embyWebComponentsBowerPath + "/emby-collapse/emby-collapse"], returnFirstDependency), define("emby-button", [embyWebComponentsBowerPath + "/emby-button/emby-button"], returnFirstDependency), define("emby-linkbutton", ["emby-button"], returnFirstDependency), define("emby-itemscontainer", [embyWebComponentsBowerPath + "/emby-itemscontainer/emby-itemscontainer"], returnFirstDependency), define("alphaNumericShortcuts", [embyWebComponentsBowerPath + "/alphanumericshortcuts/alphanumericshortcuts"], returnFirstDependency), define("emby-scroller", [embyWebComponentsBowerPath + "/emby-scroller/emby-scroller"], returnFirstDependency), define("emby-tabs", [embyWebComponentsBowerPath + "/emby-tabs/emby-tabs"], returnFirstDependency), define("emby-scrollbuttons", [embyWebComponentsBowerPath + "/emby-scrollbuttons/emby-scrollbuttons"], returnFirstDependency), define("emby-progressring", [embyWebComponentsBowerPath + "/emby-progressring/emby-progressring"], returnFirstDependency), define("emby-itemrefreshindicator", [embyWebComponentsBowerPath + "/emby-itemrefreshindicator/emby-itemrefreshindicator"], returnFirstDependency), define("multiSelect", [embyWebComponentsBowerPath + "/multiselect/multiselect"], returnFirstDependency), define("alphaPicker", [embyWebComponentsBowerPath + "/alphapicker/alphapicker"], returnFirstDependency), define("paper-icon-button-light", [embyWebComponentsBowerPath + "/emby-button/paper-icon-button-light"], returnFirstDependency), define("tabbedView", [embyWebComponentsBowerPath + "/tabbedview/tabbedview"], returnFirstDependency), define("itemsTab", [embyWebComponentsBowerPath + "/tabbedview/itemstab"], returnFirstDependency), define("emby-input", [embyWebComponentsBowerPath + "/emby-input/emby-input"], returnFirstDependency), define("emby-select", [embyWebComponentsBowerPath + "/emby-select/emby-select"], returnFirstDependency), define("emby-slider", [embyWebComponentsBowerPath + "/emby-slider/emby-slider"], returnFirstDependency), define("emby-checkbox", [embyWebComponentsBowerPath + "/emby-checkbox/emby-checkbox"], returnFirstDependency), define("emby-toggle", [embyWebComponentsBowerPath + "/emby-toggle/emby-toggle"], returnFirstDependency), define("emby-radio", [embyWebComponentsBowerPath + "/emby-radio/emby-radio"], returnFirstDependency), define("emby-textarea", [embyWebComponentsBowerPath + "/emby-textarea/emby-textarea"], returnFirstDependency), define("collectionEditor", [embyWebComponentsBowerPath + "/collectioneditor/collectioneditor"], returnFirstDependency), define("serverRestartDialog", [embyWebComponentsBowerPath + "/serverrestartdialog/serverrestartdialog"], returnFirstDependency), define("playlistEditor", [embyWebComponentsBowerPath + "/playlisteditor/playlisteditor"], returnFirstDependency), define("recordingCreator", [embyWebComponentsBowerPath + "/recordingcreator/recordingcreator"], returnFirstDependency), define("recordingEditor", [embyWebComponentsBowerPath + "/recordingcreator/recordingeditor"], returnFirstDependency), define("seriesRecordingEditor", [embyWebComponentsBowerPath + "/recordingcreator/seriesrecordingeditor"], returnFirstDependency), define("recordingFields", [embyWebComponentsBowerPath + "/recordingcreator/recordingfields"], returnFirstDependency), define("recordingButton", [embyWebComponentsBowerPath + "/recordingcreator/recordingbutton"], returnFirstDependency), define("recordingHelper", [embyWebComponentsBowerPath + "/recordingcreator/recordinghelper"], returnFirstDependency), define("subtitleEditor", [embyWebComponentsBowerPath + "/subtitleeditor/subtitleeditor"], returnFirstDependency), define("itemIdentifier", [embyWebComponentsBowerPath + "/itemidentifier/itemidentifier"], returnFirstDependency), define("mediaInfo", [embyWebComponentsBowerPath + "/mediainfo/mediainfo"], returnFirstDependency), define("itemContextMenu", [embyWebComponentsBowerPath + "/itemcontextmenu"], returnFirstDependency), define("imageEditor", [embyWebComponentsBowerPath + "/imageeditor/imageeditor"], returnFirstDependency), define("imageDownloader", [embyWebComponentsBowerPath + "/imagedownloader/imagedownloader"], returnFirstDependency), define("dom", [embyWebComponentsBowerPath + "/dom"], returnFirstDependency), define("playerStats", [embyWebComponentsBowerPath + "/playerstats/playerstats"], returnFirstDependency), define("searchFields", [embyWebComponentsBowerPath + "/search/searchfields"], returnFirstDependency), define("searchResults", [embyWebComponentsBowerPath + "/search/searchresults"], returnFirstDependency), define("upNextDialog", [embyWebComponentsBowerPath + "/upnextdialog/upnextdialog"], returnFirstDependency), define("fullscreen-doubleclick", [embyWebComponentsBowerPath + "/fullscreen/fullscreen-dc"], returnFirstDependency), define("fullscreenManager", [embyWebComponentsBowerPath + "/fullscreen/fullscreenmanager", "events"], returnFirstDependency), define("headroom", [embyWebComponentsBowerPath + "/headroom/headroom"], returnFirstDependency), define("subtitleAppearanceHelper", [embyWebComponentsBowerPath + "/subtitlesettings/subtitleappearancehelper"], returnFirstDependency), define("subtitleSettings", [embyWebComponentsBowerPath + "/subtitlesettings/subtitlesettings"], returnFirstDependency), define("displaySettings", [embyWebComponentsBowerPath + "/displaysettings/displaysettings"], returnFirstDependency), define("playbackSettings", [embyWebComponentsBowerPath + "/playbacksettings/playbacksettings"], returnFirstDependency), define("homescreenSettings", [embyWebComponentsBowerPath + "/homescreensettings/homescreensettings"], returnFirstDependency), define("homescreenSettingsDialog", [embyWebComponentsBowerPath + "/homescreensettings/homescreensettingsdialog"], returnFirstDependency), define("playbackManager", [embyWebComponentsBowerPath + "/playback/playbackmanager"], getPlaybackManager), define("layoutManager", [embyWebComponentsBowerPath + "/layoutmanager", "apphost"], getLayoutManager), define("homeSections", [embyWebComponentsBowerPath + "/homesections/homesections"], returnFirstDependency), define("playMenu", [embyWebComponentsBowerPath + "/playmenu"], returnFirstDependency), define("refreshDialog", [embyWebComponentsBowerPath + "/refreshdialog/refreshdialog"], returnFirstDependency), define("backdrop", [embyWebComponentsBowerPath + "/backdrop/backdrop"], returnFirstDependency), define("fetchHelper", [embyWebComponentsBowerPath + "/fetchhelper"], returnFirstDependency), define("roundCardStyle", ["cardStyle", "css!" + embyWebComponentsBowerPath + "/cardbuilder/roundcard"], returnFirstDependency), define("cardStyle", ["css!" + embyWebComponentsBowerPath + "/cardbuilder/card"], returnFirstDependency), define("cardBuilder", [embyWebComponentsBowerPath + "/cardbuilder/cardbuilder"], returnFirstDependency), define("peoplecardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/peoplecardbuilder"], returnFirstDependency), define("chaptercardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/chaptercardbuilder"], returnFirstDependency), define("mouseManager", [embyWebComponentsBowerPath + "/input/mouse"], returnFirstDependency), define("flexStyles", ["css!" + embyWebComponentsBowerPath + "/flexstyles"], returnFirstDependency), define("deleteHelper", [embyWebComponentsBowerPath + "/deletehelper"], returnFirstDependency), define("tvguide", [embyWebComponentsBowerPath + "/guide/guide"], returnFirstDependency), define("programStyles", ["css!" + embyWebComponentsBowerPath + "/guide/programs"], returnFirstDependency), define("guide-settings-dialog", [embyWebComponentsBowerPath + "/guide/guide-settings"], returnFirstDependency), define("loadingDialog", [embyWebComponentsBowerPath + "/loadingdialog/loadingdialog"], returnFirstDependency), define("syncDialog", [embyWebComponentsBowerPath + "/sync/sync"], returnFirstDependency), define("syncJobEditor", [embyWebComponentsBowerPath + "/sync/syncjobeditor"], returnFirstDependency), define("syncJobList", [embyWebComponentsBowerPath + "/sync/syncjoblist"], returnFirstDependency), define("viewManager", [embyWebComponentsBowerPath + "/viewmanager/viewmanager"], function(viewManager) { + }; + + paths.hlsjs = bowerPath + "/hlsjs/dist/hls.min"; + paths.flvjs = embyWebComponentsBowerPath + "/flvjs/flv.min"; + paths.shaka = embyWebComponentsBowerPath + "/shaka/shaka-player.compiled"; + + define("chromecastHelper", [embyWebComponentsBowerPath + "/chromecast/chromecasthelpers"], returnFirstDependency); + define("mediaSession", [embyWebComponentsBowerPath + "/playback/mediasession"], returnFirstDependency); + define("webActionSheet", [embyWebComponentsBowerPath + "/actionsheet/actionsheet"], returnFirstDependency); + define("libjass", [bowerPath + "/libjass/libjass.min", "css!" + bowerPath + "/libjass/libjass"], returnFirstDependency); + define("tunerPicker", ["components/tunerpicker"], returnFirstDependency); + define("mainTabsManager", [embyWebComponentsBowerPath + "/maintabsmanager"], returnFirstDependency); + define("imageLoader", [embyWebComponentsBowerPath + "/images/imagehelper"], returnFirstDependency); + define("appFooter", [embyWebComponentsBowerPath + "/appfooter/appfooter"], returnFirstDependency); + define("directorybrowser", ["components/directorybrowser/directorybrowser"], returnFirstDependency); + define("metadataEditor", [embyWebComponentsBowerPath + "/metadataeditor/metadataeditor"], returnFirstDependency); + define("personEditor", [embyWebComponentsBowerPath + "/metadataeditor/personeditor"], returnFirstDependency); + define("playerSelectionMenu", [embyWebComponentsBowerPath + "/playback/playerselection"], returnFirstDependency); + define("playerSettingsMenu", [embyWebComponentsBowerPath + "/playback/playersettingsmenu"], returnFirstDependency); + define("playMethodHelper", [embyWebComponentsBowerPath + "/playback/playmethodhelper"], returnFirstDependency); + define("brightnessOsd", [embyWebComponentsBowerPath + "/playback/brightnessosd"], returnFirstDependency); + define("libraryMenu", ["scripts/librarymenu"], returnFirstDependency); + define("emby-collapse", [embyWebComponentsBowerPath + "/emby-collapse/emby-collapse"], returnFirstDependency); + define("emby-button", [embyWebComponentsBowerPath + "/emby-button/emby-button"], returnFirstDependency); + define("emby-linkbutton", ["emby-button"], returnFirstDependency); + define("emby-itemscontainer", [embyWebComponentsBowerPath + "/emby-itemscontainer/emby-itemscontainer"], returnFirstDependency); + define("alphaNumericShortcuts", [embyWebComponentsBowerPath + "/alphanumericshortcuts/alphanumericshortcuts"], returnFirstDependency); + define("emby-scroller", [embyWebComponentsBowerPath + "/emby-scroller/emby-scroller"], returnFirstDependency); + define("emby-tabs", [embyWebComponentsBowerPath + "/emby-tabs/emby-tabs"], returnFirstDependency); + define("emby-scrollbuttons", [embyWebComponentsBowerPath + "/emby-scrollbuttons/emby-scrollbuttons"], returnFirstDependency); + define("emby-progressring", [embyWebComponentsBowerPath + "/emby-progressring/emby-progressring"], returnFirstDependency); + define("emby-itemrefreshindicator", [embyWebComponentsBowerPath + "/emby-itemrefreshindicator/emby-itemrefreshindicator"], returnFirstDependency); + define("multiSelect", [embyWebComponentsBowerPath + "/multiselect/multiselect"], returnFirstDependency); + define("alphaPicker", [embyWebComponentsBowerPath + "/alphapicker/alphapicker"], returnFirstDependency); + define("paper-icon-button-light", [embyWebComponentsBowerPath + "/emby-button/paper-icon-button-light"], returnFirstDependency); + define("tabbedView", [embyWebComponentsBowerPath + "/tabbedview/tabbedview"], returnFirstDependency); + define("itemsTab", [embyWebComponentsBowerPath + "/tabbedview/itemstab"], returnFirstDependency); + define("emby-input", [embyWebComponentsBowerPath + "/emby-input/emby-input"], returnFirstDependency); + define("emby-select", [embyWebComponentsBowerPath + "/emby-select/emby-select"], returnFirstDependency); + define("emby-slider", [embyWebComponentsBowerPath + "/emby-slider/emby-slider"], returnFirstDependency); + define("emby-checkbox", [embyWebComponentsBowerPath + "/emby-checkbox/emby-checkbox"], returnFirstDependency); + define("emby-toggle", [embyWebComponentsBowerPath + "/emby-toggle/emby-toggle"], returnFirstDependency); + define("emby-radio", [embyWebComponentsBowerPath + "/emby-radio/emby-radio"], returnFirstDependency); + define("emby-textarea", [embyWebComponentsBowerPath + "/emby-textarea/emby-textarea"], returnFirstDependency); + define("collectionEditor", [embyWebComponentsBowerPath + "/collectioneditor/collectioneditor"], returnFirstDependency); + define("serverRestartDialog", [embyWebComponentsBowerPath + "/serverrestartdialog/serverrestartdialog"], returnFirstDependency); + define("playlistEditor", [embyWebComponentsBowerPath + "/playlisteditor/playlisteditor"], returnFirstDependency); + define("recordingCreator", [embyWebComponentsBowerPath + "/recordingcreator/recordingcreator"], returnFirstDependency); + define("recordingEditor", [embyWebComponentsBowerPath + "/recordingcreator/recordingeditor"], returnFirstDependency); + define("seriesRecordingEditor", [embyWebComponentsBowerPath + "/recordingcreator/seriesrecordingeditor"], returnFirstDependency); + define("recordingFields", [embyWebComponentsBowerPath + "/recordingcreator/recordingfields"], returnFirstDependency); + define("recordingButton", [embyWebComponentsBowerPath + "/recordingcreator/recordingbutton"], returnFirstDependency); + define("recordingHelper", [embyWebComponentsBowerPath + "/recordingcreator/recordinghelper"], returnFirstDependency); + define("subtitleEditor", [embyWebComponentsBowerPath + "/subtitleeditor/subtitleeditor"], returnFirstDependency); + define("itemIdentifier", [embyWebComponentsBowerPath + "/itemidentifier/itemidentifier"], returnFirstDependency); + define("mediaInfo", [embyWebComponentsBowerPath + "/mediainfo/mediainfo"], returnFirstDependency); + define("itemContextMenu", [embyWebComponentsBowerPath + "/itemcontextmenu"], returnFirstDependency); + define("imageEditor", [embyWebComponentsBowerPath + "/imageeditor/imageeditor"], returnFirstDependency); + define("imageDownloader", [embyWebComponentsBowerPath + "/imagedownloader/imagedownloader"], returnFirstDependency); + define("dom", [embyWebComponentsBowerPath + "/dom"], returnFirstDependency); + define("playerStats", [embyWebComponentsBowerPath + "/playerstats/playerstats"], returnFirstDependency); + define("searchFields", [embyWebComponentsBowerPath + "/search/searchfields"], returnFirstDependency); + define("searchResults", [embyWebComponentsBowerPath + "/search/searchresults"], returnFirstDependency); + define("upNextDialog", [embyWebComponentsBowerPath + "/upnextdialog/upnextdialog"], returnFirstDependency); + define("fullscreen-doubleclick", [embyWebComponentsBowerPath + "/fullscreen/fullscreen-dc"], returnFirstDependency); + define("fullscreenManager", [embyWebComponentsBowerPath + "/fullscreen/fullscreenmanager", "events"], returnFirstDependency); + define("headroom", [embyWebComponentsBowerPath + "/headroom/headroom"], returnFirstDependency); + define("subtitleAppearanceHelper", [embyWebComponentsBowerPath + "/subtitlesettings/subtitleappearancehelper"], returnFirstDependency); + define("subtitleSettings", [embyWebComponentsBowerPath + "/subtitlesettings/subtitlesettings"], returnFirstDependency); + define("displaySettings", [embyWebComponentsBowerPath + "/displaysettings/displaysettings"], returnFirstDependency); + define("playbackSettings", [embyWebComponentsBowerPath + "/playbacksettings/playbacksettings"], returnFirstDependency); + define("homescreenSettings", [embyWebComponentsBowerPath + "/homescreensettings/homescreensettings"], returnFirstDependency); + define("homescreenSettingsDialog", [embyWebComponentsBowerPath + "/homescreensettings/homescreensettingsdialog"], returnFirstDependency); + define("playbackManager", [embyWebComponentsBowerPath + "/playback/playbackmanager"], getPlaybackManager); + define("layoutManager", [embyWebComponentsBowerPath + "/layoutmanager", "apphost"], getLayoutManager); + define("homeSections", [embyWebComponentsBowerPath + "/homesections/homesections"], returnFirstDependency); + define("playMenu", [embyWebComponentsBowerPath + "/playmenu"], returnFirstDependency); + define("refreshDialog", [embyWebComponentsBowerPath + "/refreshdialog/refreshdialog"], returnFirstDependency); + define("backdrop", [embyWebComponentsBowerPath + "/backdrop/backdrop"], returnFirstDependency); + define("fetchHelper", [embyWebComponentsBowerPath + "/fetchhelper"], returnFirstDependency); + define("roundCardStyle", ["cardStyle", "css!" + embyWebComponentsBowerPath + "/cardbuilder/roundcard"], returnFirstDependency); + define("cardStyle", ["css!" + embyWebComponentsBowerPath + "/cardbuilder/card"], returnFirstDependency); + define("cardBuilder", [embyWebComponentsBowerPath + "/cardbuilder/cardbuilder"], returnFirstDependency); + define("peoplecardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/peoplecardbuilder"], returnFirstDependency); + define("chaptercardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/chaptercardbuilder"], returnFirstDependency); + define("mouseManager", [embyWebComponentsBowerPath + "/input/mouse"], returnFirstDependency); + define("flexStyles", ["css!" + embyWebComponentsBowerPath + "/flexstyles"], returnFirstDependency); + define("deleteHelper", [embyWebComponentsBowerPath + "/deletehelper"], returnFirstDependency); + define("tvguide", [embyWebComponentsBowerPath + "/guide/guide"], returnFirstDependency); + define("programStyles", ["css!" + embyWebComponentsBowerPath + "/guide/programs"], returnFirstDependency); + define("guide-settings-dialog", [embyWebComponentsBowerPath + "/guide/guide-settings"], returnFirstDependency); + define("loadingDialog", [embyWebComponentsBowerPath + "/loadingdialog/loadingdialog"], returnFirstDependency); + define("syncDialog", [embyWebComponentsBowerPath + "/sync/sync"], returnFirstDependency); + define("syncJobEditor", [embyWebComponentsBowerPath + "/sync/syncjobeditor"], returnFirstDependency); + define("syncJobList", [embyWebComponentsBowerPath + "/sync/syncjoblist"], returnFirstDependency); + define("viewManager", [embyWebComponentsBowerPath + "/viewmanager/viewmanager"], function(viewManager) { return window.ViewManager = viewManager, viewManager.dispatchPageEvents(!0), viewManager - }), "cordova" === self.appMode || "android" === self.appMode ? paths.apphost = "cordova/apphost" : paths.apphost = "components/apphost", paths.appStorage = getAppStorage(apiClientBowerPath), requirejs.config({ + }); + + "cordova" === self.appMode || "android" === self.appMode + ? paths.apphost = "cordova/apphost" + : paths.apphost = "components/apphost"; + paths.appStorage = getAppStorage(apiClientBowerPath), requirejs.config({ waitSeconds: 0, map: { "*": { @@ -987,11 +1105,72 @@ var Dashboard = { urlArgs: urlArgs, paths: paths, onError: onRequireJsError - }), requirejs.onError = onRequireJsError, define("jstree", ["thirdparty/jstree/jstree", "css!thirdparty/jstree/themes/default/style.css"], returnFirstDependency), define("dashboardcss", ["css!css/dashboard"], returnFirstDependency), define("slideshow", [embyWebComponentsBowerPath + "/slideshow/slideshow"], returnFirstDependency), define("fetch", [bowerPath + "/fetch/fetch"], returnFirstDependency), define("raf", [embyWebComponentsBowerPath + "/polyfills/raf"], returnFirstDependency), define("functionbind", [embyWebComponentsBowerPath + "/polyfills/bind"], returnFirstDependency), define("arraypolyfills", [embyWebComponentsBowerPath + "/polyfills/array"], returnFirstDependency), define("objectassign", [embyWebComponentsBowerPath + "/polyfills/objectassign"], returnFirstDependency), define("clearButtonStyle", ["css!" + embyWebComponentsBowerPath + "/clearbutton"], returnFirstDependency), define("userdataButtons", [embyWebComponentsBowerPath + "/userdatabuttons/userdatabuttons"], returnFirstDependency), define("emby-playstatebutton", [embyWebComponentsBowerPath + "/userdatabuttons/emby-playstatebutton"], returnFirstDependency), define("emby-ratingbutton", [embyWebComponentsBowerPath + "/userdatabuttons/emby-ratingbutton"], returnFirstDependency), define("emby-downloadbutton", [embyWebComponentsBowerPath + "/sync/emby-downloadbutton"], returnFirstDependency), define("listView", [embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency), define("listViewStyle", ["css!" + embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency), define("formDialogStyle", ["css!" + embyWebComponentsBowerPath + "/formdialog"], returnFirstDependency), define("indicators", [embyWebComponentsBowerPath + "/indicators/indicators"], returnFirstDependency), define("viewSettings", [embyWebComponentsBowerPath + "/viewsettings/viewsettings"], returnFirstDependency), define("filterMenu", [embyWebComponentsBowerPath + "/filtermenu/filtermenu"], returnFirstDependency), define("sortMenu", [embyWebComponentsBowerPath + "/sortmenu/sortmenu"], returnFirstDependency), define("registrationServices", [embyWebComponentsBowerPath + "/registrationservices/registrationservices"], returnFirstDependency), "cordova" === self.appMode || "android" === self.appMode ? define("fileupload", ["cordova/fileupload"], returnFirstDependency) : define("fileupload", [apiClientBowerPath + "/fileupload"], returnFirstDependency), define("connectionmanager", [apiClientBowerPath + "/connectionmanager"]), define("contentuploader", [apiClientBowerPath + "/sync/contentuploader"], returnFirstDependency), define("serversync", [apiClientBowerPath + "/sync/serversync"], returnFirstDependency), define("multiserversync", [apiClientBowerPath + "/sync/multiserversync"], returnFirstDependency), define("mediasync", [apiClientBowerPath + "/sync/mediasync"], returnFirstDependency), define("idb", [embyWebComponentsBowerPath + "/idb"], returnFirstDependency), define("sanitizefilename", [embyWebComponentsBowerPath + "/sanitizefilename"], returnFirstDependency), define("itemrepository", [apiClientBowerPath + "/sync/itemrepository"], returnFirstDependency), define("useractionrepository", [apiClientBowerPath + "/sync/useractionrepository"], returnFirstDependency), define("swiper", [bowerPath + "/Swiper/dist/js/swiper.min", "css!" + bowerPath + "/Swiper/dist/css/swiper.min"], returnFirstDependency), define("scroller", [embyWebComponentsBowerPath + "/scroller/smoothscroller"], returnFirstDependency), define("toast", [embyWebComponentsBowerPath + "/toast/toast"], returnFirstDependency), define("scrollHelper", [embyWebComponentsBowerPath + "/scrollhelper"], returnFirstDependency), define("touchHelper", [embyWebComponentsBowerPath + "/touchhelper"], returnFirstDependency), define("appSettings", [embyWebComponentsBowerPath + "/appsettings"], returnFirstDependency), define("userSettings", [embyWebComponentsBowerPath + "/usersettings/usersettings"], returnFirstDependency), define("userSettingsBuilder", [embyWebComponentsBowerPath + "/usersettings/usersettingsbuilder", "layoutManager", "browser"], getSettingsBuilder), define("material-icons", ["css!" + embyWebComponentsBowerPath + "/fonts/material-icons/style"], returnFirstDependency), define("systemFontsCss", ["css!" + embyWebComponentsBowerPath + "/fonts/fonts"], returnFirstDependency), define("systemFontsSizedCss", ["css!" + embyWebComponentsBowerPath + "/fonts/fonts.sized"], returnFirstDependency), define("scrollStyles", ["css!" + embyWebComponentsBowerPath + "/scrollstyles"], returnFirstDependency), define("imageUploader", [embyWebComponentsBowerPath + "/imageuploader/imageuploader"], returnFirstDependency), define("navdrawer", ["components/navdrawer/navdrawer"], returnFirstDependency), define("htmlMediaHelper", [embyWebComponentsBowerPath + "/htmlvideoplayer/htmlmediahelper"], returnFirstDependency), define("viewcontainer", ["components/viewcontainer-lite", "css!" + embyWebComponentsBowerPath + "/viewmanager/viewcontainer-lite"], returnFirstDependency), define("queryString", [bowerPath + "/query-string/index"], function() { + }); + requirejs.onError = onRequireJsError; + define("jstree", ["thirdparty/jstree/jstree", "css!thirdparty/jstree/themes/default/style.css"], returnFirstDependency); + define("dashboardcss", ["css!css/dashboard"], returnFirstDependency); + define("slideshow", [embyWebComponentsBowerPath + "/slideshow/slideshow"], returnFirstDependency); + define("fetch", [bowerPath + "/fetch/fetch"], returnFirstDependency); + define("raf", [embyWebComponentsBowerPath + "/polyfills/raf"], returnFirstDependency); + define("functionbind", [embyWebComponentsBowerPath + "/polyfills/bind"], returnFirstDependency); + define("arraypolyfills", [embyWebComponentsBowerPath + "/polyfills/array"], returnFirstDependency); + define("objectassign", [embyWebComponentsBowerPath + "/polyfills/objectassign"], returnFirstDependency); + define("clearButtonStyle", ["css!" + embyWebComponentsBowerPath + "/clearbutton"], returnFirstDependency); + define("userdataButtons", [embyWebComponentsBowerPath + "/userdatabuttons/userdatabuttons"], returnFirstDependency); + define("emby-playstatebutton", [embyWebComponentsBowerPath + "/userdatabuttons/emby-playstatebutton"], returnFirstDependency); + define("emby-ratingbutton", [embyWebComponentsBowerPath + "/userdatabuttons/emby-ratingbutton"], returnFirstDependency); + define("emby-downloadbutton", [embyWebComponentsBowerPath + "/sync/emby-downloadbutton"], returnFirstDependency); + define("listView", [embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency); + define("listViewStyle", ["css!" + embyWebComponentsBowerPath + "/listview/listview"], returnFirstDependency); + define("formDialogStyle", ["css!" + embyWebComponentsBowerPath + "/formdialog"], returnFirstDependency); + define("indicators", [embyWebComponentsBowerPath + "/indicators/indicators"], returnFirstDependency); + define("viewSettings", [embyWebComponentsBowerPath + "/viewsettings/viewsettings"], returnFirstDependency); + define("filterMenu", [embyWebComponentsBowerPath + "/filtermenu/filtermenu"], returnFirstDependency); + define("sortMenu", [embyWebComponentsBowerPath + "/sortmenu/sortmenu"], returnFirstDependency); + define("registrationServices", [embyWebComponentsBowerPath + "/registrationservices/registrationservices"], returnFirstDependency); + + "cordova" === self.appMode || "android" === self.appMode + ? define("fileupload", ["cordova/fileupload"], returnFirstDependency) + : define("fileupload", [apiClientBowerPath + "/fileupload"], returnFirstDependency); + define("connectionmanager", [apiClientBowerPath + "/connectionmanager"]); + define("contentuploader", [apiClientBowerPath + "/sync/contentuploader"], returnFirstDependency); + define("serversync", [apiClientBowerPath + "/sync/serversync"], returnFirstDependency); + define("multiserversync", [apiClientBowerPath + "/sync/multiserversync"], returnFirstDependency); + define("mediasync", [apiClientBowerPath + "/sync/mediasync"], returnFirstDependency); + define("idb", [embyWebComponentsBowerPath + "/idb"], returnFirstDependency); + define("sanitizefilename", [embyWebComponentsBowerPath + "/sanitizefilename"], returnFirstDependency); + define("itemrepository", [apiClientBowerPath + "/sync/itemrepository"], returnFirstDependency); + define("useractionrepository", [apiClientBowerPath + "/sync/useractionrepository"], returnFirstDependency); + define("swiper", [bowerPath + "/Swiper/dist/js/swiper.min", "css!" + bowerPath + "/Swiper/dist/css/swiper.min"], returnFirstDependency); + define("scroller", [embyWebComponentsBowerPath + "/scroller/smoothscroller"], returnFirstDependency); + define("toast", [embyWebComponentsBowerPath + "/toast/toast"], returnFirstDependency); + define("scrollHelper", [embyWebComponentsBowerPath + "/scrollhelper"], returnFirstDependency); + define("touchHelper", [embyWebComponentsBowerPath + "/touchhelper"], returnFirstDependency); + define("appSettings", [embyWebComponentsBowerPath + "/appsettings"], returnFirstDependency); + define("userSettings", [embyWebComponentsBowerPath + "/usersettings/usersettings"], returnFirstDependency); + define("userSettingsBuilder", [embyWebComponentsBowerPath + "/usersettings/usersettingsbuilder", "layoutManager", "browser"], getSettingsBuilder); + define("material-icons", ["css!" + embyWebComponentsBowerPath + "/fonts/material-icons/style"], returnFirstDependency); + define("systemFontsCss", ["css!" + embyWebComponentsBowerPath + "/fonts/fonts"], returnFirstDependency); + define("systemFontsSizedCss", ["css!" + embyWebComponentsBowerPath + "/fonts/fonts.sized"], returnFirstDependency); + define("scrollStyles", ["css!" + embyWebComponentsBowerPath + "/scrollstyles"], returnFirstDependency); + define("imageUploader", [embyWebComponentsBowerPath + "/imageuploader/imageuploader"], returnFirstDependency); + define("navdrawer", ["components/navdrawer/navdrawer"], returnFirstDependency); + define("htmlMediaHelper", [embyWebComponentsBowerPath + "/htmlvideoplayer/htmlmediahelper"], returnFirstDependency); + define("viewcontainer", ["components/viewcontainer-lite", "css!" + embyWebComponentsBowerPath + "/viewmanager/viewcontainer-lite"], returnFirstDependency); + define("queryString", [bowerPath + "/query-string/index"], function() { return queryString - }), define("jQuery", [bowerPath + "/jquery/dist/jquery.slim.min"], function() { + }); + define("jQuery", [bowerPath + "/jquery/dist/jquery.slim.min"], function() { return window.ApiClient && (jQuery.ajax = ApiClient.ajax), jQuery - }), define("fnchecked", ["legacy/fnchecked"], returnFirstDependency), define("dialogHelper", [embyWebComponentsBowerPath + "/dialoghelper/dialoghelper"], returnFirstDependency), define("inputmanager", ["inputManager"], returnFirstDependency), define("apiInput", [embyWebComponentsBowerPath + "/input/api"], returnFirstDependency), define("serverNotifications", ["apiInput"], returnFirstDependency), define("headroom-window", ["headroom"], createWindowHeadroom), define("appFooter-shared", ["appFooter"], createSharedAppFooter), define("skinManager", [embyWebComponentsBowerPath + "/skinmanager"], function(skinManager) { + }); + define("fnchecked", ["legacy/fnchecked"], returnFirstDependency); + define("dialogHelper", [embyWebComponentsBowerPath + "/dialoghelper/dialoghelper"], returnFirstDependency); + define("inputmanager", ["inputManager"], returnFirstDependency); + define("apiInput", [embyWebComponentsBowerPath + "/input/api"], returnFirstDependency); + define("serverNotifications", ["apiInput"], returnFirstDependency); + define("headroom-window", ["headroom"], createWindowHeadroom); + define("appFooter-shared", ["appFooter"], createSharedAppFooter); + define("skinManager", [embyWebComponentsBowerPath + "/skinmanager"], function(skinManager) { return skinManager.loadUserSkin = function(options) { require(["appRouter"], function(appRouter) { options = options || {}, options.start ? appRouter.invokeShortcut(options.start) : appRouter.goHome() @@ -1040,13 +1219,16 @@ var Dashboard = { id: "wmc" }] }, skinManager - }), define("connectionManager", [], function() { + }); + define("connectionManager", [], function() { return ConnectionManager - }), define("apiClientResolver", [], function() { + }); + define("apiClientResolver", [], function() { return function() { return window.ApiClient } - }), define("appRouter", [embyWebComponentsBowerPath + "/router", "itemHelper"], function(appRouter, itemHelper) { + }); + define("appRouter", [embyWebComponentsBowerPath + "/router", "itemHelper"], function(appRouter, itemHelper) { function showItem(item, serverId, options) { "string" == typeof item ? require(["connectionManager"], function(connectionManager) { var apiClient = connectionManager.currentApiClient(); @@ -1129,8 +1311,11 @@ var Dashboard = { }, appRouter.showItem = showItem, appRouter }) }(), require(["css!css/site"]), require(["browser"], onWebComponentsReady) -}(), pageClassOn("viewshow", "standalonePage", function() { - document.querySelector(".skinHeader").classList.add("noHeaderRight") -}), pageClassOn("viewhide", "standalonePage", function() { - document.querySelector(".skinHeader").classList.remove("noHeaderRight") +}(); + +pageClassOn("viewshow", "standalonePage", function() { + document.querySelector(".skinHeader").classList.add("noHeaderRight"); +}); +pageClassOn("viewhide", "standalonePage", function() { + document.querySelector(".skinHeader").classList.remove("noHeaderRight"); }); From b5b928ec218d97bb4412fc1ea9e54f4248099a94 Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 21 Jan 2019 18:05:15 +0900 Subject: [PATCH 2/9] remove more code related to camera roll --- .../emby-apiclient/cameraroll.js | 8 --- .../emby-apiclient/sync/contentuploader.js | 57 ------------------- .../emby-apiclient/sync/serversync.js | 6 +- src/scripts/site.js | 5 +- 4 files changed, 3 insertions(+), 73 deletions(-) delete mode 100644 src/bower_components/emby-apiclient/cameraroll.js delete mode 100644 src/bower_components/emby-apiclient/sync/contentuploader.js diff --git a/src/bower_components/emby-apiclient/cameraroll.js b/src/bower_components/emby-apiclient/cameraroll.js deleted file mode 100644 index fddd1a1850..0000000000 --- a/src/bower_components/emby-apiclient/cameraroll.js +++ /dev/null @@ -1,8 +0,0 @@ -define([], function() { - "use strict"; - - function CameraRoll() {} - return CameraRoll.prototype.getFiles = function() { - return Promise.resolve([]) - }, new CameraRoll -}); \ No newline at end of file diff --git a/src/bower_components/emby-apiclient/sync/contentuploader.js b/src/bower_components/emby-apiclient/sync/contentuploader.js deleted file mode 100644 index e08dbe4dd2..0000000000 --- a/src/bower_components/emby-apiclient/sync/contentuploader.js +++ /dev/null @@ -1,57 +0,0 @@ -define(["localassetmanager", "cameraRoll"], function(localAssetManager, cameraRoll) { - "use strict"; - - function getFilesToUpload(files, uploadHistory) { - return files.filter(function(file) { - if (!file) return !1; - var uploadId = getUploadId(file); - return 0 === uploadHistory.FilesUploaded.filter(function(u) { - return uploadId === u.Id - }).length - }) - } - - function getUploadId(file) { - return btoa(file.Id + "1") - } - - function uploadNext(files, index, server, apiClient, resolve, reject) { - var length = files.length; - if (index >= length) return void resolve(); - uploadFile(files[index], apiClient).then(function() { - uploadNext(files, index + 1, server, apiClient, resolve, reject) - }, function() { - uploadNext(files, index + 1, server, apiClient, resolve, reject) - }) - } - - function uploadFile(file, apiClient) { - return new Promise(function(resolve, reject) { - require(["fileupload"], function(FileUpload) { - var url = apiClient.getUrl("Devices/CameraUploads", { - DeviceId: apiClient.deviceId(), - Name: file.Name, - Album: "Camera Roll", - Id: getUploadId(file), - api_key: apiClient.accessToken() - }); - console.log("Uploading file to " + url), (new FileUpload).upload(file, url).then(resolve, reject) - }) - }) - } - - function ContentUploader() {} - return ContentUploader.prototype.uploadImages = function(connectionManager, server) { - return cameraRoll.getFiles().then(function(photos) { - if (!photos.length) return Promise.resolve(); - var apiClient = connectionManager.getApiClient(server.Id); - return apiClient.getContentUploadHistory().then(function(uploadHistory) { - return photos = getFilesToUpload(photos, uploadHistory), console.log("Found " + photos.length + " files to upload"), new Promise(function(resolve, reject) { - uploadNext(photos, 0, server, apiClient, resolve, reject) - }) - }, function() { - return Promise.resolve() - }) - }) - }, ContentUploader -}); \ No newline at end of file diff --git a/src/bower_components/emby-apiclient/sync/serversync.js b/src/bower_components/emby-apiclient/sync/serversync.js index 4299091c27..dacc70f73c 100644 --- a/src/bower_components/emby-apiclient/sync/serversync.js +++ b/src/bower_components/emby-apiclient/sync/serversync.js @@ -12,11 +12,7 @@ define([], function() { } function uploadContent(connectionManager, server, options) { - return new Promise(function(resolve, reject) { - require(["contentuploader"], function(ContentUploader) { - (new ContentUploader).uploadImages(connectionManager, server).then(resolve, reject) - }) - }) + return new Promise().resolve(); } function syncMedia(connectionManager, server, options) { diff --git a/src/scripts/site.js b/src/scripts/site.js index af92dfe8e2..7346c079b6 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -304,8 +304,8 @@ var Dashboard = { var embyWebComponentsBowerPath = bowerPath + "/emby-webcomponents"; "android" === self.appMode - ? (define("filesystem", ["cordova/filesystem"], returnFirstDependency), define("cameraRoll", ["cordova/cameraroll"], returnFirstDependency)) - : (define("filesystem", [embyWebComponentsBowerPath + "/filesystem"], returnFirstDependency), define("cameraRoll", [apiClientBowerPath + "/cameraroll"], returnFirstDependency)); + ? define("filesystem", ["cordova/filesystem"], returnFirstDependency) + : define("filesystem", [embyWebComponentsBowerPath + "/filesystem"], returnFirstDependency); window.IntersectionObserver && !browser.edge ? define("lazyLoader", [embyWebComponentsBowerPath + "/lazyloader/lazyloader-intersectionobserver"], returnFirstDependency) : define("lazyLoader", [embyWebComponentsBowerPath + "/lazyloader/lazyloader-scroll"], returnFirstDependency); @@ -1133,7 +1133,6 @@ var Dashboard = { ? define("fileupload", ["cordova/fileupload"], returnFirstDependency) : define("fileupload", [apiClientBowerPath + "/fileupload"], returnFirstDependency); define("connectionmanager", [apiClientBowerPath + "/connectionmanager"]); - define("contentuploader", [apiClientBowerPath + "/sync/contentuploader"], returnFirstDependency); define("serversync", [apiClientBowerPath + "/sync/serversync"], returnFirstDependency); define("multiserversync", [apiClientBowerPath + "/sync/multiserversync"], returnFirstDependency); define("mediasync", [apiClientBowerPath + "/sync/mediasync"], returnFirstDependency); From b27bc31f50d613210336e947ccaac77a192dbafd Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 21 Jan 2019 18:26:31 +0900 Subject: [PATCH 3/9] remove more sync related code --- .../emby-webcomponents/sync/syncjobeditor.js | 504 ------------------ .../emby-webcomponents/sync/syncjoblist.js | 455 ---------------- src/mysyncjob.html | 13 - src/scripts/site.js | 8 - src/syncactivity.html | 18 - 5 files changed, 998 deletions(-) delete mode 100644 src/bower_components/emby-webcomponents/sync/syncjobeditor.js delete mode 100644 src/bower_components/emby-webcomponents/sync/syncjoblist.js delete mode 100644 src/mysyncjob.html delete mode 100644 src/syncactivity.html diff --git a/src/bower_components/emby-webcomponents/sync/syncjobeditor.js b/src/bower_components/emby-webcomponents/sync/syncjobeditor.js deleted file mode 100644 index a4666bab72..0000000000 --- a/src/bower_components/emby-webcomponents/sync/syncjobeditor.js +++ /dev/null @@ -1,504 +0,0 @@ -define(['connectionManager', 'serverNotifications', 'events', 'datetime', 'dom', 'imageLoader', 'loading', 'globalize', 'apphost', 'layoutManager', 'scrollHelper', 'dialogHelper', 'listViewStyle', 'paper-icon-button-light', 'emby-button', 'formDialogStyle', 'emby-linkbutton'], function (connectionManager, serverNotifications, events, datetime, dom, imageLoader, loading, globalize, appHost, layoutManager, scrollHelper, dialogHelper) { - 'use strict'; - - function syncNow() { - require(['localsync'], function (localSync) { - localSync.sync(); - }); - } - - function renderJob(context, job, dialogOptions) { - - require(['syncDialog'], function (syncDialog) { - syncDialog.renderForm({ - elem: context.querySelector('.syncJobFormContent'), - dialogOptions: dialogOptions, - dialogOptionsFn: getTargetDialogOptionsFn(dialogOptions), - readOnlySyncTarget: true - }).then(function () { - fillJobValues(context, job, dialogOptions); - }); - }); - } - - function getTargetDialogOptionsFn(dialogOptions) { - - return function (targetId) { - - return Promise.resolve(dialogOptions); - }; - } - - function getJobItemHtml(jobItem, apiClient, index) { - - var html = ''; - var status = jobItem.Status; - - var nextAction; - - if (status === 'Failed') { - nextAction = 'retry'; - } - else if (status === 'Cancelled') { - nextAction = 'retry'; - } - else if (status === 'Queued' || status === 'Transferring' || status === 'Converting' || status === 'ReadyToTransfer') { - nextAction = 'cancel'; - } - else if (status === 'Synced' && !jobItem.IsMarkedForRemoval) { - nextAction = 'remove'; - } - - var listItemClass = 'listItem listItem-border'; - if (layoutManager.tv && nextAction) { - listItemClass += ' btnJobItemMenu'; - } - - if (layoutManager.tv) { - listItemClass += ' listItem-button'; - } - - var tagName = layoutManager.tv ? 'button' : 'div'; - html += '<' + tagName + ' type="button" class="' + listItemClass + '" data-itemid="' + jobItem.Id + '" data-status="' + jobItem.Status + '" data-action="' + nextAction + '">'; - - var imgUrl; - - if (jobItem.PrimaryImageItemId) { - - imgUrl = apiClient.getImageUrl(jobItem.PrimaryImageItemId, { - type: "Primary", - width: 80, - tag: jobItem.PrimaryImageTag, - minScale: 1.5 - }); - } - - if (imgUrl) { - html += '
'; - } - else { - html += 'sync'; - } - - html += '
'; - - html += '

'; - html += jobItem.ItemName; - html += '

'; - - if (jobItem.Status === 'Failed') { - html += '
'; - } else { - html += '
'; - } - html += globalize.translate('sharedcomponents#SyncJobItemStatus' + jobItem.Status); - if (jobItem.Status === 'Synced' && jobItem.IsMarkedForRemoval) { - html += '
'; - html += globalize.translate('sharedcomponents#RemovingFromDevice'); - } - html += '
'; - - html += '
'; - html += '
'; - html += '
'; - - html += '
'; - - var moreIcon = ''; - - if (!layoutManager.tv) { - - if (nextAction === 'retry') { - html += ''; - } - else if (nextAction === 'cancel') { - html += ''; - } - else if (nextAction === 'remove') { - html += ''; - } - } - - html += ''; - return html; - } - - function renderJobItems(context, items, apiClient) { - - var html = ''; - - html += '

' + globalize.translate('sharedcomponents#Items') + '

'; - - html += '
'; - - var index = 0; - html += items.map(function (i) { - - return getJobItemHtml(i, apiClient, index++); - - }).join(''); - - html += '
'; - - var elem = context.querySelector('.jobItems'); - elem.innerHTML = html; - imageLoader.lazyChildren(elem); - } - - function parentWithClass(elem, className) { - - while (!elem.classList || !elem.classList.contains(className)) { - elem = elem.parentNode; - - if (!elem) { - return null; - } - } - - return elem; - } - - function showJobItemMenu(elem, jobId, apiClient) { - - var action = elem.getAttribute('data-action'); - var context = parentWithClass(elem, 'formDialog'); - var listItem = parentWithClass(elem, 'listItem'); - var jobItemId = listItem.getAttribute('data-itemid'); - - var menuItems = []; - - if (action === 'retry') { - retryJobItem(context, jobId, jobItemId, apiClient); - } - else if (action === 'cancel' || action === 'remove') { - cancelJobItem(context, jobId, jobItemId, apiClient); - } - } - - function cancelJobItem(context, jobId, jobItemId, apiClient) { - - showRemoveConfirm(function () { - loading.show(); - - apiClient.ajax({ - - type: "DELETE", - url: apiClient.getUrl('Sync/JobItems/' + jobItemId) - - }).then(function () { - - // TODO this should check editor options.mode === 'download' - if (appHost.supports('sync')) { - syncNow(); - } - - loadJob(context, jobId, apiClient); - }); - }); - } - - function retryJobItem(context, jobId, jobItemId, apiClient) { - - showRetryConfirm(function () { - apiClient.ajax({ - - type: "POST", - url: apiClient.getUrl('Sync/JobItems/' + jobItemId + '/Enable') - - }).then(function () { - - // TODO this should check editor options.mode === 'download' - if (appHost.supports('sync')) { - syncNow(); - } - - loadJob(context, jobId, apiClient); - }); - }); - } - - function showRetryConfirm(callback) { - - // TODO Implement this as a retry dialog - require(['confirm'], function (confirm) { - - confirm({ - - text: globalize.translate('sharedcomponents#ConfirmRemoveDownload'), - confirmText: globalize.translate('sharedcomponents#RemoveDownload'), - cancelText: globalize.translate('sharedcomponents#KeepDownload'), - primary: 'cancel' - - }).then(callback); - }); - } - - function showRemoveConfirm(callback) { - - require(['confirm'], function (confirm) { - - confirm({ - - text: globalize.translate('sharedcomponents#ConfirmRemoveDownload'), - confirmText: globalize.translate('sharedcomponents#RemoveDownload'), - cancelText: globalize.translate('sharedcomponents#KeepDownload'), - primary: 'cancel' - - }).then(callback); - }); - } - - function showConfirm(text, callback) { - - require(['confirm'], function (confirm) { - - confirm(text).then(callback); - }); - } - - function fillJobValues(context, job, editOptions) { - - var selectProfile = context.querySelector('#selectProfile'); - if (selectProfile) { - selectProfile.value = job.Profile || ''; - } - - var selectQuality = context.querySelector('#selectQuality'); - if (selectQuality) { - selectQuality.value = job.Quality || ''; - } - - var chkUnwatchedOnly = context.querySelector('#chkUnwatchedOnly'); - if (chkUnwatchedOnly) { - chkUnwatchedOnly.checked = job.UnwatchedOnly; - } - - var chkSyncNewContent = context.querySelector('#chkSyncNewContent'); - if (chkSyncNewContent) { - chkSyncNewContent.checked = job.SyncNewContent; - } - - var txtItemLimit = context.querySelector('#txtItemLimit'); - if (txtItemLimit) { - txtItemLimit.value = job.ItemLimit; - } - - var txtBitrate = context.querySelector('#txtBitrate'); - if (job.Bitrate) { - txtBitrate.value = job.Bitrate / 1000000; - } else { - txtBitrate.value = ''; - } - - var target = editOptions.Targets.filter(function (t) { - return t.Id === job.TargetId; - })[0]; - var targetName = target ? target.Name : ''; - - var selectSyncTarget = context.querySelector('#selectSyncTarget'); - if (selectSyncTarget) { - selectSyncTarget.value = targetName; - } - } - - var _jobOptions; - function loadJob(context, id, apiClient) { - - loading.show(); - - apiClient.getJSON(apiClient.getUrl('Sync/Jobs/' + id)).then(function (job) { - - apiClient.getJSON(apiClient.getUrl('Sync/Options', { - - UserId: job.UserId, - ItemIds: (job.RequestedItemIds && job.RequestedItemIds.length ? job.RequestedItemIds.join('') : null), - - ParentId: job.ParentId, - Category: job.Category, - TargetId: job.TargetId - - })).then(function (options) { - - _jobOptions = options; - renderJob(context, job, options); - loading.hide(); - }); - }); - - apiClient.getJSON(apiClient.getUrl('Sync/JobItems', { - - JobId: id, - AddMetadata: true - - })).then(function (result) { - - renderJobItems(context, result.Items, apiClient); - loading.hide(); - }); - } - - function loadJobInfo(context, job, jobItems, apiClient) { - - //renderJob(page, job, _jobOptions); - renderJobItems(context, jobItems, apiClient); - loading.hide(); - } - - function saveJob(context, id, apiClient) { - - loading.show(); - - apiClient.getJSON(apiClient.getUrl('Sync/Jobs/' + id)).then(function (job) { - - require(['syncDialog'], function (syncDialog) { - syncDialog.setJobValues(job, context); - - apiClient.ajax({ - - url: apiClient.getUrl('Sync/Jobs/' + id), - type: 'POST', - data: JSON.stringify(job), - contentType: "application/json" - - }).then(function () { - - // TODO this should check editor options.mode === 'download' - if (appHost.supports('sync')) { - syncNow(); - } - - loading.hide(); - dialogHelper.close(context); - }); - }); - }); - - } - - function startListening(apiClient, jobId) { - - var startParams = "0,1500"; - - startParams += "," + jobId; - - apiClient.sendMessage("SyncJobStart", startParams); - } - - function stopListening(apiClient) { - - apiClient.sendMessage("SyncJobStop", ""); - } - - function bindEvents(context, jobId, apiClient) { - context.querySelector('.jobItems').addEventListener('click', function (e) { - var btnJobItemMenu = dom.parentWithClass(e.target, 'btnJobItemMenu'); - if (btnJobItemMenu) { - showJobItemMenu(btnJobItemMenu, jobId, apiClient); - } - }); - } - - function showEditor(options) { - - var apiClient = connectionManager.getApiClient(options.serverId); - var id = options.jobId; - - var dlgElementOptions = { - removeOnClose: true, - scrollY: false, - autoFocus: false - }; - - if (layoutManager.tv) { - dlgElementOptions.size = 'fullscreen'; - } else { - dlgElementOptions.size = 'medium'; - } - - var dlg = dialogHelper.createDialog(dlgElementOptions); - - dlg.classList.add('formDialog'); - - var html = ''; - html += '
'; - html += ''; - html += '

'; - html += globalize.translate('sharedcomponents#Sync'); - html += '

'; - - if (appHost.supports('externallinks')) { - html += 'info' + globalize.translate('sharedcomponents#Help') + ''; - } - - html += '
'; - - html += '
'; - html += '
'; - - html += '
'; - - html += '
'; - - html += '
'; - - html += '
'; - html += ''; - html += '
'; - - html += '
'; - - html += '
'; - html += '
'; - - dlg.innerHTML = html; - - var submitted = false; - - dlg.querySelector('form').addEventListener('submit', function (e) { - - saveJob(dlg, id, apiClient); - e.preventDefault(); - return false; - }); - - dlg.querySelector('.btnCancel').addEventListener('click', function () { - dialogHelper.close(dlg); - }); - - if (layoutManager.tv) { - scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false); - } - - function onSyncJobMessage(e, apiClient, msg) { - loadJobInfo(dlg, msg.Job, msg.JobItems, apiClient); - } - - loadJob(dlg, id, apiClient); - bindEvents(dlg, id, apiClient); - - var promise = dialogHelper.open(dlg); - - startListening(apiClient, id); - events.on(serverNotifications, "SyncJob", onSyncJobMessage); - - return promise.then(function () { - - stopListening(apiClient); - events.off(serverNotifications, "SyncJob", onSyncJobMessage); - - if (layoutManager.tv) { - scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false); - } - - if (submitted) { - return Promise.resolve(); - } - return Promise.reject(); - }); - } - - return { - show: showEditor - }; - -}); \ No newline at end of file diff --git a/src/bower_components/emby-webcomponents/sync/syncjoblist.js b/src/bower_components/emby-webcomponents/sync/syncjoblist.js deleted file mode 100644 index 9ae477fb50..0000000000 --- a/src/bower_components/emby-webcomponents/sync/syncjoblist.js +++ /dev/null @@ -1,455 +0,0 @@ -define(['serverNotifications', 'events', 'loading', 'connectionManager', 'imageLoader', 'dom', 'globalize', 'registrationServices', 'layoutManager', 'listViewStyle'], function (serverNotifications, events, loading, connectionManager, imageLoader, dom, globalize, registrationServices, layoutManager) { - 'use strict'; - - function onSyncJobCreated(e, apiClient, data) { - var listInstance = this; - fetchData(listInstance); - } - function onSyncJobUpdated(e, apiClient, data) { - var listInstance = this; - - refreshJob(listInstance, data); - } - function onSyncJobCancelled(e, apiClient, data) { - var listInstance = this; - fetchData(listInstance); - } - - function refreshList(listInstance, jobs) { - for (var i = 0, length = jobs.length; i < length; i++) { - - var job = jobs[i]; - refreshJob(listInstance, job); - } - } - - function syncNow() { - require(['localsync'], function (localSync) { - localSync.sync(); - }); - } - - function cancelJob(listInstance, id) { - - require(['confirm'], function (confirm) { - - var msg = globalize.translate('sharedcomponents#ConfirmRemoveDownload'); - - confirm({ - - text: msg, - primary: 'cancel' - - }).then(function () { - - loading.show(); - var apiClient = getApiClient(listInstance); - - apiClient.ajax({ - - url: apiClient.getUrl('Sync/Jobs/' + id), - type: 'DELETE' - - }).then(function () { - - if (listInstance.options.mode === 'download') { - syncNow(); - } - - fetchData(listInstance); - }); - }); - }); - } - - function refreshJob(listInstance, job) { - - var listItem = listInstance.options.element.querySelector('.listItem[data-id=\'' + job.Id + '\']'); - - if (!listItem) { - return; - } - - listItem.querySelector('.jobStatus').innerHTML = getProgressText(job); - } - - function getProgressText(job) { - - var status = job.Status; - - if (status === 'Completed') { - status = 'Synced'; - } - - var html = globalize.translate('sharedcomponents#SyncJobItemStatus' + status); - - if (job.Status === 'Transferring' || job.Status === 'Converting' || job.Status === 'Completed') { - html += ' '; - - var progress = job.Progress || 0; - if (progress > 0 && progress < 100) { - progress = progress.toFixed(1); - } - html += progress + '%'; - } - - return html; - } - - function getSyncJobHtml(listInstance, job, apiClient) { - - var html = ''; - - var tagName = layoutManager.tv ? 'button' : 'div'; - var typeAttribute = tagName === 'button' ? ' type="button"' : ''; - - var listItemClass = 'listItem listItem-border'; - - if (layoutManager.tv) { - listItemClass += ' listItem-button listItem-focusscale'; - - listItemClass += ' btnJobMenu'; - } - - var canEdit = (job.ItemCount || 1) > 1 || job.Status === 'Queued'; - html += '<' + tagName + typeAttribute + ' class="' + listItemClass + '" data-canedit="' + canEdit + '" data-id="' + job.Id + '" data-status="' + job.Status + '">'; - - var imgUrl; - - if (job.PrimaryImageItemId) { - - imgUrl = apiClient.getImageUrl(job.PrimaryImageItemId, { - type: "Primary", - width: 80, - tag: job.PrimaryImageTag, - minScale: 1.5 - }); - } - - if (imgUrl) { - html += '
'; - html += '
'; - } - else { - html += 'file_download'; - } - - var textLines = []; - - var name = job.Name; - - if (job.ParentName) { - name += ' - ' + job.ParentName; - } - - textLines.push(name); - - if (job.ItemCount === 1) { - //textLines.push(globalize.translate('sharedcomponents#ValueOneItem')); - } else { - textLines.push(globalize.translate('sharedcomponents#ItemCount', job.ItemCount)); - } - - html += '
'; - - for (var i = 0, length = textLines.length; i < length; i++) { - - if (i === 0) { - html += '

'; - html += textLines[i]; - html += '

'; - } else { - html += '
'; - html += textLines[i]; - html += '
'; - } - } - - html += '
'; - html += getProgressText(job); - html += '
'; - - html += '
'; - - if (!layoutManager.tv) { - - if (canEdit) { - html += ''; - } else { - html += ''; - } - } - - html += ''; - - return html; - } - - function renderList(listInstance, jobs, apiClient) { - - if ((new Date().getTime() - listInstance.lastDataLoad) < 60000) { - refreshList(listInstance, jobs); - return; - } - - listInstance.lastDataLoad = new Date().getTime(); - - var html = ''; - var lastTargetName = ''; - - var mode = listInstance.options.mode; - var showTargetName = mode !== 'download'; - - var hasOpenSection = false; - - for (var i = 0, length = jobs.length; i < length; i++) { - - var job = jobs[i]; - if (showTargetName) { - var targetName = job.TargetName || 'Unknown'; - - if (targetName !== lastTargetName) { - - if (lastTargetName) { - html += '
'; - html += '
'; - hasOpenSection = false; - } - - lastTargetName = targetName; - - html += '
'; - html += '
'; - - html += '

' + targetName + '

'; - - html += '
'; - html += '
'; - hasOpenSection = true; - } - } - - html += getSyncJobHtml(listInstance, job, apiClient); - } - - if (hasOpenSection) { - html += '
'; - html += '
'; - } - - var elem = listInstance.options.element.querySelector('.syncJobListContent'); - - if (!html) { - if (mode === 'download') { - html = '
' + globalize.translate('sharedcomponents#MessageNoDownloadsFound') + '
'; - } else { - html = '
' + globalize.translate('sharedcomponents#MessageNoSyncJobsFound') + '
'; - } - } - - elem.innerHTML = html; - - imageLoader.lazyChildren(elem); - } - - function fetchData(listInstance) { - - listInstance.lastDataLoad = 0; - loading.show(); - - var options = {}; - var apiClient = getApiClient(listInstance); - - if (listInstance.options.userId) { - options.UserId = listInstance.options.userId; - } - - if (listInstance.options.mode === 'download') { - options.TargetId = apiClient.deviceId(); - } - - return apiClient.getJSON(apiClient.getUrl('Sync/Jobs', options)).then(function (response) { - - renderList(listInstance, response.Items, apiClient); - loading.hide(); - }); - } - - function getApiClient(listInstance) { - return connectionManager.getApiClient(listInstance.options.serverId); - } - - function showJobMenu(listInstance, elem) { - - var item = dom.parentWithClass(elem, 'listItem'); - var jobId = item.getAttribute('data-id'); - var status = item.getAttribute('data-status'); - - var menuItems = []; - - if (item.getAttribute('data-canedit') === 'true') { - menuItems.push({ - name: globalize.translate('sharedcomponents#Edit'), - id: 'edit' - }); - } - - var txt = globalize.translate('sharedcomponents#RemoveDownload'); - - menuItems.push({ - name: txt, - id: 'cancel' - }); - - require(['actionsheet'], function (actionsheet) { - - actionsheet.show({ - items: menuItems, - positionTo: elem, - callback: function (id) { - - switch (id) { - - case 'delete': - cancelJob(listInstance, jobId); - break; - case 'cancel': - cancelJob(listInstance, jobId); - break; - case 'edit': - showJobEditor(listInstance, elem); - break; - default: - break; - } - } - }); - - }); - } - - function onElementClick(e) { - - var listInstance = this; - - var btnJobMenu = dom.parentWithClass(e.target, 'btnJobMenu'); - if (btnJobMenu) { - showJobMenu(listInstance, btnJobMenu); - return; - } - - var btnCancelJob = dom.parentWithClass(e.target, 'btnCancelJob'); - if (btnCancelJob) { - var listItem = dom.parentWithClass(btnCancelJob, 'listItem'); - if (listItem) { - var jobId = listItem.getAttribute('data-id'); - cancelJob(listInstance, jobId); - } - return; - } - - showJobEditor(listInstance, e.target); - } - - function showJobEditor(listInstance, elem) { - - var listItem = dom.parentWithClass(elem, 'listItem'); - if (listItem && listItem.getAttribute('data-canedit') === 'true') { - var jobId = listItem.getAttribute('data-id'); - // edit job - require(['syncJobEditor'], function (syncJobEditor) { - syncJobEditor.show({ - - serverId: listInstance.options.serverId, - jobId: jobId, - mode: listInstance.options.mode - - }).then(function () { - fetchData(listInstance); - }); - }); - } - } - - function syncJobList(options) { - this.options = options; - - var onSyncJobCreatedHandler = onSyncJobCreated.bind(this); - this.onSyncJobCreatedHandler = onSyncJobCreatedHandler; - events.on(serverNotifications, 'SyncJobCreated', onSyncJobCreatedHandler); - - var onSyncJobCancelledHandler = onSyncJobCancelled.bind(this); - this.onSyncJobCancelledHandler = onSyncJobCancelledHandler; - events.on(serverNotifications, 'SyncJobCancelled', onSyncJobCancelledHandler); - - var onSyncJobUpdatedHandler = onSyncJobUpdated.bind(this); - this.onSyncJobUpdatedHandler = onSyncJobUpdatedHandler; - events.on(serverNotifications, 'SyncJobUpdated', onSyncJobUpdatedHandler); - - var onClickHandler = onElementClick.bind(this); - options.element.addEventListener('click', onClickHandler); - this.onClickHandler = onClickHandler; - - options.element.innerHTML = '
'; - - fetchData(this); - - initSupporterInfo(options.element, getApiClient(this)); - } - - function showSupporterInfo(context) { - - var html = ' - - -
-
- -
- - - \ No newline at end of file From f40d74725f25cf1bf39bc48cfe2f7c1bf28ff226 Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 21 Jan 2019 18:50:39 +0900 Subject: [PATCH 4/9] remove camera upload page from dashboard --- src/dashboard/devicesupload.js | 40 ------------------------------- src/devicesupload.html | 44 ---------------------------------- src/scripts/librarymenu.js | 6 ----- src/scripts/site.js | 5 ---- 4 files changed, 95 deletions(-) delete mode 100644 src/dashboard/devicesupload.js delete mode 100644 src/devicesupload.html diff --git a/src/dashboard/devicesupload.js b/src/dashboard/devicesupload.js deleted file mode 100644 index 572f5ac602..0000000000 --- a/src/dashboard/devicesupload.js +++ /dev/null @@ -1,40 +0,0 @@ -define(["jQuery", "loading", "libraryMenu", "fnchecked"], function($, loading, libraryMenu) { - "use strict"; - - function load(page, config) { - $("#txtUploadPath", page).val(config.CameraUploadPath || ""), $("#chkSubfolder", page).checked(config.EnableCameraUploadSubfolders) - } - - function loadData(page) { - loading.show(), ApiClient.getNamedConfiguration("devices").then(function(config) { - load(page, config), loading.hide() - }) - } - - function save(page) { - ApiClient.getNamedConfiguration("devices").then(function(config) { - config.CameraUploadPath = $("#txtUploadPath", page).val(), config.EnableCameraUploadSubfolders = $("#chkSubfolder", page).checked(), ApiClient.updateNamedConfiguration("devices", config).then(Dashboard.processServerConfigurationUpdateResult) - }) - } - - function onSubmit() { - return save($(this).parents(".page")), !1 - } - $(document).on("pageinit", "#devicesUploadPage", function() { - var page = this; - $("#btnSelectUploadPath", page).on("click.selectDirectory", function() { - require(["directorybrowser"], function(directoryBrowser) { - var picker = new directoryBrowser; - picker.show({ - callback: function(path) { - path && $("#txtUploadPath", page).val(path), picker.close() - }, - validateWriteable: !0, - header: Globalize.translate("HeaderSelectUploadPath") - }) - }) - }), $(".devicesUploadForm").off("submit", onSubmit).on("submit", onSubmit) - }).on("pageshow", "#devicesUploadPage", function() { - loadData(this) - }) -}); \ No newline at end of file diff --git a/src/devicesupload.html b/src/devicesupload.html deleted file mode 100644 index 21e7aa0784..0000000000 --- a/src/devicesupload.html +++ /dev/null @@ -1,44 +0,0 @@ -
- -
-
- -
- -
-
-

${TabCameraUpload}

- ${Help} -
- -

${HeaderCameraUploadHelp}

-
- -
-
-
-
- -
- -
-
${DefaultCameraUploadPathHelp}
-
-
- -
${LabelCreateCameraUploadSubfolderHelp}
-
-
-
- -
- -
-
-
-
\ No newline at end of file diff --git a/src/scripts/librarymenu.js b/src/scripts/librarymenu.js index ac08e68205..9cca8e328a 100644 --- a/src/scripts/librarymenu.js +++ b/src/scripts/librarymenu.js @@ -311,12 +311,6 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", " pageIds: ["devicesPage", "devicePage"], icon: "devices" }); - links.push({ - name: globalize.translate("TabCameraUpload"), - href: "devicesupload.html", - pageIds: ["devicesUploadPage"], - icon: "photo_camera" - }); links.push({ name: globalize.translate("DLNA"), href: "dlnasettings.html", diff --git a/src/scripts/site.js b/src/scripts/site.js index cecab91a65..7cb890ca21 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -492,11 +492,6 @@ var Dashboard = { autoFocus: !1, roles: "admin", controller: "devices/device" - }), defineRoute({ - path: "/devicesupload.html", - dependencies: [], - autoFocus: !1, - roles: "admin" }), defineRoute({ path: "/dlnaprofile.html", dependencies: [], From 68926062b073e2d38d764e849bfb2f48bf0319a4 Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 21 Jan 2019 20:53:52 +0900 Subject: [PATCH 5/9] basic minification for apphost web component dependency section --- src/components/apphost.js | 41 ++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/components/apphost.js b/src/components/apphost.js index 1bf7e32ff8..d09d361a6e 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -117,13 +117,40 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett var htmlMediaAutoplayAppStorageKey = "supportshtmlmediaautoplay0", supportedFeatures = function() { var features = []; - return navigator.share && features.push("sharing"), browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload"), browser.operaTv || browser.tizen || browser.orsay || browser.web0s ? features.push("exit") : (features.push("exitmenu"), features.push("plugins")), browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.ps4 || (features.push("externallinks"), features.push("externalpremium")), browser.operaTv || features.push("externallinkdisplay"), supportsVoiceInput() && features.push("voiceinput"), !browser.tv && !browser.xboxOne && browser.ps4, supportsHtmlMediaAutoplay() && (features.push("htmlaudioautoplay"), features.push("htmlvideoautoplay")), browser.edgeUwp && features.push("sync"), supportsFullscreen() && features.push("fullscreenchange"), (browser.chrome || browser.edge && !browser.slow) && (browser.noAnimation || browser.edgeUwp || browser.xboxOne || features.push("imageanalysis")), AppInfo.isNativeApp && features.push("multiserver"), (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) && features.push("physicalvolumecontrol"), browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol"), browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo"), features.push("otherapppromotions"), features.push("targetblank"), browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings"), browser.orsay || browser.tizen || features.push("subtitleburnsettings"), browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput"), AppInfo.isNativeApp && features.push("displaylanguage"), browser.chrome && features.push("chromecast"), features - }(); - 1 === supportedFeatures.indexOf("htmlvideoautoplay") && !1 !== supportsHtmlMediaAutoplay() && require(["autoPlayDetect"], function(autoPlayDetect) { - autoPlayDetect.supportsHtmlMediaAutoplay().then(function() { - appSettings.set(htmlMediaAutoplayAppStorageKey, "true"), supportedFeatures.push("htmlvideoautoplay"), supportedFeatures.push("htmlaudioautoplay") - }, function() { - appSettings.set(htmlMediaAutoplayAppStorageKey, "false") - }) + return navigator.share && features.push("sharing"); + browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload"); + browser.operaTv || browser.tizen || browser.orsay || browser.web0s + ? features.push("exit") + : (features.push("exitmenu"), features.push("plugins")); + browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.ps4 || (features.push("externallinks"), features.push("externalpremium")); + browser.operaTv || features.push("externallinkdisplay"); + supportsVoiceInput() && features.push("voiceinput"); + !browser.tv && !browser.xboxOne && browser.ps4, supportsHtmlMediaAutoplay() && (features.push("htmlaudioautoplay"), features.push("htmlvideoautoplay")); + browser.edgeUwp && features.push("sync"); + supportsFullscreen() && features.push("fullscreenchange"); + (browser.chrome || browser.edge && !browser.slow) && (browser.noAnimation || browser.edgeUwp || browser.xboxOne || features.push("imageanalysis")); + AppInfo.isNativeApp && features.push("multiserver"); + (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) && features.push("physicalvolumecontrol"); + browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol"); + browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo"); + features.push("otherapppromotions"); + features.push("targetblank"); + browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings"); + browser.orsay || browser.tizen || features.push("subtitleburnsettings"); + browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput"); + AppInfo.isNativeApp && features.push("displaylanguage"); + browser.chrome && features.push("chromecast"); + }(); + if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) { + require(["autoPlayDetect"], function(autoPlayDetect) { + autoPlayDetect.supportsHtmlMediaAutoplay().then(function() { + appSettings.set(htmlMediaAutoplayAppStorageKey, "true"); + supportedFeatures.push("htmlvideoautoplay"); + supportedFeatures.push("htmlaudioautoplay"); + }, function() { + appSettings.set(htmlMediaAutoplayAppStorageKey, "false"); + }); + } }); var deviceId, deviceName, visibilityChange, visibilityState, appVersion = window.dashboardVersion || "3.0", appHost = { From 60b70ad0c9bcffc6f0ff01aea3d41feb36d3383c Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 21 Jan 2019 20:54:43 +0900 Subject: [PATCH 6/9] remove native app check for web clients --- src/components/apphost.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/apphost.js b/src/components/apphost.js index d09d361a6e..c8b98ba74d 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -129,7 +129,6 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett browser.edgeUwp && features.push("sync"); supportsFullscreen() && features.push("fullscreenchange"); (browser.chrome || browser.edge && !browser.slow) && (browser.noAnimation || browser.edgeUwp || browser.xboxOne || features.push("imageanalysis")); - AppInfo.isNativeApp && features.push("multiserver"); (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) && features.push("physicalvolumecontrol"); browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol"); browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo"); @@ -138,7 +137,6 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings"); browser.orsay || browser.tizen || features.push("subtitleburnsettings"); browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput"); - AppInfo.isNativeApp && features.push("displaylanguage"); browser.chrome && features.push("chromecast"); }(); if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) { From cb9f250d32c37f9022cff7dfddda8093d18df44a Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 22 Jan 2019 02:24:12 +0900 Subject: [PATCH 7/9] add suggested changes and fix a return statement --- .../emby-apiclient/sync/serversync.js | 2 +- src/components/apphost.js | 23 ++++++++++--------- src/scripts/site.js | 12 +++++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/bower_components/emby-apiclient/sync/serversync.js b/src/bower_components/emby-apiclient/sync/serversync.js index dacc70f73c..34a1b11e8e 100644 --- a/src/bower_components/emby-apiclient/sync/serversync.js +++ b/src/bower_components/emby-apiclient/sync/serversync.js @@ -12,7 +12,7 @@ define([], function() { } function uploadContent(connectionManager, server, options) { - return new Promise().resolve(); + return new Promise().reject(); } function syncMedia(connectionManager, server, options) { diff --git a/src/components/apphost.js b/src/components/apphost.js index c8b98ba74d..478f7a4f92 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -114,10 +114,10 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett function onAppHidden() { _isHidden || (_isHidden = !0, console.log("app is hidden")) } - var htmlMediaAutoplayAppStorageKey = "supportshtmlmediaautoplay0", + var htmlMediaAutoplayAppStorageKey = "supportshtmlmediaautoplay0"; supportedFeatures = function() { var features = []; - return navigator.share && features.push("sharing"); + navigator.share && features.push("sharing"); browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload"); browser.operaTv || browser.tizen || browser.orsay || browser.web0s ? features.push("exit") @@ -138,18 +138,19 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett browser.orsay || browser.tizen || features.push("subtitleburnsettings"); browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput"); browser.chrome && features.push("chromecast"); + return features; }(); if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) { require(["autoPlayDetect"], function(autoPlayDetect) { - autoPlayDetect.supportsHtmlMediaAutoplay().then(function() { - appSettings.set(htmlMediaAutoplayAppStorageKey, "true"); - supportedFeatures.push("htmlvideoautoplay"); - supportedFeatures.push("htmlaudioautoplay"); - }, function() { - appSettings.set(htmlMediaAutoplayAppStorageKey, "false"); - }); - } - }); + autoPlayDetect.supportsHtmlMediaAutoplay().then(function() { + appSettings.set(htmlMediaAutoplayAppStorageKey, "true"); + supportedFeatures.push("htmlvideoautoplay"); + supportedFeatures.push("htmlaudioautoplay"); + }, function() { + appSettings.set(htmlMediaAutoplayAppStorageKey, "false"); + }); + } + }); var deviceId, deviceName, visibilityChange, visibilityState, appVersion = window.dashboardVersion || "3.0", appHost = { getWindowState: function() { diff --git a/src/scripts/site.js b/src/scripts/site.js index 7cb890ca21..c1ad0150fb 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -213,9 +213,15 @@ var Dashboard = { function getSettingsBuilder(UserSettings, layoutManager, browser) { UserSettings.prototype.enableThemeVideos = function(val) { - return null != val - ? this.set("enableThemeVideos", val.toString(), !1) - : (val = this.get("enableThemeVideos", !1), val ? "false" !== val : !layoutManager.mobile && !browser.slow); + if (val != null) { + return this.set('enableThemeVideos', val.toString(), false); + } + val = this.get('enableThemeVideos', false); + if (val !== 'false') { + return !layoutManager.mobile; + } else { + return !browser.slow; + } }; return UserSettings; } From c51d005a4d9a2c06277ff0aac0888ba6257ddbea Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 22 Jan 2019 02:33:17 +0900 Subject: [PATCH 8/9] more deminification and update dashboard button on header --- src/components/apphost.js | 202 +++++++++++++++++++------------------ src/scripts/librarymenu.js | 2 +- 2 files changed, 106 insertions(+), 98 deletions(-) diff --git a/src/components/apphost.js b/src/components/apphost.js index 478f7a4f92..21dd1fc382 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -108,110 +108,118 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett } function onAppVisible() { - _isHidden && (_isHidden = !1, console.log("triggering app resume event"), events.trigger(appHost, "resume")) + isHidden && (isHidden = false, console.log("triggering app resume event"), events.trigger(appHost, "resume")); } function onAppHidden() { - _isHidden || (_isHidden = !0, console.log("app is hidden")) + isHidden || (isHidden = true, console.log("app is hidden")); } + var htmlMediaAutoplayAppStorageKey = "supportshtmlmediaautoplay0"; - supportedFeatures = function() { - var features = []; - navigator.share && features.push("sharing"); - browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload"); - browser.operaTv || browser.tizen || browser.orsay || browser.web0s - ? features.push("exit") - : (features.push("exitmenu"), features.push("plugins")); - browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.ps4 || (features.push("externallinks"), features.push("externalpremium")); - browser.operaTv || features.push("externallinkdisplay"); - supportsVoiceInput() && features.push("voiceinput"); - !browser.tv && !browser.xboxOne && browser.ps4, supportsHtmlMediaAutoplay() && (features.push("htmlaudioautoplay"), features.push("htmlvideoautoplay")); - browser.edgeUwp && features.push("sync"); - supportsFullscreen() && features.push("fullscreenchange"); - (browser.chrome || browser.edge && !browser.slow) && (browser.noAnimation || browser.edgeUwp || browser.xboxOne || features.push("imageanalysis")); - (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) && features.push("physicalvolumecontrol"); - browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol"); - browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo"); - features.push("otherapppromotions"); - features.push("targetblank"); - browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings"); - browser.orsay || browser.tizen || features.push("subtitleburnsettings"); - browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput"); - browser.chrome && features.push("chromecast"); - return features; - }(); - if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) { - require(["autoPlayDetect"], function(autoPlayDetect) { - autoPlayDetect.supportsHtmlMediaAutoplay().then(function() { - appSettings.set(htmlMediaAutoplayAppStorageKey, "true"); - supportedFeatures.push("htmlvideoautoplay"); - supportedFeatures.push("htmlaudioautoplay"); - }, function() { - appSettings.set(htmlMediaAutoplayAppStorageKey, "false"); - }); - } - }); - var deviceId, deviceName, visibilityChange, visibilityState, appVersion = window.dashboardVersion || "3.0", - appHost = { - getWindowState: function() { - return document.windowState || "Normal" - }, - setWindowState: function(state) { - alert("setWindowState is not supported and should not be called") - }, - exit: function() { - if (browser.tizen) try { - tizen.application.getCurrentApplication().exit() - } catch (err) { - console.log("error closing application: " + err) - } else window.close() - }, - supports: function(command) { - return -1 !== supportedFeatures.indexOf(command.toLowerCase()) - }, - preferVisualCards: browser.android || browser.chrome, - moreIcon: browser.android ? "dots-vert" : "dots-horiz", - getSyncProfile: getSyncProfile, - getDefaultLayout: getDefaultLayout, - getDeviceProfile: getDeviceProfile, - init: function() { - return deviceName = getDeviceName(), getDeviceId().then(function(resolvedDeviceId) { - deviceId = resolvedDeviceId - }) - }, - deviceName: function() { - return deviceName - }, - deviceId: function() { - return deviceId - }, - appName: function() { - return "Jellyfin Web" - }, - appVersion: function() { - return appVersion - }, - getPushTokenInfo: function() { - return {} - }, - setThemeColor: function(color) { - var metaThemeColor = document.querySelector("meta[name=theme-color]"); - metaThemeColor && metaThemeColor.setAttribute("content", color) - }, - setUserScalable: function(scalable) { - if (!browser.tv) { - var att = scalable ? "width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes" : "width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"; - document.querySelector("meta[name=viewport]").setAttribute("content", att) - } - }, - deviceIconUrl: function() { - return browser.edgeUwp, browser.edgeUwp ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/windowsrt.png" : browser.opera || browser.operaTv ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/opera.png" : browser.orsay || browser.tizen ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/samsungtv.png" : browser.web0s ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/lgtv.png" : browser.ps4 ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/ps4.png" : browser.chromecast ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chromecast.png" : browser.chrome ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chrome.png" : browser.edge ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/edge.png" : browser.firefox ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/firefox.png" : browser.msie ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/internetexplorer.png" : browser.safari ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/safari.png" : "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/html5.png" + var supportedFeatures = function() { + var features = []; + navigator.share && features.push("sharing"); + browser.edgeUwp || browser.tv || browser.xboxOne || browser.ps4 || features.push("filedownload"); + browser.operaTv || browser.tizen || browser.orsay || browser.web0s + ? features.push("exit") + : (features.push("exitmenu"), features.push("plugins")); + browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.ps4 || (features.push("externallinks"), features.push("externalpremium")); + browser.operaTv || features.push("externallinkdisplay"); + supportsVoiceInput() && features.push("voiceinput"); + !browser.tv && !browser.xboxOne && browser.ps4, supportsHtmlMediaAutoplay() && (features.push("htmlaudioautoplay"), features.push("htmlvideoautoplay")); + browser.edgeUwp && features.push("sync"); + supportsFullscreen() && features.push("fullscreenchange"); + (browser.chrome || browser.edge && !browser.slow) && (browser.noAnimation || browser.edgeUwp || browser.xboxOne || features.push("imageanalysis")); + (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) && features.push("physicalvolumecontrol"); + browser.tv || browser.xboxOne || browser.ps4 || features.push("remotecontrol"); + browser.operaTv || browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp || features.push("remotevideo"); + features.push("otherapppromotions"); + features.push("targetblank"); + browser.orsay || browser.tizen || browser.msie || !(browser.firefox || browser.ps4 || browser.edge || cueSupported()) || features.push("subtitleappearancesettings"); + browser.orsay || browser.tizen || features.push("subtitleburnsettings"); + browser.tv || browser.ps4 || browser.xboxOne || features.push("fileinput"); + browser.chrome && features.push("chromecast"); + return features; + }(); + if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) { + require(["autoPlayDetect"], function(autoPlayDetect) { + autoPlayDetect.supportsHtmlMediaAutoplay().then(function() { + appSettings.set(htmlMediaAutoplayAppStorageKey, "true"); + supportedFeatures.push("htmlvideoautoplay"); + supportedFeatures.push("htmlaudioautoplay"); + }, function() { + appSettings.set(htmlMediaAutoplayAppStorageKey, "false"); + }); + } + }); + + var deviceId; + var deviceName; + var visibilityChange; + var visibilityState; + var appVersion = window.dashboardVersion || "3.0"; + var appHost = { + getWindowState: function() { + return document.windowState || "Normal" + }, + setWindowState: function(state) { + alert("setWindowState is not supported and should not be called") + }, + exit: function() { + if (browser.tizen) try { + tizen.application.getCurrentApplication().exit() + } catch (err) { + console.log("error closing application: " + err) + } else window.close() + }, + supports: function(command) { + return -1 !== supportedFeatures.indexOf(command.toLowerCase()) + }, + preferVisualCards: browser.android || browser.chrome, + moreIcon: browser.android ? "dots-vert" : "dots-horiz", + getSyncProfile: getSyncProfile, + getDefaultLayout: getDefaultLayout, + getDeviceProfile: getDeviceProfile, + init: function() { + return deviceName = getDeviceName(), getDeviceId().then(function(resolvedDeviceId) { + deviceId = resolvedDeviceId + }) + }, + deviceName: function() { + return deviceName + }, + deviceId: function() { + return deviceId + }, + appName: function() { + return "Jellyfin Web" + }, + appVersion: function() { + return appVersion + }, + getPushTokenInfo: function() { + return {} + }, + setThemeColor: function(color) { + var metaThemeColor = document.querySelector("meta[name=theme-color]"); + metaThemeColor && metaThemeColor.setAttribute("content", color) + }, + setUserScalable: function(scalable) { + if (!browser.tv) { + var att = scalable ? "width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes" : "width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"; + document.querySelector("meta[name=viewport]").setAttribute("content", att) } }, - doc = self.document; + deviceIconUrl: function() { + return browser.edgeUwp, browser.edgeUwp ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/windowsrt.png" : browser.opera || browser.operaTv ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/opera.png" : browser.orsay || browser.tizen ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/samsungtv.png" : browser.web0s ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/lgtv.png" : browser.ps4 ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/ps4.png" : browser.chromecast ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chromecast.png" : browser.chrome ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/chrome.png" : browser.edge ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/edge.png" : browser.firefox ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/firefox.png" : browser.msie ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/internetexplorer.png" : browser.safari ? "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/safari.png" : "https://github.com/MediaBrowser/Emby.Resources/raw/master/images/devices/html5.png" + } + }; + + var doc = self.document; doc && (void 0 !== doc.visibilityState ? (visibilityChange = "visibilitychange", visibilityState = "hidden") : void 0 !== doc.mozHidden ? (visibilityChange = "mozvisibilitychange", visibilityState = "mozVisibilityState") : void 0 !== doc.msHidden ? (visibilityChange = "msvisibilitychange", visibilityState = "msVisibilityState") : void 0 !== doc.webkitHidden && (visibilityChange = "webkitvisibilitychange", visibilityState = "webkitVisibilityState")); - var _isHidden = !1; - return doc && doc.addEventListener(visibilityChange, function() { + var isHidden = false; + doc && doc.addEventListener(visibilityChange, function() { document[visibilityState] ? onAppHidden() : onAppVisible() - }), self.addEventListener && (self.addEventListener("focus", onAppVisible), self.addEventListener("blur", onAppHidden)), appHost + }), self.addEventListener && (self.addEventListener("focus", onAppVisible), self.addEventListener("blur", onAppHidden)); + return appHost; }); diff --git a/src/scripts/librarymenu.js b/src/scripts/librarymenu.js index 9cca8e328a..042ae8aad2 100644 --- a/src/scripts/librarymenu.js +++ b/src/scripts/librarymenu.js @@ -919,7 +919,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", " html += ''; if (!layoutManager.mobile) { - html += ''; + html += ''; } html += ""; From b9d06ebf624b8e89ea1c7c32f1a230ace0802a01 Mon Sep 17 00:00:00 2001 From: dkanada Date: Thu, 24 Jan 2019 22:26:24 +0900 Subject: [PATCH 9/9] add suggested changes from code review --- src/components/apphost.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/components/apphost.js b/src/components/apphost.js index 21dd1fc382..5ebb6fbf19 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -108,11 +108,18 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett } function onAppVisible() { - isHidden && (isHidden = false, console.log("triggering app resume event"), events.trigger(appHost, "resume")); + if (isHidden) { + isHidden = false; + console.log("triggering app resume event"); + events.trigger(appHost, "resume"); + } } function onAppHidden() { - isHidden || (isHidden = true, console.log("app is hidden")); + if (!isHidden) { + isHidden = true; + console.log("app is hidden"); + } } var htmlMediaAutoplayAppStorageKey = "supportshtmlmediaautoplay0"; @@ -141,7 +148,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett browser.chrome && features.push("chromecast"); return features; }(); - if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !=== false) { + if (supportedFeatures.indexOf("htmlvideoautoplay") === -1 && supportsHtmlMediaAutoplay() !== false) { require(["autoPlayDetect"], function(autoPlayDetect) { autoPlayDetect.supportsHtmlMediaAutoplay().then(function() { appSettings.set(htmlMediaAutoplayAppStorageKey, "true"); @@ -218,8 +225,14 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function(appSett var doc = self.document; doc && (void 0 !== doc.visibilityState ? (visibilityChange = "visibilitychange", visibilityState = "hidden") : void 0 !== doc.mozHidden ? (visibilityChange = "mozvisibilitychange", visibilityState = "mozVisibilityState") : void 0 !== doc.msHidden ? (visibilityChange = "msvisibilitychange", visibilityState = "msVisibilityState") : void 0 !== doc.webkitHidden && (visibilityChange = "webkitvisibilitychange", visibilityState = "webkitVisibilityState")); var isHidden = false; - doc && doc.addEventListener(visibilityChange, function() { - document[visibilityState] ? onAppHidden() : onAppVisible() - }), self.addEventListener && (self.addEventListener("focus", onAppVisible), self.addEventListener("blur", onAppHidden)); + if (doc) { + doc.addEventListener(visibilityChange, function() { + document[visibilityState] ? onAppHidden() : onAppVisible() + }); + } + if (self.addEventListener) { + self.addEventListener("focus", onAppVisible); + self.addEventListener("blur", onAppHidden); + } return appHost; });