diff --git a/src/components/indicators/indicators.js b/src/components/indicators/indicators.js index 3b6e6baf7..d9c7af1ab 100644 --- a/src/components/indicators/indicators.js +++ b/src/components/indicators/indicators.js @@ -2,7 +2,6 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun 'use strict'; function enableProgressIndicator(item) { - if (item.MediaType === 'Video') { if (item.Type !== 'TvChannel') { return true; @@ -17,9 +16,7 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } function getProgressHtml(pct, options) { - var containerClass = 'itemProgressBar'; - if (options) { if (options.containerClass) { containerClass += ' ' + options.containerClass; @@ -30,9 +27,7 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } function getAutoTimeProgressHtml(pct, options, isRecording, start, end) { - var containerClass = 'itemProgressBar'; - if (options) { if (options.containerClass) { containerClass += ' ' + options.containerClass; @@ -40,7 +35,6 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } var foregroundClass = 'itemProgressBarForeground'; - if (isRecording) { foregroundClass += ' itemProgressBarForeground-recording'; } @@ -49,39 +43,26 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } function getProgressBarHtml(item, options) { - var pct; - if (enableProgressIndicator(item) && item.Type !== "Recording") { - var userData = options ? (options.userData || item.UserData) : item.UserData; if (userData) { pct = userData.PlayedPercentage; - if (pct && pct < 100) { - return getProgressHtml(pct, options); } } } if ((item.Type === 'Program' || item.Type === 'Timer' || item.Type === 'Recording') && item.StartDate && item.EndDate) { - var startDate = 0; var endDate = 1; try { - startDate = datetime.parseISO8601Date(item.StartDate).getTime(); - - } catch (err) { - } - - try { - endDate = datetime.parseISO8601Date(item.EndDate).getTime(); - } catch (err) { + console.log(err); } var now = new Date().getTime(); @@ -89,9 +70,7 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun pct = 100 * ((now - startDate) / total); if (pct > 0 && pct < 100) { - var isRecording = item.Type === 'Timer' || item.Type === 'Recording' || item.TimerId; - return getAutoTimeProgressHtml(pct, options, isRecording, startDate, endDate); } } @@ -100,16 +79,12 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } function enablePlayedIndicator(item) { - return itemHelper.canMarkPlayed(item); } function getPlayedIndicator(item) { - if (enablePlayedIndicator(item)) { - var userData = item.UserData || {}; - if (userData.UnplayedItemCount) { return '
' + userData.UnplayedItemCount + '
'; } @@ -123,14 +98,11 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } function getCountIndicatorHtml(count) { - return '
' + count + '
'; } function getChildCountIndicatorHtml(item, options) { - var minCount = 0; - if (options) { minCount = options.minCount || minCount; } @@ -148,21 +120,15 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun if (item.Type === 'SeriesTimer') { return ''; - } - else if (item.TimerId || item.SeriesTimerId) { - + } else if (item.TimerId || item.SeriesTimerId) { status = item.Status || 'Cancelled'; - } - else if (item.Type === 'Timer') { - + } else if (item.Type === 'Timer') { status = item.Status; - } - else { + } else { return ''; } if (item.SeriesTimerId) { - if (status !== 'Cancelled') { return ''; } @@ -174,7 +140,6 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } function getSyncIndicator(item) { - if (item.SyncPercent === 100) { return '
'; } else if (item.SyncPercent != null) { @@ -185,41 +150,31 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } function getTypeIndicator(item) { - if (item.Type === 'Video') { - return '
'; } if (item.Type === 'Folder' || item.Type === 'PhotoAlbum') { - return '
'; } if (item.Type === 'Photo') { - return '
'; - //return '
'; } return ''; } function getMissingIndicator(item) { - if (item.Type === 'Episode' && item.LocationType === 'Virtual') { - if (item.PremiereDate) { try { - var premiereDate = datetime.parseISO8601Date(item.PremiereDate).getTime(); - if (premiereDate > new Date().getTime()) { return '
Unaired
'; } - } catch (err) { + console.log(err); } } - return '
Missing
'; } @@ -229,7 +184,6 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun var ProgressBarPrototype = Object.create(HTMLDivElement.prototype); function onAutoTimeProgress() { - var start = parseInt(this.getAttribute('data-starttime')); var end = parseInt(this.getAttribute('data-endtime')); @@ -245,7 +199,6 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun } ProgressBarPrototype.attachedCallback = function () { - if (this.timeInterval) { clearInterval(this.timeInterval); } @@ -256,7 +209,6 @@ define(['datetime', 'itemHelper', 'css!./indicators.css', 'material-icons'], fun }; ProgressBarPrototype.detachedCallback = function () { - if (this.timeInterval) { clearInterval(this.timeInterval); this.timeInterval = null;