From 48058e8fff5d7194286d05651e64ad3598515dc8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 19 May 2016 10:37:59 -0400 Subject: [PATCH 1/3] support IntersectionObserver --- .../emby-webcomponents/.bower.json | 8 +- .../emby-webcomponents/images/imagehelper.js | 36 +++++++ .../emby-webcomponents/itemcontextmenu.js | 40 +++++++- .../emby-webcomponents/router.js | 4 +- .../emby-webcomponents/strings/en-US.json | 3 + .../viewmanager/viewcontainer-lite.js | 96 +++++++++---------- .../iron-a11y-announcer/.bower.json | 6 +- .../iron-selector/.bower.json | 4 +- 8 files changed, 135 insertions(+), 62 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index cd37d7b8b4..3d3e5f757b 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -16,12 +16,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.3.45", - "_release": "1.3.45", + "version": "1.3.48", + "_release": "1.3.48", "_resolution": { "type": "version", - "tag": "1.3.45", - "commit": "dbaa46e3aa38a939b82f305c61e875e1a30da2fe" + "tag": "1.3.48", + "commit": "0764e35340e4625a5af560b2f46468646a7d9d10" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js b/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js index d357d5d36b..aafe21fd78 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js +++ b/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js @@ -88,12 +88,48 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events'], functio target.addEventListener(type, handler, optionsOrCapture); } + function unveilWithIntersection(images) { + + var filledCount = 0; + + var observer = new IntersectionObserver(function (entries) { + for (var j = 0, length2 = entries.length; j < length2; j++) { + var entry = entries[j]; + var intersectionRatio = entry.intersectionRatio; + if (intersectionRatio) { + + var target = entry.target; + observer.unobserve(target); + fillImage(target); + filledCount++; + } + } + + if (filledCount >= images.length) { + //observer.disconnect(); + } + }, + { + /* Using default options. Details below */ + } + ); + // Start observing an element + for (var i = 0, length = images.length; i < length; i++) { + observer.observe(images[i]); + } + } + function unveilElements(images) { if (!images.length) { return; } + if (window.IntersectionObserver) { + unveilWithIntersection(images); + return; + } + var filledImages = []; var cancellationTokens = []; diff --git a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js index 305fb12543..ead7a4a4ae 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js +++ b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js @@ -11,7 +11,14 @@ define(['apphost', 'globalize', 'connectionManager'], function (appHost, globali var commands = []; - if (item.CanDownload && user.Policy.EnableContentDownloading && appHost.supports('filedownload')) { + if (item.CanDelete) { + commands.push({ + name: globalize.translate('sharedcomponents#Delete'), + id: 'delete' + }); + } + + if (item.CanDownload && appHost.supports('filedownload')) { commands.push({ name: globalize.translate('sharedcomponents#Download'), id: 'download' @@ -69,6 +76,14 @@ define(['apphost', 'globalize', 'connectionManager'], function (appHost, globali case 'refresh': { refresh(apiClient, itemId); + reject(); + break; + } + case 'delete': + { + deleteItem(apiClient, itemId).then(function () { + resolve(true); + }); break; } case 'share': @@ -83,11 +98,33 @@ define(['apphost', 'globalize', 'connectionManager'], function (appHost, globali break; } default: + reject(); break; } }); } + function deleteItem(apiClient, itemId) { + + return new Promise(function (resolve, reject) { + + var msg = globalize.translate('sharedcomponents#ConfirmDeleteItem'); + var title = globalize.translate('sharedcomponents#HeaderDeleteItem'); + + require(['confirm'], function (confirm) { + + confirm(msg, title).then(function () { + + apiClient.deleteItem(itemId).then(function () { + resolve(true); + }); + + }, reject); + + }); + }); + } + function refresh(apiClient, itemId) { apiClient.refreshItem(itemId, { @@ -97,7 +134,6 @@ define(['apphost', 'globalize', 'connectionManager'], function (appHost, globali MetadataRefreshMode: 'FullRefresh', ReplaceAllImages: false, ReplaceAllMetadata: true - }); require(['toast'], function (toast) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/router.js b/dashboard-ui/bower_components/emby-webcomponents/router.js index ffad2468bf..52c784be2f 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/router.js +++ b/dashboard-ui/bower_components/emby-webcomponents/router.js @@ -203,10 +203,10 @@ define(['loading', 'viewManager', 'skinManager', 'pluginManager', 'backdrop', 'b if (!isBackNav) { // Don't force a new view for home due to the back menu - if (route.type != 'home') { + //if (route.type != 'home') { onNewViewNeeded(); return; - } + //} } viewManager.tryRestoreView(currentRequest).then(function () { diff --git a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json index 3b2082f16a..a4cbd770d8 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json +++ b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json @@ -50,6 +50,9 @@ "Edit": "Edit", "Download": "Download", "Advanced": "Advanced", + "Delete": "Delete", + "HeaderDeleteItem": "Delete Item", + "ConfirmDeleteItem": "Deleting this item will delete it from both the file system and your media library. Are you sure you wish to continue?", "Refresh": "Refresh", "RefreshQueued": "Refresh queued." } \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/viewmanager/viewcontainer-lite.js b/dashboard-ui/bower_components/emby-webcomponents/viewmanager/viewcontainer-lite.js index a967c1ad58..cc1647d053 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/viewmanager/viewcontainer-lite.js +++ b/dashboard-ui/bower_components/emby-webcomponents/viewmanager/viewcontainer-lite.js @@ -112,76 +112,74 @@ define(['browser'], function (browser) { function slide(newAnimatedPage, oldAnimatedPage, transition, isBack) { - var timings = { - duration: 450, - iterations: 1, - easing: 'ease-out', - fill: 'both' - } + return new Promise(function (resolve, reject) { + var timings = { + duration: 450, + iterations: 1, + easing: 'ease-out' + } - var animations = []; + var animations = []; - if (oldAnimatedPage) { - var destination = isBack ? '100%' : '-100%'; + if (oldAnimatedPage) { + var destination = isBack ? '100%' : '-100%'; - animations.push(oldAnimatedPage.animate([ + animations.push(oldAnimatedPage.animate([ - { transform: 'none', offset: 0 }, - { transform: 'translate3d(' + destination + ', 0, 0)', offset: 1 } + { transform: 'none', offset: 0 }, + { transform: 'translate3d(' + destination + ', 0, 0)', offset: 1 } + + ], timings)); + } + + newAnimatedPage.classList.remove('hide'); + + var start = isBack ? '-100%' : '100%'; + + animations.push(newAnimatedPage.animate([ + + { transform: 'translate3d(' + start + ', 0, 0)', offset: 0 }, + { transform: 'none', offset: 1 } ], timings)); - } - newAnimatedPage.classList.remove('hide'); + currentAnimations = animations; - var start = isBack ? '-100%' : '100%'; - - animations.push(newAnimatedPage.animate([ - - { transform: 'translate3d(' + start + ', 0, 0)', offset: 0 }, - { transform: 'none', offset: 1 } - - ], timings)); - - currentAnimations = animations; - - return new Promise(function (resolve, reject) { animations[animations.length - 1].onfinish = resolve; }); } function fade(newAnimatedPage, oldAnimatedPage, transition, isBack) { - var timings = { - duration: 200, - iterations: 1, - easing: 'ease-out', - fill: 'both' - } + return new Promise(function (resolve, reject) { + var timings = { + duration: 200, + iterations: 1, + easing: 'ease-out' + } - var animations = []; + var animations = []; - if (oldAnimatedPage) { - animations.push(oldAnimatedPage.animate([ + if (oldAnimatedPage) { + animations.push(oldAnimatedPage.animate([ - { opacity: 1, offset: 0 }, - { opacity: 0, offset: 1 } + { opacity: 1, offset: 0 }, + { opacity: 0, offset: 1 } + + ], timings)); + } + + newAnimatedPage.classList.remove('hide'); + + animations.push(newAnimatedPage.animate([ + + { opacity: 0, offset: 0 }, + { opacity: 1, offset: 1 } ], timings)); - } - newAnimatedPage.classList.remove('hide'); + currentAnimations = animations; - animations.push(newAnimatedPage.animate([ - - { opacity: 0, offset: 0 }, - { opacity: 1, offset: 1 } - - ], timings)); - - currentAnimations = animations; - - return new Promise(function (resolve, reject) { animations[animations.length - 1].onfinish = resolve; }); } diff --git a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json index 1baafa9707..d0996a0614 100644 --- a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json +++ b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json @@ -30,14 +30,14 @@ "web-component-tester": "polymer/web-component-tester#^3.4.0" }, "ignore": [], - "homepage": "https://github.com/polymerelements/iron-a11y-announcer", + "homepage": "https://github.com/PolymerElements/iron-a11y-announcer", "_release": "1.0.4", "_resolution": { "type": "version", "tag": "v1.0.4", "commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9" }, - "_source": "git://github.com/polymerelements/iron-a11y-announcer.git", + "_source": "git://github.com/PolymerElements/iron-a11y-announcer.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-a11y-announcer" + "_originalSource": "PolymerElements/iron-a11y-announcer" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-selector/.bower.json b/dashboard-ui/bower_components/iron-selector/.bower.json index 955c9dc566..01c5a1084b 100644 --- a/dashboard-ui/bower_components/iron-selector/.bower.json +++ b/dashboard-ui/bower_components/iron-selector/.bower.json @@ -36,7 +36,7 @@ "tag": "v1.5.2", "commit": "18e8e12dcd9a4560de480562f65935feed334b86" }, - "_source": "git://github.com/PolymerElements/iron-selector.git", + "_source": "git://github.com/polymerelements/iron-selector.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-selector" + "_originalSource": "polymerelements/iron-selector" } \ No newline at end of file From b5883925e79a0558f9610f6194a2ed93dd0a45f3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 19 May 2016 13:27:39 -0400 Subject: [PATCH 2/3] support IntersectionObserver --- .../emby-webcomponents/.bower.json | 8 +- .../emby-webcomponents/images/imagehelper.js | 20 +- .../iron-a11y-announcer/.bower.json | 6 +- .../iron-selector/.bower.json | 4 +- .../paper-behaviors/.bower.json | 4 +- .../bower_components/paper-ripple/.bower.json | 6 +- .../bower_components/polymer/.bower.json | 2 +- dashboard-ui/itemdetails.html | 2 +- dashboard-ui/scripts/homeupcoming.js | 2 +- dashboard-ui/scripts/itemdetailpage.js | 263 ++++++++---------- dashboard-ui/scripts/sections.js | 9 +- dashboard-ui/scripts/site.js | 16 +- dashboard-ui/scripts/tvrecommended.js | 2 +- dashboard-ui/scripts/tvupcoming.js | 2 +- 14 files changed, 165 insertions(+), 181 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 3d3e5f757b..f24a52ad1b 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -16,12 +16,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.3.48", - "_release": "1.3.48", + "version": "1.3.49", + "_release": "1.3.49", "_resolution": { "type": "version", - "tag": "1.3.48", - "commit": "0764e35340e4625a5af560b2f46468646a7d9d10" + "tag": "1.3.49", + "commit": "9838b499815bcaf95d4d50c4476c3b95173ffc30" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js b/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js index aafe21fd78..1fa0235aab 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js +++ b/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js @@ -1,4 +1,4 @@ -define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events'], function (visibleinviewport, imageFetcher, layoutManager, events) { +define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events', 'browser'], function (visibleinviewport, imageFetcher, layoutManager, events, browser) { var thresholdX; var thresholdY; @@ -119,13 +119,29 @@ define(['visibleinviewport', 'imageFetcher', 'layoutManager', 'events'], functio } } + var supportsIntersectionObserver = function () { + + if (window.IntersectionObserver) { + + // The api exists in chrome 50 but doesn't work + if (browser.chrome) { + + var version = parseInt(browser.version.split('.')[0]); + return version >= 51; + } + return true; + } + + return false; + }(); + function unveilElements(images) { if (!images.length) { return; } - if (window.IntersectionObserver) { + if (supportsIntersectionObserver) { unveilWithIntersection(images); return; } diff --git a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json index d0996a0614..1baafa9707 100644 --- a/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json +++ b/dashboard-ui/bower_components/iron-a11y-announcer/.bower.json @@ -30,14 +30,14 @@ "web-component-tester": "polymer/web-component-tester#^3.4.0" }, "ignore": [], - "homepage": "https://github.com/PolymerElements/iron-a11y-announcer", + "homepage": "https://github.com/polymerelements/iron-a11y-announcer", "_release": "1.0.4", "_resolution": { "type": "version", "tag": "v1.0.4", "commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9" }, - "_source": "git://github.com/PolymerElements/iron-a11y-announcer.git", + "_source": "git://github.com/polymerelements/iron-a11y-announcer.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-a11y-announcer" + "_originalSource": "polymerelements/iron-a11y-announcer" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-selector/.bower.json b/dashboard-ui/bower_components/iron-selector/.bower.json index 01c5a1084b..955c9dc566 100644 --- a/dashboard-ui/bower_components/iron-selector/.bower.json +++ b/dashboard-ui/bower_components/iron-selector/.bower.json @@ -36,7 +36,7 @@ "tag": "v1.5.2", "commit": "18e8e12dcd9a4560de480562f65935feed334b86" }, - "_source": "git://github.com/polymerelements/iron-selector.git", + "_source": "git://github.com/PolymerElements/iron-selector.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-selector" + "_originalSource": "PolymerElements/iron-selector" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/paper-behaviors/.bower.json b/dashboard-ui/bower_components/paper-behaviors/.bower.json index 2b04bf9f8a..a6b333d335 100644 --- a/dashboard-ui/bower_components/paper-behaviors/.bower.json +++ b/dashboard-ui/bower_components/paper-behaviors/.bower.json @@ -45,7 +45,7 @@ "tag": "v1.0.11", "commit": "e3c1ab0c72905b58fb4d9adc2921ea73b5c085a5" }, - "_source": "git://github.com/PolymerElements/paper-behaviors.git", + "_source": "git://github.com/polymerelements/paper-behaviors.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/paper-behaviors" + "_originalSource": "polymerelements/paper-behaviors" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/paper-ripple/.bower.json b/dashboard-ui/bower_components/paper-ripple/.bower.json index 157225ee71..2f654d71c6 100644 --- a/dashboard-ui/bower_components/paper-ripple/.bower.json +++ b/dashboard-ui/bower_components/paper-ripple/.bower.json @@ -32,14 +32,14 @@ "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0" }, "ignore": [], - "homepage": "https://github.com/PolymerElements/paper-ripple", + "homepage": "https://github.com/polymerelements/paper-ripple", "_release": "1.0.5", "_resolution": { "type": "version", "tag": "v1.0.5", "commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5" }, - "_source": "git://github.com/PolymerElements/paper-ripple.git", + "_source": "git://github.com/polymerelements/paper-ripple.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/paper-ripple" + "_originalSource": "polymerelements/paper-ripple" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json index bbad7fe7ba..3e8a4009a3 100644 --- a/dashboard-ui/bower_components/polymer/.bower.json +++ b/dashboard-ui/bower_components/polymer/.bower.json @@ -34,6 +34,6 @@ "commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514" }, "_source": "git://github.com/Polymer/polymer.git", - "_target": "^1.1.0", + "_target": "^1.0.0", "_originalSource": "Polymer/polymer" } \ No newline at end of file diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html index b019513c0c..7ed1d65a17 100644 --- a/dashboard-ui/itemdetails.html +++ b/dashboard-ui/itemdetails.html @@ -1,4 +1,4 @@ -
+
diff --git a/dashboard-ui/scripts/homeupcoming.js b/dashboard-ui/scripts/homeupcoming.js index 3be899f292..77c2b4deb9 100644 --- a/dashboard-ui/scripts/homeupcoming.js +++ b/dashboard-ui/scripts/homeupcoming.js @@ -10,7 +10,7 @@ UserId: Dashboard.getCurrentUserId(), ImageTypeLimit: 1, EnableImageTypes: "Primary,Backdrop,Banner,Thumb", - EnableTotalRecordCount: 0 + EnableTotalRecordCount: false }; ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).then(function (result) { diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 88e201b3c7..ccff7c76fe 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -2,33 +2,33 @@ var currentItem; - function getPromise() { + function getPromise(params) { - var id = getParameterByName('id'); + var id = params.id; if (id) { return ApiClient.getItem(Dashboard.getCurrentUserId(), id); } - var name = getParameterByName('genre'); + var name = params.genre; if (name) { return ApiClient.getGenre(name, Dashboard.getCurrentUserId()); } - name = getParameterByName('musicgenre'); + name = params.musicgenre; if (name) { return ApiClient.getMusicGenre(name, Dashboard.getCurrentUserId()); } - name = getParameterByName('gamegenre'); + name = params.gamegenre; if (name) { return ApiClient.getGameGenre(name, Dashboard.getCurrentUserId()); } - name = getParameterByName('musicartist'); + name = params.musicartist; if (name) { return ApiClient.getArtist(name, Dashboard.getCurrentUserId()); @@ -38,21 +38,21 @@ } } - function reload(page) { + function reload(page, params) { Dashboard.showLoadingMsg(); - getPromise().then(function (item) { + getPromise(params).then(function (item) { - reloadFromItem(page, item); + reloadFromItem(page, params, item); }); } - function reloadFromItem(page, item) { + function reloadFromItem(page, params, item) { currentItem = item; - var context = getContext(item); + var context = params.context; LibraryMenu.setBackButtonVisible(true); LibraryMenu.setMenuButtonVisible(false); @@ -300,11 +300,6 @@ } - function getContext(item) { - - return getParameterByName('context'); - } - function renderNextUp(page, item, user) { var section = page.querySelector('.nextUpSection'); @@ -1935,9 +1930,7 @@ }); } - function splitVersions(page) { - - var id = getParameterByName('id'); + function splitVersions(page, params) { require(['confirm'], function (confirm) { @@ -1947,13 +1940,13 @@ ApiClient.ajax({ type: "DELETE", - url: ApiClient.getUrl("Videos/" + id + "/AlternateSources") + url: ApiClient.getUrl("Videos/" + params.id + "/AlternateSources") }).then(function () { Dashboard.hideLoadingMsg(); - reload(page); + reload(page, params); }); }); }); @@ -2002,7 +1995,7 @@ LibraryBrowser.showPlayMenu(button, currentItem.Id, currentItem.Type, currentItem.IsFolder, mediaType, userdata.PlaybackPositionTicks); } - function deleteTimer(page, id) { + function deleteTimer(page, params, id) { require(['confirm'], function (confirm) { @@ -2016,129 +2009,12 @@ toast(Globalize.translate('MessageRecordingCancelled')); }); - reload(page); + reload(page, params); }); }); }); } - pageIdOn('pageinit', "itemDetailPage", function () { - - var page = this; - - $('.btnPlay', page).on('click', function () { - playCurrentItem(this); - }); - - $('.btnPlayTrailer', page).on('click', function () { - playTrailer(page); - }); - - $('.btnSplitVersions', page).on('click', function () { - - splitVersions(page); - }); - - $('.btnSync', page).on('click', function () { - - require(['syncDialog'], function (syncDialog) { - syncDialog.showMenu({ - items: [currentItem] - }); - }); - }); - - $('.btnRecord,.btnFloatingRecord', page).on('click', function () { - - var id = getParameterByName('id'); - Dashboard.showLoadingMsg(); - - require(['recordingCreator'], function (recordingCreator) { - recordingCreator.show(id, currentItem.ServerId).then(function () { - reload(page); - }); - }); - - }); - - $('.btnCancelRecording', page).on('click', function () { - - deleteTimer(page, currentItem.TimerId); - }); - - $('.btnMoreCommands', page).on('click', function () { - - var button = this; - - Dashboard.getCurrentUser().then(function (user) { - - LibraryBrowser.showMoreCommands(button, currentItem.Id, currentItem.Type, LibraryBrowser.getMoreCommands(currentItem, user)); - }); - }); - - $('.childrenItemsContainer', page).on('playallfromhere', function (e, index) { - - LibraryBrowser.playAllFromHere(_childrenItemsFunction, index); - - }).on('queueallfromhere', function (e, index) { - - LibraryBrowser.queueAllFromHere(_childrenItemsFunction, index); - - }); - - $(page).on("click", ".moreScenes", function () { - - Dashboard.getCurrentUser().then(function (user) { - renderScenes(page, currentItem, user); - }); - - }).on("click", ".morePeople", function () { - - renderCast(page, currentItem, getContext(currentItem)); - - }).on("click", ".moreSpecials", function () { - - Dashboard.getCurrentUser().then(function (user) { - renderSpecials(page, currentItem, user); - }); - - }).on("click", ".moreCriticReviews", function () { - - renderCriticReviews(page, currentItem); - }); - - //var btnMore = page.querySelectorAll('.btnMoreCommands iron-icon'); - //for (var i = 0, length = btnMore.length; i < length; i++) { - // btnMore[i].icon = AppInfo.moreIcon; - //} - - }); - - pageIdOn('pagebeforeshow', "itemDetailPage", function () { - - var page = this; - - reload(page); - - Events.on(ApiClient, 'websocketmessage', onWebSocketMessage); - - Events.on(LibraryBrowser, 'itemdeleting', onItemDeleted); - - }); - - - pageIdOn('pagebeforehide', "itemDetailPage", function () { - - Events.off(LibraryBrowser, 'itemdeleting', onItemDeleted); - - currentItem = null; - - var page = this; - - Events.off(ApiClient, 'websocketmessage', onWebSocketMessage); - LibraryMenu.setTransparentMenu(false); - }); - function itemDetailPage() { var self = this; @@ -2154,4 +2030,111 @@ window.ItemDetailPage = new itemDetailPage(); + return function (view, params) { + + $('.btnPlay', view).on('click', function () { + playCurrentItem(this); + }); + + $('.btnPlayTrailer', view).on('click', function () { + playTrailer(view); + }); + + $('.btnSplitVersions', view).on('click', function () { + + splitVersions(view, params); + }); + + $('.btnSync', view).on('click', function () { + + require(['syncDialog'], function (syncDialog) { + syncDialog.showMenu({ + items: [currentItem] + }); + }); + }); + + $('.btnRecord,.btnFloatingRecord', view).on('click', function () { + + var id = params.id; + Dashboard.showLoadingMsg(); + + require(['recordingCreator'], function (recordingCreator) { + recordingCreator.show(id, currentItem.ServerId).then(function () { + reload(view, params); + }); + }); + + }); + + $('.btnCancelRecording', view).on('click', function () { + + deleteTimer(view, params, currentItem.TimerId); + }); + + $('.btnMoreCommands', view).on('click', function () { + + var button = this; + + Dashboard.getCurrentUser().then(function (user) { + + LibraryBrowser.showMoreCommands(button, currentItem.Id, currentItem.Type, LibraryBrowser.getMoreCommands(currentItem, user)); + }); + }); + + $('.childrenItemsContainer', view).on('playallfromhere', function (e, index) { + + LibraryBrowser.playAllFromHere(_childrenItemsFunction, index); + + }).on('queueallfromhere', function (e, index) { + + LibraryBrowser.queueAllFromHere(_childrenItemsFunction, index); + + }); + + $(view).on("click", ".moreScenes", function () { + + Dashboard.getCurrentUser().then(function (user) { + renderScenes(view, currentItem, user); + }); + + }).on("click", ".morePeople", function () { + + renderCast(view, currentItem, params.context); + + }).on("click", ".moreSpecials", function () { + + Dashboard.getCurrentUser().then(function (user) { + renderSpecials(view, currentItem, user); + }); + + }).on("click", ".moreCriticReviews", function () { + + renderCriticReviews(view, currentItem); + }); + + //var btnMore = page.querySelectorAll('.btnMoreCommands iron-icon'); + //for (var i = 0, length = btnMore.length; i < length; i++) { + // btnMore[i].icon = AppInfo.moreIcon; + //} + + view.addEventListener('viewbeforeshow', function () { + var page = this; + + reload(page, params); + + Events.on(ApiClient, 'websocketmessage', onWebSocketMessage); + + Events.on(LibraryBrowser, 'itemdeleting', onItemDeleted); + }); + + view.addEventListener('viewbeforehide', function () { + Events.off(LibraryBrowser, 'itemdeleting', onItemDeleted); + + currentItem = null; + + Events.off(ApiClient, 'websocketmessage', onWebSocketMessage); + LibraryMenu.setTransparentMenu(false); + }); + }; }); \ No newline at end of file diff --git a/dashboard-ui/scripts/sections.js b/dashboard-ui/scripts/sections.js index 7fb58d80ea..ffbabf340c 100644 --- a/dashboard-ui/scripts/sections.js +++ b/dashboard-ui/scripts/sections.js @@ -36,10 +36,6 @@ return enableScrollX() ? 'overflowPortrait' : 'portrait'; } - function getSquareShape() { - return enableScrollX() ? 'overflowSquare' : 'square'; - } - function getLibraryButtonsHtml(items) { var html = ""; @@ -495,7 +491,7 @@ ExcludeLocationTypes: "Virtual", ImageTypeLimit: 1, EnableImageTypes: "Primary,Backdrop,Banner,Thumb", - EnableTotalRecordCount: 0 + EnableTotalRecordCount: false }; return ApiClient.getItems(userId, options).then(function (result) { @@ -679,6 +675,7 @@ userId: userId, limit: 5, + Fields: "PrimaryImageAspectRatio,SyncInfo", IsInProgress: false }).then(function (result) { @@ -702,7 +699,7 @@ } html += LibraryBrowser.getPosterViewHtml({ items: result.Items, - shape: getSquareShape(), + shape: enableScrollX() ? 'autoOverflow' : 'auto', showTitle: true, showParentTitle: true, coverImage: true, diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index f3e80e6418..8cd8d3a5e5 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1280,19 +1280,6 @@ var Dashboard = { Method: 'Embed' }); - // These don't play very well - profile.CodecProfiles.push({ - Type: 'VideoAudio', - Codec: 'dca', - Conditions: [ - { - Condition: 'LessThanEqual', - Property: 'AudioChannels', - Value: 6 - } - ] - }); - profile.CodecProfiles.push({ Type: 'VideoAudio', Codec: 'aac,mp3', @@ -2539,7 +2526,8 @@ var AppInfo = {}; defineRoute({ path: '/itemdetails.html', - dependencies: ['paper-button'], + dependencies: ['paper-button', 'tileitemcss', 'scripts/livetvcomponents', 'paper-fab', 'paper-item-body', 'paper-icon-item', 'paper-icon-button-light'], + controller: 'scripts/itemdetailpage', autoFocus: false, transition: 'fade' }); diff --git a/dashboard-ui/scripts/tvrecommended.js b/dashboard-ui/scripts/tvrecommended.js index 9aefac9646..92f424c1f3 100644 --- a/dashboard-ui/scripts/tvrecommended.js +++ b/dashboard-ui/scripts/tvrecommended.js @@ -109,7 +109,7 @@ ParentId: parentId, ImageTypeLimit: 1, EnableImageTypes: "Primary,Backdrop,Banner,Thumb", - EnableTotalRecordCount: 0 + EnableTotalRecordCount: false }; ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) { diff --git a/dashboard-ui/scripts/tvupcoming.js b/dashboard-ui/scripts/tvupcoming.js index 95c21592d1..e4807055e6 100644 --- a/dashboard-ui/scripts/tvupcoming.js +++ b/dashboard-ui/scripts/tvupcoming.js @@ -11,7 +11,7 @@ UserId: Dashboard.getCurrentUserId(), ImageTypeLimit: 1, EnableImageTypes: "Primary,Backdrop,Banner,Thumb", - EnableTotalRecordCount: 0 + EnableTotalRecordCount: false }; query.ParentId = params.topParentId; From 619cad7f41773e77eb2f8192a2a6a87b087ddfbf Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 19 May 2016 15:57:30 -0400 Subject: [PATCH 3/3] update playlist --- dashboard-ui/components/remotecontrol.js | 55 ++++++++---------------- dashboard-ui/livetvsettings.html | 5 --- dashboard-ui/scripts/livetvsettings.js | 2 - 3 files changed, 17 insertions(+), 45 deletions(-) diff --git a/dashboard-ui/components/remotecontrol.js b/dashboard-ui/components/remotecontrol.js index e077b0a60c..ef9b830f00 100644 --- a/dashboard-ui/components/remotecontrol.js +++ b/dashboard-ui/components/remotecontrol.js @@ -413,24 +413,17 @@ // $(".playlist", page).html(html).lazyChildren(); //}); - var playlistOpen = isPlaylistOpen(context); + html += libraryBrowser.getListViewHtml({ + items: MediaController.playlist(), + smallIcon: true + }); - if (playlistOpen) { - - html += libraryBrowser.getListViewHtml({ - items: MediaController.playlist(), - smallIcon: true - }); - - playlistNeedsRefresh = false; - } + playlistNeedsRefresh = false; var deps = []; - if (playlistOpen) { - deps.push('paper-icon-item'); - deps.push('paper-item-body'); - } + deps.push('paper-icon-item'); + deps.push('paper-item-body'); require(deps, function () { @@ -438,19 +431,16 @@ itemsContainer.innerHTML = html; - if (playlistOpen) { + var index = MediaController.currentPlaylistIndex(); - var index = MediaController.currentPlaylistIndex(); + if (index != -1) { - if (index != -1) { + var item = itemsContainer.querySelectorAll('.listItem')[index]; + if (item) { + var img = item.querySelector('.listviewImage'); - var item = itemsContainer.querySelectorAll('.listItem')[index]; - if (item) { - var img = item.querySelector('.listviewImage'); - - img.classList.remove('lazy'); - img.classList.add('playlistIndexIndicatorImage'); - } + img.classList.remove('lazy'); + img.classList.add('playlistIndexIndicatorImage'); } } @@ -458,10 +448,6 @@ }); } - function isPlaylistOpen(context) { - return libraryBrowser.selectedTab(context.querySelector('.libraryViewNav')) == 2; - } - function onStateChanged(e, state) { if (e.type == 'positionchange') { @@ -485,11 +471,7 @@ onStateChanged.call(player, e, state); - if (isPlaylistOpen(dlg)) { - loadPlaylist(dlg); - } else { - playlistNeedsRefresh = true; - } + loadPlaylist(dlg); } function onPlaybackStopped(e, state) { @@ -500,11 +482,7 @@ onStateChanged.call(player, e, {}); - if (isPlaylistOpen(dlg)) { - loadPlaylist(dlg); - } else { - playlistNeedsRefresh = true; - } + loadPlaylist(dlg); } function releaseCurrentPlayer() { @@ -824,6 +802,7 @@ libraryBrowser.configurePaperLibraryTabs(ownerView, mdlTabs, ownerView.querySelectorAll('.pageTabContent')); mdlTabs.addEventListener('tabchange', function (e) { + if (e.detail.selectedTabIndex == 2 && playlistNeedsRefresh) { loadPlaylist(context); } diff --git a/dashboard-ui/livetvsettings.html b/dashboard-ui/livetvsettings.html index 72c108b2a0..90df07c12d 100644 --- a/dashboard-ui/livetvsettings.html +++ b/dashboard-ui/livetvsettings.html @@ -28,12 +28,7 @@
${LabelNumberOfGuideDaysHelp}
-
- - ${OptionTVMovies} -
-
${LabelRecordingPathHelp}
diff --git a/dashboard-ui/scripts/livetvsettings.js b/dashboard-ui/scripts/livetvsettings.js index a15ddc03e0..b172568f30 100644 --- a/dashboard-ui/scripts/livetvsettings.js +++ b/dashboard-ui/scripts/livetvsettings.js @@ -7,7 +7,6 @@ $('#selectGuideDays', page).val(config.GuideDays || ''); - $('#chkMovies', page).checked(config.EnableMovieProviders); $('#chkOrganize', page).checked(config.EnableAutoOrganize); $('#chkConvertRecordings', page).checked(config.EnableRecordingEncoding); $('#chkPreserveAudio', page).checked(config.EnableOriginalAudioWithEncodedRecordings || false); @@ -33,7 +32,6 @@ ApiClient.getNamedConfiguration("livetv").then(function (config) { config.GuideDays = $('#selectGuideDays', form).val() || null; - config.EnableMovieProviders = $('#chkMovies', form).checked(); config.EnableAutoOrganize = $('#chkOrganize', form).checked(); config.EnableRecordingEncoding = $('#chkConvertRecordings', form).checked(); config.EnableOriginalAudioWithEncodedRecordings = $('#chkPreserveAudio', form).checked();