From 8020a686400500b760a1b0e4ff625097d80d357d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 12 Oct 2013 12:55:58 -0400 Subject: [PATCH] save sort order for movies --- dashboard-ui/scripts/librarybrowser.js | 40 +++++++++++++++++++++++--- dashboard-ui/scripts/movies.js | 4 +++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 911489dad9..97e9c61b9c 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -18,6 +18,34 @@ return 20; }, + loadSavedQueryValues: function (key, query) { + + var values = localStorage.getItem(key + '_' + Dashboard.getCurrentUserId()); + + if (values) { + + values = JSON.parse(values); + + return $.extend(query, values); + } + + return query; + }, + + saveQueryValues: function (key, query) { + + var values = {}; + + if (query.SortBy) { + values.SortBy = query.SortBy; + } + if (query.SortOrder) { + values.SortOrder = query.SortOrder; + } + + localStorage.setItem(key + '_' + Dashboard.getCurrentUserId(), JSON.stringify(values)); + }, + getPosterDetailViewHtml: function (options) { var items = options.items; @@ -830,7 +858,7 @@ var date = item.DateCreated; var isPlayed = item.UserData && item.UserData.Played; - + if (!isPlayed) { try { if (date && (new Date().getTime() - parseISO8601Date(date).getTime()) < 604800000) { @@ -870,7 +898,7 @@ var half = Math.floor(values.length / 2); var result; - + if (values.length % 2) result = values[half]; else @@ -1008,8 +1036,12 @@ else if (item.Type == "Person") links.push('TheMovieDB'); } - if (providerIds.Tvdb) - links.push('TheTVDB'); + if (providerIds.Tvdb) { + + if (item.Type == "Series") { + links.push('TheTVDB'); + } + } if (providerIds.Tvcom) { if (item.Type == "Episode") links.push('TV.com'); diff --git a/dashboard-ui/scripts/movies.js b/dashboard-ui/scripts/movies.js index 74cadd485a..59f21ea5f0 100644 --- a/dashboard-ui/scripts/movies.js +++ b/dashboard-ui/scripts/movies.js @@ -13,6 +13,8 @@ StartIndex: 0 }; + LibraryBrowser.loadSavedQueryValues('movies', query); + function reloadItems(page) { Dashboard.showLoadingMsg(); @@ -78,6 +80,8 @@ reloadItems(page); }); + LibraryBrowser.saveQueryValues('movies', query); + Dashboard.hideLoadingMsg(); }); }