diff --git a/dashboard-ui/scripts/alphapicker.js b/dashboard-ui/scripts/alphapicker.js index 84bcfe93eb..780a5612a3 100644 --- a/dashboard-ui/scripts/alphapicker.js +++ b/dashboard-ui/scripts/alphapicker.js @@ -1,4 +1,4 @@ -(function (window, document, $) { +define(['jQuery'], function ($) { function getPickerHtml() { @@ -110,4 +110,4 @@ return this.alphaValue(''); }; -})(window, document, jQuery); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/appservices.js b/dashboard-ui/scripts/appservices.js index 5c4616350e..50bad1fd38 100644 --- a/dashboard-ui/scripts/appservices.js +++ b/dashboard-ui/scripts/appservices.js @@ -1,4 +1,4 @@ -(function ($, document) { +define(['jQuery'], function ($) { function reloadList(page) { @@ -105,4 +105,4 @@ reloadList(page); }); -})(jQuery, document); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/editorsidebar.js b/dashboard-ui/scripts/editorsidebar.js index 500c8e5e26..6218e16d99 100644 --- a/dashboard-ui/scripts/editorsidebar.js +++ b/dashboard-ui/scripts/editorsidebar.js @@ -1,4 +1,4 @@ -(function ($, document, window) { +define(['jQuery'], function ($) { function getNode(item, folderState, selected) { @@ -463,4 +463,4 @@ setCurrentItemId: setCurrentItemId }; -})(jQuery, document, window); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/externalplayer.js b/dashboard-ui/scripts/externalplayer.js index c25e1251c3..7f81c87aea 100644 --- a/dashboard-ui/scripts/externalplayer.js +++ b/dashboard-ui/scripts/externalplayer.js @@ -1,4 +1,4 @@ -define(['appSettings', 'paper-slider', 'paper-button'], function (appSettings) { +define(['appSettings', 'jQuery', 'paper-slider', 'paper-button'], function (appSettings, $) { function getDeviceProfile(serverAddress, deviceId, item, startPositionTicks, maxBitrate, mediaSourceId, audioStreamIndex, subtitleStreamIndex) { diff --git a/dashboard-ui/scripts/favorites.js b/dashboard-ui/scripts/favorites.js index 305a2b65ee..96102590a5 100644 --- a/dashboard-ui/scripts/favorites.js +++ b/dashboard-ui/scripts/favorites.js @@ -1,198 +1,197 @@ -(function ($, document) { - - function enableScrollX() { - return browserInfo.mobile && AppInfo.enableAppLayouts; - } - - function getThumbShape() { - return enableScrollX() ? 'overflowBackdrop' : 'backdrop'; - } - - function getPosterShape() { - return enableScrollX() ? 'overflowPortrait' : 'portrait'; - } - - function getSquareShape() { - return enableScrollX() ? 'overflowSquare' : 'square'; - } - - function getSections() { - - return [ - { name: 'HeaderFavoriteMovies', types: "Movie", id: "favoriteMovies", shape: getPosterShape(), showTitle: false, overlayPlayButton: true }, - { name: 'HeaderFavoriteShows', types: "Series", id: "favoriteShows", shape: getPosterShape(), showTitle: false, overlayPlayButton: true }, - { name: 'HeaderFavoriteEpisodes', types: "Episode", id: "favoriteEpisode", shape: getThumbShape(), preferThumb: false, showTitle: true, showParentTitle: true, overlayPlayButton: true }, - { name: 'HeaderFavoriteGames', types: "Game", id: "favoriteGames", shape: getSquareShape(), preferThumb: false, showTitle: true }, - { name: 'HeaderFavoriteArtists', types: "MusicArtist", id: "favoriteArtists", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayPlayButton: true }, - { name: 'HeaderFavoriteAlbums', types: "MusicAlbum", id: "favoriteAlbums", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayPlayButton: true }, - { name: 'HeaderFavoriteSongs', types: "Audio", id: "favoriteSongs", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayMoreButton: true, defaultAction: 'instantmix' } - ]; - } - +define(['libraryBrowser'], function (libraryBrowser) { + + function enableScrollX() { + return browserInfo.mobile && AppInfo.enableAppLayouts; + } + + function getThumbShape() { + return enableScrollX() ? 'overflowBackdrop' : 'backdrop'; + } + + function getPosterShape() { + return enableScrollX() ? 'overflowPortrait' : 'portrait'; + } + + function getSquareShape() { + return enableScrollX() ? 'overflowSquare' : 'square'; + } + + function getSections() { + + return [ + { name: 'HeaderFavoriteMovies', types: "Movie", id: "favoriteMovies", shape: getPosterShape(), showTitle: false, overlayPlayButton: true }, + { name: 'HeaderFavoriteShows', types: "Series", id: "favoriteShows", shape: getPosterShape(), showTitle: false, overlayPlayButton: true }, + { name: 'HeaderFavoriteEpisodes', types: "Episode", id: "favoriteEpisode", shape: getThumbShape(), preferThumb: false, showTitle: true, showParentTitle: true, overlayPlayButton: true }, + { name: 'HeaderFavoriteGames', types: "Game", id: "favoriteGames", shape: getSquareShape(), preferThumb: false, showTitle: true }, + { name: 'HeaderFavoriteArtists', types: "MusicArtist", id: "favoriteArtists", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayPlayButton: true }, + { name: 'HeaderFavoriteAlbums', types: "MusicAlbum", id: "favoriteAlbums", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayPlayButton: true }, + { name: 'HeaderFavoriteSongs', types: "Audio", id: "favoriteSongs", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayMoreButton: true, defaultAction: 'instantmix' } + ]; + } + function loadSection(elem, userId, topParentId, section, isSingleSection) { - - var screenWidth = $(window).width(); - - var options = { - - SortBy: "SortName", - SortOrder: "Ascending", - Filters: "IsFavorite", - Recursive: true, - Fields: "PrimaryImageAspectRatio,SyncInfo", - CollapseBoxSetItems: false, - ExcludeLocationTypes: "Virtual" - }; - - if (topParentId) { - options.ParentId = topParentId; - } - - if (!isSingleSection) { - options.Limit = screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : 6); - - if (enableScrollX()) { - options.Limit = 16; - } - } - - var promise; - if (section.types == 'MusicArtist') { - promise = ApiClient.getArtists(userId, options); - } else { - - options.IncludeItemTypes = section.types; - promise = ApiClient.getItems(userId, options); - } - - return promise.then(function (result) { - - var html = ''; - - if (result.Items.length) { - - html += '
'; - html += '

' + Globalize.translate(section.name) + '

'; - - if (result.TotalRecordCount > result.Items.length) { - var href = "secondaryitems.html?type=" + section.types + "&filters=IsFavorite&titlekey=" + section.name; - - html += '' + Globalize.translate('ButtonMore') + ''; - } - - html += '
'; - - if (enableScrollX()) { - html += '
'; - } else { - html += '
'; - } - - html += LibraryBrowser.getPosterViewHtml({ - items: result.Items, - preferThumb: section.preferThumb, - shape: section.shape, - overlayText: section.overlayText !== false, - showTitle: section.showTitle, - showParentTitle: section.showParentTitle, - lazy: true, - showDetailsMenu: true, - centerText: section.centerText, - overlayPlayButton: section.overlayPlayButton, - overlayMoreButton: section.overlayMoreButton, - context: 'home-favorites', - defaultAction: section.defaultAction - }); - - html += '
'; - } - - elem.innerHTML = html; - ImageLoader.lazyChildren(elem); - $(elem).createCardMenus(); - }); - } - - function loadSections(page, userId, topParentId, types) { - - Dashboard.showLoadingMsg(); - - var sections = getSections(); - - var sectionid = getParameterByName('sectionid'); - - if (sectionid) { - sections = sections.filter(function (s) { - - return s.id == sectionid; - }); - } - - if (types) { - sections = sections.filter(function (s) { - - return types.indexOf(s.id) != -1; - }); - } - - var i, length; - - var elem = page.querySelector('.favoriteSections'); - - if (!elem.innerHTML) { - var html = ''; - for (i = 0, length = sections.length; i < length; i++) { - - html += '
'; - } - - elem.innerHTML = html; - } - - var promises = []; - - for (i = 0, length = sections.length; i < length; i++) { - - var section = sections[i]; - - elem = page.querySelector('.section' + section.id); - - promises.push(loadSection(elem, userId, topParentId, section, sections.length == 1)); - } - - Promise.all(promises).then(function () { - Dashboard.hideLoadingMsg(); - - LibraryBrowser.setLastRefreshed(page); - }); - } - - function initHomePage() { - - if (window.HomePage) { - window.HomePage.renderFavorites = function (page, tabContent) { - if (LibraryBrowser.needsRefresh(tabContent)) { - loadSections(tabContent, Dashboard.getCurrentUserId()); - } - }; - } - } - - initHomePage(); - - pageIdOn('pageinit', "indexPage", initHomePage); - - pageIdOn('pagebeforeshow', "favoritesPage", function () { - - var page = this; - - if (LibraryBrowser.needsRefresh(page)) { - loadSections(page, Dashboard.getCurrentUserId()); - } - }); - - window.FavoriteItems = { - render: loadSections - }; - -})(jQuery, document); \ No newline at end of file + + var screenWidth = window.innerWidth; + var options = { + + SortBy: "SortName", + SortOrder: "Ascending", + Filters: "IsFavorite", + Recursive: true, + Fields: "PrimaryImageAspectRatio,SyncInfo", + CollapseBoxSetItems: false, + ExcludeLocationTypes: "Virtual" + }; + + if (topParentId) { + options.ParentId = topParentId; + } + + if (!isSingleSection) { + options.Limit = screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : 6); + + if (enableScrollX()) { + options.Limit = 16; + } + } + + var promise; + if (section.types == 'MusicArtist') { + promise = ApiClient.getArtists(userId, options); + } else { + + options.IncludeItemTypes = section.types; + promise = ApiClient.getItems(userId, options); + } + + return promise.then(function (result) { + + var html = ''; + + if (result.Items.length) { + + html += '
'; + html += '

' + Globalize.translate(section.name) + '

'; + + if (result.TotalRecordCount > result.Items.length) { + var href = "secondaryitems.html?type=" + section.types + "&filters=IsFavorite&titlekey=" + section.name; + + html += '' + Globalize.translate('ButtonMore') + ''; + } + + html += '
'; + + if (enableScrollX()) { + html += '
'; + } else { + html += '
'; + } + + html += libraryBrowser.getPosterViewHtml({ + items: result.Items, + preferThumb: section.preferThumb, + shape: section.shape, + overlayText: section.overlayText !== false, + showTitle: section.showTitle, + showParentTitle: section.showParentTitle, + lazy: true, + showDetailsMenu: true, + centerText: section.centerText, + overlayPlayButton: section.overlayPlayButton, + overlayMoreButton: section.overlayMoreButton, + context: 'home-favorites', + defaultAction: section.defaultAction + }); + + html += '
'; + } + + elem.innerHTML = html; + ImageLoader.lazyChildren(elem); + libraryBrowser.createCardMenus(elem); + }); + } + + function loadSections(page, userId, topParentId, types) { + + Dashboard.showLoadingMsg(); + + var sections = getSections(); + + var sectionid = getParameterByName('sectionid'); + + if (sectionid) { + sections = sections.filter(function (s) { + + return s.id == sectionid; + }); + } + + if (types) { + sections = sections.filter(function (s) { + + return types.indexOf(s.id) != -1; + }); + } + + var i, length; + + var elem = page.querySelector('.favoriteSections'); + + if (!elem.innerHTML) { + var html = ''; + for (i = 0, length = sections.length; i < length; i++) { + + html += '
'; + } + + elem.innerHTML = html; + } + + var promises = []; + + for (i = 0, length = sections.length; i < length; i++) { + + var section = sections[i]; + + elem = page.querySelector('.section' + section.id); + + promises.push(loadSection(elem, userId, topParentId, section, sections.length == 1)); + } + + Promise.all(promises).then(function () { + Dashboard.hideLoadingMsg(); + + libraryBrowser.setLastRefreshed(page); + }); + } + + function initHomePage() { + + if (window.HomePage) { + window.HomePage.renderFavorites = function (page, tabContent) { + if (libraryBrowser.needsRefresh(tabContent)) { + loadSections(tabContent, Dashboard.getCurrentUserId()); + } + }; + } + } + + initHomePage(); + + pageIdOn('pageinit', "indexPage", initHomePage); + + pageIdOn('pagebeforeshow', "favoritesPage", function () { + + var page = this; + + if (libraryBrowser.needsRefresh(page)) { + loadSections(page, Dashboard.getCurrentUserId()); + } + }); + + window.FavoriteItems = { + render: loadSections + }; + +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/htmlmediarenderer.js b/dashboard-ui/scripts/htmlmediarenderer.js index 8f4c1ecf06..b863a48393 100644 --- a/dashboard-ui/scripts/htmlmediarenderer.js +++ b/dashboard-ui/scripts/htmlmediarenderer.js @@ -1,4 +1,4 @@ -(function () { +define(['jQuery'], function ($) { var supportsTextTracks; var hlsPlayer; @@ -781,4 +781,4 @@ }; } -})(); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 3066988577..c403cc1303 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -84,7 +84,7 @@ values = JSON.parse(values); - return $.extend(query, values); + return Object.assign(query, values); } return query; @@ -492,7 +492,7 @@ if (window.location.href.toLowerCase().indexOf(url.toLowerCase()) != -1) { - afterNavigate.call($($.mobile.activePage)[0]); + afterNavigate.call($.mobile.activePage); } else { $(document).one('pagebeforeshow', '.page', afterNavigate); Dashboard.navigate(url); @@ -1581,7 +1581,7 @@ return !item.CollectionType && invalidTypes.indexOf(item.Type) == -1 && item.MediaType != 'Photo'; }, - enableSync: function(item, user) { + enableSync: function (item, user) { if (AppInfo.isNativeApp && !Dashboard.capabilities().SupportsSync) { return false; } @@ -2805,11 +2805,6 @@ }, - openViewPanel: function (btn, className) { - - $('.' + className, jQuery(btn).parents('.page')).removeClass('hide').panel('toggle'); - }, - getQueryPagingHtml: function (options) { var startIndex = options.startIndex; @@ -2862,14 +2857,6 @@ html += ''; } - if (options.viewButton) { - - //html += ''; - var viewPanelClass = options.viewPanelClass || 'viewPanel'; - var title = options.viewIcon == 'filter-list' ? Globalize.translate('ButtonFilter') : Globalize.translate('ButtonMenu'); - html += ''; - } - if (options.filterButton) { html += ''; @@ -2953,11 +2940,11 @@ // Seeing an issue in Firefox and IE where it's initially visible in the bottom right, then moves to the center var delay = browserInfo.animate ? 0 : 100; - setTimeout(function() { + setTimeout(function () { paperDialogHelper.open(dlg); }, delay); - $('.groupSortBy', dlg).on('iron-select', function () { + dlg.querySelector('.groupSortBy').addEventListener('iron-select', function () { var newValue = this.selected.replace('_', ','); var changed = options.query.SortBy != newValue; @@ -2970,7 +2957,7 @@ } }); - $('.groupSortOrder', dlg).on('iron-select', function () { + dlg.querySelector('.groupSortOrder').addEventListener('iron-select', function () { var newValue = this.selected; var changed = options.query.SortOrder != newValue; diff --git a/dashboard-ui/scripts/livetvtunerprovider-hdhomerun.js b/dashboard-ui/scripts/livetvtunerprovider-hdhomerun.js index 7b13a64a61..ae1a23016e 100644 --- a/dashboard-ui/scripts/livetvtunerprovider-hdhomerun.js +++ b/dashboard-ui/scripts/livetvtunerprovider-hdhomerun.js @@ -1,4 +1,4 @@ -(function ($, document, window) { +define(['jQuery'], function ($) { function reload(page, providerId) { @@ -75,4 +75,4 @@ reload(page, providerId); }); -})(jQuery, document, window); +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvtunerprovider-m3u.js b/dashboard-ui/scripts/livetvtunerprovider-m3u.js index 1b6c984c76..bcd8df0709 100644 --- a/dashboard-ui/scripts/livetvtunerprovider-m3u.js +++ b/dashboard-ui/scripts/livetvtunerprovider-m3u.js @@ -1,4 +1,4 @@ -(function ($, document, window) { +define(['jQuery'], function ($) { function reload(page, providerId) { @@ -87,4 +87,4 @@ reload(page, providerId); }); -})(jQuery, document, window); +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvtunerprovider-satip.js b/dashboard-ui/scripts/livetvtunerprovider-satip.js index ab071f74c0..68e7872069 100644 --- a/dashboard-ui/scripts/livetvtunerprovider-satip.js +++ b/dashboard-ui/scripts/livetvtunerprovider-satip.js @@ -1,4 +1,4 @@ -(function ($, document, window) { +define(['jQuery'], function ($) { function reload(page, providerId) { @@ -110,4 +110,4 @@ reload(page, providerId); }); -})(jQuery, document, window); +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/mediaplayer-video.js b/dashboard-ui/scripts/mediaplayer-video.js index 572b02777d..710212331b 100644 --- a/dashboard-ui/scripts/mediaplayer-video.js +++ b/dashboard-ui/scripts/mediaplayer-video.js @@ -1,4 +1,4 @@ -define(['appSettings'], function (appSettings) { +define(['appSettings', 'jQuery'], function (appSettings, $) { function createVideoPlayer(self) { diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index 51df21f435..2417d6bca3 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -1598,7 +1598,7 @@ define(['appSettings', 'userSettings', 'appStorage'], function (appSettings, use NowPlayingItem: state.NowPlayingItem }; - info = $.extend(info, state.PlayState); + info = Object.assign(info, state.PlayState); console.log('repeat mode ' + info.RepeatMode); ApiClient.reportPlaybackProgress(info); } diff --git a/dashboard-ui/scripts/nowplayingbar.js b/dashboard-ui/scripts/nowplayingbar.js index fc201304ca..73a5db41b2 100644 --- a/dashboard-ui/scripts/nowplayingbar.js +++ b/dashboard-ui/scripts/nowplayingbar.js @@ -1,4 +1,4 @@ -define([], function () { +define(['jQuery'], function ($) { var currentPlayer; diff --git a/dashboard-ui/scripts/playlistedit.js b/dashboard-ui/scripts/playlistedit.js index f2e72ef395..b0722eb2b3 100644 --- a/dashboard-ui/scripts/playlistedit.js +++ b/dashboard-ui/scripts/playlistedit.js @@ -1,4 +1,4 @@ -define(['appStorage'], function (appStorage) { +define(['appStorage', 'jQuery'], function (appStorage, $) { var data = {}; function getPageData() { diff --git a/dashboard-ui/scripts/ratingdialog.js b/dashboard-ui/scripts/ratingdialog.js index 8c4931e527..17fe903e5f 100644 --- a/dashboard-ui/scripts/ratingdialog.js +++ b/dashboard-ui/scripts/ratingdialog.js @@ -1,4 +1,4 @@ -(function (window, document, $) { +define(['jQuery'], function ($) { window.RatingDialog = function (page) { @@ -136,4 +136,4 @@ } }; -})(window, document, jQuery); \ No newline at end of file +}); \ No newline at end of file diff --git a/dashboard-ui/scripts/sync.js b/dashboard-ui/scripts/sync.js index 80e48a986e..5ae2cbd24b 100644 --- a/dashboard-ui/scripts/sync.js +++ b/dashboard-ui/scripts/sync.js @@ -1,4 +1,4 @@ -define([], function () { +define(['jQuery'], function ($) { var currentDialogOptions; diff --git a/dashboard-ui/scripts/taskbutton.js b/dashboard-ui/scripts/taskbutton.js index f28fed34c7..176a9f8799 100644 --- a/dashboard-ui/scripts/taskbutton.js +++ b/dashboard-ui/scripts/taskbutton.js @@ -1,4 +1,4 @@ -define(['appStorage'], function (appStorage) { +define(['appStorage', 'jQuery'], function (appStorage, $) { $.fn.taskButton = function (options) {