diff --git a/dashboard-ui/apiclient/apiclient.js b/dashboard-ui/apiclient/apiclient.js index 47b80fa65e..99acc35728 100644 --- a/dashboard-ui/apiclient/apiclient.js +++ b/dashboard-ui/apiclient/apiclient.js @@ -205,7 +205,23 @@ headers['Content-Type'] = contentType; } - return fetch(request.url, fetchRequest); + if (!request.timeout) { + return fetch(request.url, fetchRequest); + } + + return new Promise(function (resolve, reject) { + + var timeout = setTimeout(reject, request.timeout); + + fetch(request.url, fetchRequest).then(function (response) { + clearTimeout(timeout); + resolve(response); + }, function (error) { + clearTimeout(timeout); + throw error; + }); + + }); } function paramsToString(params) { @@ -256,9 +272,9 @@ return Promise.reject(response); } - }, function () { + }, function (error) { onFetchFail(request.url, {}); - return Promise.reject({}); + throw error; }); } @@ -379,7 +395,7 @@ return Promise.reject(response); } - }, function () { + }, function (error) { logger.log("Request failed to " + request.url); @@ -390,26 +406,26 @@ var previousServerAddress = self.serverAddress(); - tryReconnect().then(function () { + return tryReconnect().then(function () { logger.log("Reconnect succeesed"); request.url = request.url.replace(previousServerAddress, self.serverAddress()); - self.fetchWithFailover(request, false); + return self.fetchWithFailover(request, false); - }, function () { + }, function (innerError) { logger.log("Reconnect failed"); onFetchFail(request.url, {}); - return Promise.reject({}); - + throw innerError; }); + } else { logger.log("Reporting request failure"); onFetchFail(request.url, {}); - return Promise.reject({}); + throw error; } }); }; @@ -590,7 +606,13 @@ var now = new Date().getTime(); - return self.get(url).then(function () { + return self.ajax({ + + type: "GET", + url: url, + timeout: 5000 + + }).then(function () { var responseTimeSeconds = (new Date().getTime() - now) / 1000; var bytesPerSecond = byteSize / responseTimeSeconds; diff --git a/dashboard-ui/apiclient/connectionmanager.js b/dashboard-ui/apiclient/connectionmanager.js index aad79382e8..e67da395ff 100644 --- a/dashboard-ui/apiclient/connectionmanager.js +++ b/dashboard-ui/apiclient/connectionmanager.js @@ -113,7 +113,23 @@ headers['Content-Type'] = contentType; } - return fetch(request.url, fetchRequest); + if (!request.timeout) { + return fetch(request.url, fetchRequest); + } + + return new Promise(function (resolve, reject) { + + var timeout = setTimeout(reject, request.timeout); + + fetch(request.url, fetchRequest).then(function (response) { + clearTimeout(timeout); + resolve(response); + }, function (error) { + clearTimeout(timeout); + throw error; + }); + + }); } function paramsToString(params) { @@ -154,8 +170,8 @@ return Promise.reject(response); } - }, function () { - return Promise.reject({}); + }, function (error) { + throw error; }); } diff --git a/dashboard-ui/css/card.css b/dashboard-ui/css/card.css index a6b8ef6239..a3a8a229b6 100644 --- a/dashboard-ui/css/card.css +++ b/dashboard-ui/css/card.css @@ -340,7 +340,7 @@ } .overflowBackdropCard { - width: 80%; + width: 84%; max-width: 400px; } diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index 2098f761d5..c4b97b61c6 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -463,12 +463,16 @@ span.itemCommunityRating:not(:empty) + .userDataIcons { } .itemDetailImage { - -moz-box-shadow: 0px 0 20px #000; - -webkit-box-shadow: 0px 0 20px #000; - box-shadow: 0px 0 20px #000; - border: solid 1px #222; + border: solid 1px transparent; } + .itemDetailImage.loaded { + -moz-box-shadow: 0px 0 20px #000; + -webkit-box-shadow: 0px 0 20px #000; + box-shadow: 0px 0 20px #000; + border: solid 1px #222; + } + .detailImageContainer img { width: 280px; /* This is just to make sure it always takes up some space */ diff --git a/dashboard-ui/scripts/chromecast.js b/dashboard-ui/scripts/chromecast.js index b612b2442b..b93bc47cdc 100644 --- a/dashboard-ui/scripts/chromecast.js +++ b/dashboard-ui/scripts/chromecast.js @@ -781,7 +781,10 @@ self.endSession = function () { - castPlayer.stopApp(); + self.stop(); + setTimeout(function () { + castPlayer.stopApp(); + }, 1000); }; self.volumeUp = function () { diff --git a/dashboard-ui/scripts/externalplayer.js b/dashboard-ui/scripts/externalplayer.js index 9f8052d8c4..6cd032c701 100644 --- a/dashboard-ui/scripts/externalplayer.js +++ b/dashboard-ui/scripts/externalplayer.js @@ -167,7 +167,7 @@ function playInternalPostMediaSourceSelection(item, mediaSource, startPosition, deferred) { - Dashboard.hideModalLoadingMsg(); + Dashboard.hideLoadingMsg(); currentItem = item; currentMediaSource = mediaSource; diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 4c8d05f1e1..b53f2ce38e 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -644,7 +644,7 @@ } function enableScrollX() { - return browserInfo.mobile && AppInfo.enableAppLayouts; + return browserInfo.mobile && AppInfo.enableAppLayouts && screen.availWidth <= 1000; } function getPortraitShape() { @@ -899,7 +899,7 @@ html = LibraryBrowser.getPosterViewHtml({ items: result.Items, shape: getPortraitShape(), - showTitle: false, + showTitle: true, centerText: true, lazy: true }); diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 2d877acd4d..6faf41a725 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -3260,6 +3260,11 @@ } var img = elem.querySelector('img'); + img.onload = function () { + if (img.src.indexOf('empty.png') == -1) { + img.classList.add('loaded'); + } + }; ImageLoader.lazyImage(img, url); }, diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index 9ef1a66969..ca02db40c4 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -763,10 +763,9 @@ curr.addEventListener('click', onCardClick); if (AppInfo.isTouchPreferred) { + curr.removeEventListener('contextmenu', disableEvent); curr.addEventListener('contextmenu', disableEvent); - //this.off('contextmenu', onContextMenu); - //this.on('contextmenu', onContextMenu); } else { curr.removeEventListener('contextmenu', onContextMenu); @@ -820,6 +819,7 @@ hammertime.on('press', onTapHold); hammertime.on('pressup', onTapHoldUp); }); + showTapHoldHelp(element); } @@ -863,9 +863,16 @@ showSelections(card); + if (s.stopPropagation) { + e.stopPropagation(); + } e.preventDefault(); + e.stopPropagation(); return false; } + e.preventDefault(); + e.stopPropagation(); + return false; } function onTapHoldUp(e) { diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js index 21c738caac..67c6d13205 100644 --- a/dashboard-ui/scripts/librarymenu.js +++ b/dashboard-ui/scripts/librarymenu.js @@ -272,7 +272,7 @@ var userAtTop = showUserAtTop(); - var homeHref = window.ApiClient ? 'index.html' : 'selectserver.html'; + var homeHref = window.ApiClient ? 'index.html' : 'selectserver.html?showuser=1'; var hasUserImage = user.imageUrl && AppInfo.enableUserImage; @@ -376,7 +376,7 @@ html += '' + Globalize.translate('ButtonSync') + ''; if (Dashboard.isConnectMode()) { - html += '' + Globalize.translate('ButtonSelectServer') + ''; + html += '' + Globalize.translate('ButtonSelectServer') + ''; } if (showUserAtTop()) { @@ -790,7 +790,7 @@ } } - pageClassOn('pageinit', 'page', function () { + pageClassOn('pagebeforeshow', 'page', function () { var page = this; diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index 4654559128..dc42965324 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -845,7 +845,7 @@ if (firstItem.MediaType === "Video") { - Dashboard.showModalLoadingMsg(); + Dashboard.showLoadingMsg(); } if (options.startPositionTicks || firstItem.MediaType !== 'Video' || !AppSettings.enableCinemaMode()) { @@ -1064,7 +1064,7 @@ } if (item.IsPlaceHolder) { - Dashboard.hideModalLoadingMsg(); + Dashboard.hideLoadingMsg(); MediaController.showPlaybackInfoErrorMessage('PlaceHolder'); return; } @@ -1073,7 +1073,7 @@ if (item.MediaType == 'Video' && AppSettings.enableAutomaticBitrateDetection() && (new Date().getTime() - (self.lastBitrateDetections[bitrateDetectionKey] || 0)) > 300000) { - Dashboard.showModalLoadingMsg(); + Dashboard.showLoadingMsg(); ApiClient.detectBitrate().then(function (bitrate) { Logger.log('Max bitrate auto detected to ' + bitrate); @@ -1096,7 +1096,7 @@ if (item.MediaType === "Video") { - Dashboard.showModalLoadingMsg(); + Dashboard.showLoadingMsg(); } MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).then(function (playbackInfoResult) { @@ -1122,7 +1122,7 @@ callback(mediaSource); } } else { - Dashboard.hideModalLoadingMsg(); + Dashboard.hideLoadingMsg(); MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream'); } }); @@ -1140,7 +1140,7 @@ function playInternalPostMediaSourceSelection(item, mediaSource, startPosition, callback) { - Dashboard.hideModalLoadingMsg(); + Dashboard.hideLoadingMsg(); self.currentMediaSource = mediaSource; self.currentItem = item; diff --git a/dashboard-ui/scripts/selectserver.js b/dashboard-ui/scripts/selectserver.js index 720c93110e..d850bb3a63 100644 --- a/dashboard-ui/scripts/selectserver.js +++ b/dashboard-ui/scripts/selectserver.js @@ -334,24 +334,24 @@ function updatePageStyle(page) { - if (ConnectionManager.isLoggedIntoConnect()) { + if (getParameterByName('showuser') == '1') { $(page).addClass('libraryPage').addClass('noSecondaryNavPage').removeClass('standalonePage'); } else { $(page).removeClass('libraryPage').removeClass('noSecondaryNavPage').addClass('standalonePage'); } } - $(document).on('pageinit pagebeforeshow', "#selectServerPage", function () { + pageIdOn('pagebeforeshow', "selectServerPage", function () { var page = this; updatePageStyle(page); + }); - }).on('pageshow', "#selectServerPage", function () { + pageIdOn('pageshow', "selectServerPage", function () { var page = this; loadPage(page); - }); })(); \ No newline at end of file diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 5dfcd94cfe..ece87c33c7 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1757,7 +1757,7 @@ var AppInfo = {}; function initRequire() { - var urlArgs = "v=" + window.dashboardVersion; + var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate()); var paths = { velocity: "bower_components/velocity/velocity.min", @@ -2209,7 +2209,7 @@ var AppInfo = {}; postInitDependencies.push('scripts/nowplayingbar'); } - //postInitDependencies.push('components/testermessage'); + postInitDependencies.push('components/testermessage'); require(postInitDependencies); }); diff --git a/dashboard-ui/selectserver.html b/dashboard-ui/selectserver.html index 5adc2cf910..5b657c5b88 100644 --- a/dashboard-ui/selectserver.html +++ b/dashboard-ui/selectserver.html @@ -4,7 +4,7 @@ Emby -
+