diff --git a/dashboard-ui/bower_components/iron-selector/.bower.json b/dashboard-ui/bower_components/iron-selector/.bower.json index 68996d04d0..31050826e9 100644 --- a/dashboard-ui/bower_components/iron-selector/.bower.json +++ b/dashboard-ui/bower_components/iron-selector/.bower.json @@ -28,14 +28,14 @@ "web-component-tester": "*", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "homepage": "https://github.com/polymerelements/iron-selector", + "homepage": "https://github.com/PolymerElements/iron-selector", "_release": "1.0.2", "_resolution": { "type": "version", "tag": "v1.0.2", "commit": "ea22d91d11ba6f72c01faa952d5e600f9d1773cf" }, - "_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/cordova/android/androidcredentials.js b/dashboard-ui/cordova/android/androidcredentials.js index 6b9563b416..ff0cdba90f 100644 --- a/dashboard-ui/cordova/android/androidcredentials.js +++ b/dashboard-ui/cordova/android/androidcredentials.js @@ -89,7 +89,7 @@ ApiClientBridge.sendRequest(JSON.stringify(javaRequest), request.dataType, id); - Events.on(AndroidAjax, 'response' + id, function (e, isSuccess, status, response) { + Events.on(AndroidAjax, 'response' + id, function (e, isSuccess, response) { Events.off(AndroidAjax, 'response' + id); @@ -116,7 +116,10 @@ var error = {}; - error.status = response.StatusCode; + if (response.StatusCode) { + error.status = response.StatusCode; + } + error.ResponseHeaders = response.ResponseHeaders || {}; error.getResponseHeader = function (name) { @@ -133,13 +136,13 @@ window.AndroidAjax = { - onResponse: function (id, status, response) { + onResponse: function (id, response) { - Events.trigger(AndroidAjax, 'response' + id, [true, status, response]); + Events.trigger(AndroidAjax, 'response' + id, [true, response]); }, - onError: function (id, status, response) { + onError: function (id, response) { - Events.trigger(AndroidAjax, 'response' + id, [false, status, response]); + Events.trigger(AndroidAjax, 'response' + id, [false, response]); } }; diff --git a/dashboard-ui/cordova/android/immersive.js b/dashboard-ui/cordova/android/immersive.js index 689eefebde..7053498840 100644 --- a/dashboard-ui/cordova/android/immersive.js +++ b/dashboard-ui/cordova/android/immersive.js @@ -65,15 +65,15 @@ return; } - $(player).on('playbackstart.fullscreen', onPlaybackStart) - .on('playbackstop.fullscreen', onPlaybackStopped); + $(player).on('playbackstart', onPlaybackStart) + .on('playbackstop', onPlaybackStopped); } function releaseCurrentPlayer() { if (currentPlayer) { - $(currentPlayer).off('.fullscreen'); + $(currentPlayer).off('playbackstart', onPlaybackStart).off('playbackstop', onPlaybackStopped); } } diff --git a/dashboard-ui/cordova/android/mediasession.js b/dashboard-ui/cordova/android/mediasession.js index b58f9c56b3..860726fdbe 100644 --- a/dashboard-ui/cordova/android/mediasession.js +++ b/dashboard-ui/cordova/android/mediasession.js @@ -119,7 +119,11 @@ if (currentPlayer) { - $(currentPlayer).off('.cordovaremote'); + $(currentPlayer).off('playbackstart', onPlaybackStart) + .off('playbackstop', onPlaybackStopped) + .off('playstatechange', onStateChanged) + .off('positionchange', onStateChanged); + currentPlayer.endPlayerUpdates(); currentPlayer = null; @@ -153,10 +157,10 @@ onStateChanged.call(player, { type: 'init' }, state); }); - $(player).on('playbackstart.cordovaremote', onPlaybackStart) - .on('playbackstop.cordovaremote', onPlaybackStopped) - .on('playstatechange.cordovaremote', onStateChanged) - .on('positionchange.cordovaremote', onStateChanged); + $(player).on('playbackstart', onPlaybackStart) + .on('playbackstop', onPlaybackStopped) + .on('playstatechange', onStateChanged) + .on('positionchange', onStateChanged); } Dashboard.ready(function () { diff --git a/dashboard-ui/cordova/ios/orientation.js b/dashboard-ui/cordova/ios/orientation.js index 7ee53bfac1..855aaff1a0 100644 --- a/dashboard-ui/cordova/ios/orientation.js +++ b/dashboard-ui/cordova/ios/orientation.js @@ -6,6 +6,8 @@ // Try to make it react quicker to the orientation change doc.scrollTop(doc.scrollTop() + 1); + + $('.libraryViewNav').filter(':visible').hide().show(); } function onOrientationChange() { diff --git a/dashboard-ui/cordova/remotecontrols.js b/dashboard-ui/cordova/remotecontrols.js index dd14a2564d..8e1d7ca511 100644 --- a/dashboard-ui/cordova/remotecontrols.js +++ b/dashboard-ui/cordova/remotecontrols.js @@ -94,7 +94,11 @@ if (currentPlayer) { - $(currentPlayer).off('.cordovaremote'); + $(currentPlayer).off('playbackstart', onPlaybackStart) + .off('playbackstop', onPlaybackStopped) + .off('playstatechange', onStateChanged) + .off('positionchange', onStateChanged); + currentPlayer.endPlayerUpdates(); currentPlayer = null; @@ -151,10 +155,10 @@ onStateChanged.call(player, { type: 'init' }, state); }); - $(player).on('playbackstart.cordovaremote', onPlaybackStart) - .on('playbackstop.cordovaremote', onPlaybackStopped) - .on('playstatechange.cordovaremote', onStateChanged) - .on('positionchange.cordovaremote', onStateChanged); + $(player).on('playbackstart', onPlaybackStart) + .on('playbackstop', onPlaybackStopped) + .on('playstatechange', onStateChanged) + .on('positionchange', onStateChanged); } Dashboard.ready(function () { diff --git a/dashboard-ui/favorites.html b/dashboard-ui/favorites.html deleted file mode 100644 index c8f9719031..0000000000 --- a/dashboard-ui/favorites.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - Emby - - -
- -
- home${TabHome} - navigate_next${TabNextUp} - favorite${TabFavorites} - schedule${TabUpcoming} -
- -
- -
-
-
-
-
- - diff --git a/dashboard-ui/index.html b/dashboard-ui/index.html index 521114af27..982b2e92f0 100644 --- a/dashboard-ui/index.html +++ b/dashboard-ui/index.html @@ -9,9 +9,9 @@
home${TabHome} - navigate_next${TabNextUp} - favorite${TabFavorites} - schedule${TabUpcoming} + navigate_next${TabNextUp} + favorite${TabFavorites} + schedule${TabUpcoming}
@@ -29,6 +29,72 @@
+
+ +
+
+ + + +
+
+

${HeaderNextUp}

+ ${ButtonSync} +
+
+
+
+ +
+
+
+
+ +
+ home${TabHome} + navigate_next${TabNextUp} + favorite${TabFavorites} + schedule${TabUpcoming} +
+ +
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html index 857b876a01..a848fa03e3 100644 --- a/dashboard-ui/itemdetails.html +++ b/dashboard-ui/itemdetails.html @@ -9,9 +9,9 @@ diff --git a/dashboard-ui/livetvchannel.html b/dashboard-ui/livetvchannel.html index 61dd36bbbf..23b50b52ee 100644 --- a/dashboard-ui/livetvchannel.html +++ b/dashboard-ui/livetvchannel.html @@ -7,11 +7,11 @@
info${TabSuggestions} - grid_on${TabGuide} - live_tv${TabChannels} - slideshow${TabRecordings} - schedule${TabScheduled} - refresh${TabSeries} + grid_on${TabGuide} + live_tv${TabChannels} + slideshow${TabRecordings} + schedule${TabScheduled} + refresh${TabSeries}
diff --git a/dashboard-ui/livetvchannels.html b/dashboard-ui/livetvchannels.html deleted file mode 100644 index 8665852bfa..0000000000 --- a/dashboard-ui/livetvchannels.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - Emby - - -
- -
-
-
-
-
-
- -
- -
-
- - - -
- -
- - -
- -
-
-
- ${HeaderFilters} - - - - - - - - -
- -
- -
- -
- - diff --git a/dashboard-ui/livetvguide.html b/dashboard-ui/livetvguide.html deleted file mode 100644 index f6f897193a..0000000000 --- a/dashboard-ui/livetvguide.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - Emby - - -
- -
- -
-
-
-
- -
-
-
-
- -
- -
-
-
-
-
- -
-
- - diff --git a/dashboard-ui/livetvitems.html b/dashboard-ui/livetvitems.html index 4f59d59026..bdf3112204 100644 --- a/dashboard-ui/livetvitems.html +++ b/dashboard-ui/livetvitems.html @@ -7,11 +7,11 @@
diff --git a/dashboard-ui/livetvnewrecording.html b/dashboard-ui/livetvnewrecording.html index 5721965ede..ea346655aa 100644 --- a/dashboard-ui/livetvnewrecording.html +++ b/dashboard-ui/livetvnewrecording.html @@ -7,11 +7,11 @@
diff --git a/dashboard-ui/livetvprogram.html b/dashboard-ui/livetvprogram.html index c519ac0edf..25f7e2542f 100644 --- a/dashboard-ui/livetvprogram.html +++ b/dashboard-ui/livetvprogram.html @@ -7,11 +7,11 @@
diff --git a/dashboard-ui/livetvrecording.html b/dashboard-ui/livetvrecording.html index e86e90a65d..441b17dda2 100644 --- a/dashboard-ui/livetvrecording.html +++ b/dashboard-ui/livetvrecording.html @@ -7,11 +7,11 @@
diff --git a/dashboard-ui/livetvrecordinglist.html b/dashboard-ui/livetvrecordinglist.html index 24ba446b4d..b8978ed35c 100644 --- a/dashboard-ui/livetvrecordinglist.html +++ b/dashboard-ui/livetvrecordinglist.html @@ -7,11 +7,11 @@
diff --git a/dashboard-ui/livetvrecordings.html b/dashboard-ui/livetvrecordings.html deleted file mode 100644 index e65b502a9b..0000000000 --- a/dashboard-ui/livetvrecordings.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - Emby - - -
- - -
-
- - - -
-
-
- - diff --git a/dashboard-ui/livetvseriestimer.html b/dashboard-ui/livetvseriestimer.html index 4c76736f63..3862785841 100644 --- a/dashboard-ui/livetvseriestimer.html +++ b/dashboard-ui/livetvseriestimer.html @@ -7,11 +7,11 @@
diff --git a/dashboard-ui/livetvseriestimers.html b/dashboard-ui/livetvseriestimers.html deleted file mode 100644 index 19cf7b3cae..0000000000 --- a/dashboard-ui/livetvseriestimers.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - Emby - - -
- -
-
- -
- -
- -
-
-
-
- - -
- - ${HeaderSortBy} - - - - - - - -
- -
- - ${HeaderSortOrder} - - - - - - - -
- -
- -
- - diff --git a/dashboard-ui/livetvsuggested.html b/dashboard-ui/livetvsuggested.html index 3c674895c7..a47c72d164 100644 --- a/dashboard-ui/livetvsuggested.html +++ b/dashboard-ui/livetvsuggested.html @@ -8,11 +8,11 @@
@@ -45,5 +45,187 @@
+
+ +
+ +
+
+
+
+ +
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+ +
+
+ + + +
+ +
+ + +
+ +
+
+
+ ${HeaderFilters} + + + + + + + + +
+ +
+ +
+ +
+
+ + +
+
+ + + +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+
+ +
+
+ + ${HeaderSortBy} + + + + + + + +
+ +
+ + ${HeaderSortOrder} + + + + + + + +
+ +
+ +
diff --git a/dashboard-ui/livetvtimer.html b/dashboard-ui/livetvtimer.html index bd17992b64..257a134201 100644 --- a/dashboard-ui/livetvtimer.html +++ b/dashboard-ui/livetvtimer.html @@ -7,11 +7,11 @@
@@ -74,7 +74,7 @@ - diff --git a/dashboard-ui/livetvtimers.html b/dashboard-ui/livetvtimers.html deleted file mode 100644 index 44051f32c4..0000000000 --- a/dashboard-ui/livetvtimers.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - Emby - - - - - diff --git a/dashboard-ui/scripts/actionsheet.js b/dashboard-ui/scripts/actionsheet.js index 7a38159b8f..9d38494e4f 100644 --- a/dashboard-ui/scripts/actionsheet.js +++ b/dashboard-ui/scripts/actionsheet.js @@ -20,8 +20,8 @@ var pos = $(options.positionTo).offset(); - pos.top += options.positionTo.innerHeight / 2; - pos.left += options.positionTo.innerWidth / 2; + pos.top += $(options.positionTo).innerHeight() / 2; + pos.left += $(options.positionTo).innerWidth() / 2; // Account for margins pos.top -= 24; diff --git a/dashboard-ui/scripts/autoorganizelog.js b/dashboard-ui/scripts/autoorganizelog.js index f9dc1b4206..e4f79f2b06 100644 --- a/dashboard-ui/scripts/autoorganizelog.js +++ b/dashboard-ui/scripts/autoorganizelog.js @@ -379,7 +379,7 @@ mode: 'off' }); - $(ApiClient).off(".autoorganizelog"); + $(ApiClient).off("websocketmessage.autoorganizelog", onWebSocketMessage); }); })(jQuery, document, window); diff --git a/dashboard-ui/scripts/backdrops.js b/dashboard-ui/scripts/backdrops.js index 717682f321..0fc2fc5232 100644 --- a/dashboard-ui/scripts/backdrops.js +++ b/dashboard-ui/scripts/backdrops.js @@ -109,9 +109,10 @@ function setDefault(page) { - getElement().css('backgroundImage', 'url(css/images/splash.jpg)'); + getElement().style.backgroundImage = "url(css/images/splash.jpg)"; - page.classList.add('backdropPage staticBackdropPage'); + page.classList.add('backdropPage'); + page.classList.add('staticBackdropPage'); } function isEnabledByDefault() { diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index c25fb77a6f..826d110ff8 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -1022,23 +1022,19 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' showOverlayTimeout = null; } - $('.cardOverlayTarget:visible', this).each(function () { + var elem = this.querySelector('.cardOverlayTarget'); - var elem = this; - - $(this).animate({ "height": "0" }, "fast", function () { - - $(elem).hide(); + if ($(elem).is(':visible')) { + require(["jquery", "velocity"], function ($, Velocity) { + Velocity.animate(elem, { "height": "0" }, + { + complete: function () { + $(elem).hide(); + } + }); }); - - }); - - $('.cardOverlayTarget:visible', this).stop().animate({ "height": "0" }, function () { - - $(this).hide(); - - }); + } } $.fn.createSessionItemMenus = function () { @@ -1082,8 +1078,7 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' return this; } - return this.off('.sessionItemMenu').on('mouseenter.sessionItemMenu', '.playingSession', onHoverIn) - .on('mouseleave.sessionItemMenu', '.playingSession', onHoverOut); + return this.off('mouseenter', '.playingSession', onHoverIn).off('mouseleave', '.playingSession', onHoverOut).on('mouseenter', '.playingSession', onHoverIn).on('mouseleave', '.playingSession', onHoverOut); }; })(jQuery, document, window); @@ -1225,7 +1220,8 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' elem.each(function () { reloadData(this); - }); + + }).addClass('activityLogListWidget'); var apiClient = ApiClient; @@ -1233,21 +1229,7 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' return; } - $(apiClient).on('websocketmessage.activityloglistener', function (e, data) { - - var msg = data; - - if (msg.MessageType === "ActivityLogEntry") { - elem.each(function () { - - reloadData(this); - }); - } - - }).on('websocketopen.activityloglistener', function (e, data) { - - startListening(apiClient); - }); + $(apiClient).on('websocketmessage', onSocketMessage).on('websocketopen', onSocketOpen); } function startListening(apiClient) { @@ -1266,22 +1248,41 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' } + function onSocketOpen() { + + var apiClient = ApiClient; + if (apiClient) { + startListening(apiClient); + } + } + + function onSocketMessage(e, data) { + + var msg = data; + + if (msg.MessageType === "ActivityLogEntry") { + $('.activityLogListWidget').each(function () { + + reloadData(this); + }); + } + } + function destroyList(elem) { var apiClient = ApiClient; if (apiClient) { - $(apiClient).off('websocketopen.activityloglistener').off('websocketmessage.activityloglistener'); + $(apiClient).off('websocketopen', onSocketOpen).off('websocketmessage', onSocketOpen); stopListening(apiClient); } - - return this; } $.fn.activityLogList = function (action) { if (action == 'destroy') { + this.removeClass('activityLogListWidget'); destroyList(this); } else { createList(this); @@ -1310,7 +1311,7 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' result.CustomPrefs[welcomeTourKey] = welcomeDismissValue; ApiClient.updateDisplayPreferences('dashboard', result, userId, 'dashboard'); - $(page).off('.checktour'); + $(page).off('pageshowready', onPageShowReadyCheckTour); }); } @@ -1367,6 +1368,16 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' }); } + function onPageShowReadyCheckTour() { + var page = this; + + var apiClient = ApiClient; + + if (apiClient && !AppInfo.isNativeApp) { + showWelcomeIfNeeded(page, apiClient); + } + } + $(document).on('pageinitdepends', "#dashboardPage", function () { var page = this; @@ -1375,17 +1386,7 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' takeTour(page, Dashboard.getCurrentUserId()); }); - }).on('pageshowready.checktour', "#dashboardPage", function () { - - var page = this; - - var apiClient = ApiClient; - - if (apiClient && !AppInfo.isNativeApp) { - showWelcomeIfNeeded(page, apiClient); - } - - }); + }).on('pageshowready', "#dashboardPage", onPageShowReadyCheckTour); })(jQuery, document, window); diff --git a/dashboard-ui/scripts/editcollectionitems.js b/dashboard-ui/scripts/editcollectionitems.js index 546e1d9c58..5ec7b5c38e 100644 --- a/dashboard-ui/scripts/editcollectionitems.js +++ b/dashboard-ui/scripts/editcollectionitems.js @@ -285,17 +285,11 @@ reload(page); - $("body").on("popupafteropen.collections", ".popupIdentify", function (e) { - $("#txtLookupName").focus().select(); - }); - }).on('pagebeforehide', "#editCollectionTitlesPage", function () { var page = this; currentItem = null; - - $("body").off("popupafteropen.collections"); }); })(jQuery, document, window, window.FileReader, escape); \ No newline at end of file diff --git a/dashboard-ui/scripts/edititemmetadata.js b/dashboard-ui/scripts/edititemmetadata.js index 6c8c9895f7..5398b4abc8 100644 --- a/dashboard-ui/scripts/edititemmetadata.js +++ b/dashboard-ui/scripts/edititemmetadata.js @@ -809,9 +809,9 @@ function getAlbumArtists(form) { - return $('#txtAlbumArtist', form).val().trim().split(';').filter(function(s){ + return $('#txtAlbumArtist', form).val().trim().split(';').filter(function (s) { - return s.length > 0; + return s.length > 0; }).map(function (a) { @@ -823,9 +823,9 @@ function getArtists(form) { - return $('#txtArtist', form).val().trim().split(';').filter(function(s){ + return $('#txtArtist', form).val().trim().split(';').filter(function (s) { - return s.length > 0; + return s.length > 0; }).map(function (a) { @@ -1379,6 +1379,18 @@ $(ApiClient).off("websocketmessage", onWebSocketMessageReceived); } + function onItemDeleted(e, itemId) { + + if (currentItem && currentItem.Id == itemId) { + + if (currentItem.ParentId) { + Dashboard.navigate('edititemmetadata.html?id=' + currentItem.ParentId); + } else { + Dashboard.navigate('edititemmetadata.html'); + } + } + } + $(document).on('pageinitdepends', "#editItemMetadataPage", function () { var page = this; @@ -1450,22 +1462,12 @@ reload(page); - $(LibraryBrowser).on('itemdeleting.editor', function (e, itemId) { - - if (currentItem && currentItem.Id == itemId) { - - if (currentItem.ParentId) { - Dashboard.navigate('edititemmetadata.html?id=' + currentItem.ParentId); - } else { - Dashboard.navigate('edititemmetadata.html'); - } - } - }); + $(LibraryBrowser).on('itemdeleting', onItemDeleted); }).on('pagebeforehide', "#editItemMetadataPage", function () { var page = this; - $(LibraryBrowser).off('itemdeleting.editor'); + $(LibraryBrowser).off('itemdeleting', onItemDeleted); unbindItemChanged(page); diff --git a/dashboard-ui/scripts/editorsidebar.js b/dashboard-ui/scripts/editorsidebar.js index e99a919cf6..860b596e7b 100644 --- a/dashboard-ui/scripts/editorsidebar.js +++ b/dashboard-ui/scripts/editorsidebar.js @@ -269,6 +269,53 @@ }); } + function onNodeSelect(event, data) { + var node = data.node; + + var eventData = { + id: node.id, + itemType: node.li_attr.itemtype + }; + + if (eventData.itemType != 'livetv' && eventData.itemType != 'mediafolders') { + $(this).trigger('itemclicked', [eventData]); + } + } + + function onNodeOpen(event, data) { + + var page = $(this).parents('.page')[0]; + var node = data.node; + + if (node.children && node.children) { + loadNodesToLoad(page, node); + } + + if (node.li_attr && node.id != '#' && !node.li_attr.loadedFromServer) { + + node.li_attr.loadedFromServer = true; + + $.jstree.reference(".libraryTree", page).load_node(node.id, loadNodeCallback); + } + } + + function onNodeLoad(event, data) { + + var page = $(this).parents('.page')[0]; + var node = data.node; + + if (node.children && node.children) { + loadNodesToLoad(page, node); + } + + if (node.li_attr && node.id != '#' && !node.li_attr.loadedFromServer) { + + node.li_attr.loadedFromServer = true; + + $.jstree.reference(".libraryTree", page).load_node(node.id, loadNodeCallback); + } + } + function initializeTreeInternal(page, currentUser, openItems, selectedId) { nodesToLoad = []; @@ -293,50 +340,7 @@ } } - }).off('select_node.jstree').on('select_node.jstree', function (event, data) { - - var node = data.node; - - var eventData = { - id: node.id, - itemType: node.li_attr.itemtype - }; - - if (eventData.itemType != 'livetv' && eventData.itemType != 'mediafolders') { - $(this).trigger('itemclicked', [eventData]); - } - - }).off('open_node.jstree').on('open_node.jstree', function (event, data) { - - var node = data.node; - - if (node.children && node.children) { - loadNodesToLoad(page, node); - } - - if (node.li_attr && node.id != '#' && !node.li_attr.loadedFromServer) { - - node.li_attr.loadedFromServer = true; - - $.jstree.reference(".libraryTree", page).load_node(node.id, loadNodeCallback); - } - - }).off('load_node.jstree').on('load_node.jstree', function (event, data) { - - var node = data.node; - - if (node.children && node.children) { - loadNodesToLoad(page, node); - } - - if (node.li_attr && node.id != '#' && !node.li_attr.loadedFromServer) { - - node.li_attr.loadedFromServer = true; - - $.jstree.reference(".libraryTree", page).load_node(node.id, loadNodeCallback); - } - - }); + }).off('select_node.jstree', onNodeSelect).on('select_node.jstree', onNodeSelect).off('open_node.jstree', onNodeOpen).on('open_node.jstree', onNodeOpen).off('load_node.jstree', onNodeLoad).on('load_node.jstree', onNodeLoad); } function loadNodesToLoad(page, node) { @@ -431,7 +435,7 @@ var page = this; - $('.libraryTree', page).off('select_node.jstree'); + $('.libraryTree', page).off('select_node.jstree', onNodeSelect).off('open_node.jstree', onNodeOpen).off('load_node.jstree', onNodeLoad); }); diff --git a/dashboard-ui/scripts/extensions.js b/dashboard-ui/scripts/extensions.js index c042cc260f..06d8b1ae3e 100644 --- a/dashboard-ui/scripts/extensions.js +++ b/dashboard-ui/scripts/extensions.js @@ -312,7 +312,7 @@ function replaceQueryString(url, param, value) { var re = new RegExp("([?|&])" + param + "=.*?(&|$)", "i"); if (url.match(re)) return url.replace(re, '$1' + param + "=" + value + '$2'); - else { + else if (value) { if (url.indexOf('?') == -1) { return url + '?' + param + "=" + value; @@ -320,6 +320,8 @@ function replaceQueryString(url, param, value) { return url + '&' + param + "=" + value; } + + return url; } function parseISO8601Date(s, options) { diff --git a/dashboard-ui/scripts/favorites.js b/dashboard-ui/scripts/favorites.js index 905dec8f08..01ec20646e 100644 --- a/dashboard-ui/scripts/favorites.js +++ b/dashboard-ui/scripts/favorites.js @@ -54,7 +54,7 @@ html += '
'; if (result.TotalRecordCount > result.Items.length) { - var href = "favorites.html?sectionid=" + section.id; + var href = "index.html#favoritesPage?sectionid=" + section.id; html += '' + Globalize.translate('ButtonMoreItems') + ''; } diff --git a/dashboard-ui/scripts/homenextup.js b/dashboard-ui/scripts/homenextup.js new file mode 100644 index 0000000000..584bdc6c69 --- /dev/null +++ b/dashboard-ui/scripts/homenextup.js @@ -0,0 +1,191 @@ +(function ($, document) { + + function getView() { + + return 'Thumb'; + } + + function getResumeView() { + + return 'Poster'; + } + + function reload(page) { + + Dashboard.showLoadingMsg(); + + var context = ''; + + if (LibraryMenu.getTopParentId()) { + + $('.scopedLibraryViewNav', page).show(); + $('.globalNav', page).hide(); + $('.scopedContent', page).show(); + context = 'tv'; + + loadResume(page); + + } else { + $('.scopedLibraryViewNav', page).hide(); + $('.globalNav', page).show(); + $('.scopedContent', page).hide(); + } + + loadNextUp(page, context || 'home-nextup'); + } + + function loadNextUp(page, context) { + + var limit = AppInfo.hasLowImageBandwidth ? + 16 : + 24; + + var query = { + + Limit: limit, + Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated,SyncInfo", + UserId: Dashboard.getCurrentUserId(), + ExcludeLocationTypes: "Virtual", + ImageTypeLimit: 1, + EnableImageTypes: "Primary,Backdrop,Banner,Thumb" + }; + + query.ParentId = LibraryMenu.getTopParentId(); + + ApiClient.getNextUpEpisodes(query).done(function (result) { + + if (result.Items.length) { + $('.noNextUpItems', page).hide(); + } else { + $('.noNextUpItems', page).show(); + } + + var view = getView(); + var html = ''; + + if (view == 'ThumbCard') { + + html += LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: "backdrop", + showTitle: true, + preferThumb: true, + showParentTitle: true, + lazy: true, + cardLayout: true, + context: 'tv', + showDetailsMenu: true + }); + + } else if (view == 'Thumb') { + + html += LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: "backdrop", + showTitle: true, + showParentTitle: true, + overlayText: false, + context: context, + lazy: true, + preferThumb: true, + showDetailsMenu: true + }); + } + + var elem = page.querySelector('#nextUpItems'); + elem.innerHTML = html; + ImageLoader.lazyChildren(elem); + Dashboard.hideLoadingMsg(); + }); + } + + function enableScrollX() { + return $.browser.mobile && AppInfo.enableAppLayouts; + } + + function getThumbShape() { + return enableScrollX() ? 'overflowBackdrop' : 'backdrop'; + } + + function loadResume(page) { + + var parentId = LibraryMenu.getTopParentId(); + + var screenWidth = $(window).width(); + + var limit = 6; + + var options = { + + SortBy: "DatePlayed", + SortOrder: "Descending", + IncludeItemTypes: "Episode", + Filters: "IsResumable", + Limit: limit, + Recursive: true, + Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData,SyncInfo", + ExcludeLocationTypes: "Virtual", + ParentId: parentId, + ImageTypeLimit: 1, + EnableImageTypes: "Primary,Backdrop,Banner,Thumb" + }; + + ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { + + if (result.Items.length) { + $('#resumableSection', page).show(); + } else { + $('#resumableSection', page).hide(); + } + + var view = getResumeView(); + var html = ''; + + if (view == 'PosterCard') { + + html += LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: getThumbShape(), + showTitle: true, + showParentTitle: true, + lazy: true, + cardLayout: true, + context: 'tv', + showDetailsMenu: true + }); + + } else if (view == 'Poster') { + + html += LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: getThumbShape(), + showTitle: true, + showParentTitle: true, + overlayText: screenWidth >= 800 && !AppInfo.hasLowImageBandwidth, + lazy: true, + context: 'tv', + showDetailsMenu: true + }); + } + + var elem = page.querySelector('#resumableItems'); + elem.innerHTML = html; + ImageLoader.lazyChildren(elem); + }); + } + + $(document).on('pagebeforeshowready', "#homeNextUpPage", function () { + + var page = this; + + if (enableScrollX()) { + page.querySelector('#resumableItems').classList.add('hiddenScrollX'); + } else { + page.querySelector('#resumableItems').classList.remove('hiddenScrollX'); + } + + reload(page); + }); + + +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/homeupcoming.js b/dashboard-ui/scripts/homeupcoming.js new file mode 100644 index 0000000000..939a5c06fa --- /dev/null +++ b/dashboard-ui/scripts/homeupcoming.js @@ -0,0 +1,65 @@ +(function ($, document) { + + $(document).on('pagebeforeshowready', "#homeUpcomingPage", function () { + + Dashboard.showLoadingMsg(); + + var page = this; + + var limit = AppInfo.hasLowImageBandwidth ? + 24 : + 40; + + var query = { + + Limit: limit, + Fields: "AirTime,UserData,SeriesStudio,SyncInfo", + UserId: Dashboard.getCurrentUserId(), + ImageTypeLimit: 1, + EnableImageTypes: "Primary,Backdrop,Banner,Thumb" + }; + + query.ParentId = LibraryMenu.getTopParentId(); + + var context = ''; + + if (query.ParentId) { + + context = 'tv'; + + } + + ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).done(function (result) { + + var items = result.Items; + + if (items.length) { + page.querySelector('.noItemsMessage').style.display = 'none'; + } else { + page.querySelector('.noItemsMessage').style.display = 'block'; + } + + var elem = page.querySelector('#upcomingItems'); + elem.innerHTML = LibraryBrowser.getPosterViewHtml({ + items: items, + showLocationTypeIndicator: false, + shape: "backdrop", + showTitle: true, + showPremiereDate: true, + showPremiereDateIndex: true, + preferThumb: true, + context: context || 'home-upcoming', + lazy: true, + showDetailsMenu: true + + }); + + ImageLoader.lazyChildren(elem); + + Dashboard.hideLoadingMsg(); + + }); + }); + + +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/htmlmediarenderer.js b/dashboard-ui/scripts/htmlmediarenderer.js index 56cef88c7e..84ba1e96f6 100644 --- a/dashboard-ui/scripts/htmlmediarenderer.js +++ b/dashboard-ui/scripts/htmlmediarenderer.js @@ -129,7 +129,7 @@ var elem = $('.itemVideo'); return elem - .one('.loadedmetadata') + .one('.loadedmetadata', onLoadedMetadata) .one('playing', onOneVideoPlaying) .on('timeupdate', onTimeUpdate) .on('ended', onEnded) @@ -220,7 +220,7 @@ } else { - $(elem).one("loadedmetadata.mediaplayerevent", onLoadedMetadata); + $(elem).one("loadedmetadata", onLoadedMetadata); } }; @@ -247,7 +247,31 @@ if (elem) { - $(elem).off(); + if (elem.tagName == 'AUDIO') { + + Events.off(elem, 'timeupdate', onTimeUpdate); + Events.off(elem, 'ended', onEnded); + Events.off(elem, 'volumechange', onVolumeChange); + Events.off(elem, 'playing', onOneAudioPlaying); + Events.off(elem, 'play', onPlay); + Events.off(elem, 'pause', onPause); + Events.off(elem, 'playing', onPlaying); + Events.off(elem, 'error', onError); + + } else { + + Events.off(elem, 'loadedmetadata', onLoadedMetadata); + Events.off(elem, 'playing', onOneVideoPlaying); + Events.off(elem, 'timeupdate', onTimeUpdate); + Events.off(elem, 'ended', onEnded); + Events.off(elem, 'volumechange', onVolumeChange); + Events.off(elem, 'play', onPlay); + Events.off(elem, 'pause', onPause); + Events.off(elem, 'playing', onPlaying); + Events.off(elem, 'click', onClick); + Events.off(elem, 'dblclick', onDblClick); + Events.off(elem, 'error', onError); + } if (elem.tagName.toLowerCase() != 'audio') { $(elem).remove(); diff --git a/dashboard-ui/scripts/indexpage.js b/dashboard-ui/scripts/indexpage.js index 8d7b3362e1..602b68c3b7 100644 --- a/dashboard-ui/scripts/indexpage.js +++ b/dashboard-ui/scripts/indexpage.js @@ -117,6 +117,8 @@ $('.welcomeMessage', page).hide(); } else { + Dashboard.hideLoadingMsg(); + var elem = $('.welcomeMessage', page).show(); if (displayPreferences.CustomPrefs[homePageTourKey]) { @@ -178,6 +180,8 @@ if (window.ApiClient) { var userId = Dashboard.getCurrentUserId(); + Dashboard.showLoadingMsg(); + getDisplayPreferences('home', userId).done(function (result) { Dashboard.getCurrentUser().done(function (user) { @@ -187,6 +191,7 @@ if (!AppInfo.isNativeApp) { showWelcomeIfNeeded(page, result); } + Dashboard.hideLoadingMsg(); }); }); diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js index 730255fbd4..c982c808c5 100644 --- a/dashboard-ui/scripts/itembynamedetailpage.js +++ b/dashboard-ui/scripts/itembynamedetailpage.js @@ -318,7 +318,7 @@ LibraryBrowser.renderOverview(page.querySelector('.itemOverview'), item); renderUserDataIcons(page, item); - LibraryBrowser.renderLinks($('#itemLinks', page), item); + LibraryBrowser.renderLinks(page.querySelector('#itemLinks'), item); LibraryBrowser.renderGenres($('.itemGenres', page), item, context); diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 657baefaf9..9845059a47 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -129,7 +129,7 @@ function onWebSocketMessage(e, data) { var msg = data; - var page = $.mobile.activePage; + var page = $($.mobile.activePage)[0]; if (msg.MessageType === "UserDataChanged") { @@ -375,7 +375,7 @@ LibraryBrowser.renderGenres($('.itemGenres', page), item, context); LibraryBrowser.renderStudios($('.itemStudios', page), item, context); renderUserDataIcons(page, item); - LibraryBrowser.renderLinks($('.itemExternalLinks', page), item); + LibraryBrowser.renderLinks(page.querySelector('.itemExternalLinks'), item); $('.criticRatingScore', page).html((item.CriticRating || '0') + '%'); @@ -1585,6 +1585,12 @@ }); } + function onItemDeleted(e, itemId) { + if (currentItem && currentItem.Id == itemId) { + Dashboard.navigate('index.html'); + } + } + $(document).on('pageinitdepends', "#itemDetailPage", function () { var page = this; @@ -1637,53 +1643,46 @@ }); - }).on('pagebeforeshowready', "#itemDetailPage", function () { - - var page = this; - - $(page).on("click.moreScenes", ".moreScenes", function () { + $(page).on("click", ".moreScenes", function () { Dashboard.getCurrentUser().done(function (user) { renderScenes(page, currentItem, user); }); - }).on("click.morePeople", ".morePeople", function () { + }).on("click", ".morePeople", function () { renderCast(page, currentItem, getContext(currentItem)); - }).on("click.moreSpecials", ".moreSpecials", function () { + }).on("click", ".moreSpecials", function () { Dashboard.getCurrentUser().done(function (user) { renderSpecials(page, currentItem, user); }); - }).on("click.moreCriticReviews", ".moreCriticReviews", function () { + }).on("click", ".moreCriticReviews", function () { renderCriticReviews(page, currentItem); }); + }).on('pagebeforeshowready', "#itemDetailPage", function () { + + var page = this; + reload(page); Events.on(ApiClient, 'websocketmessage', onWebSocketMessage); - Events.on(LibraryBrowser, 'itemdeleting.detailpage', function (e, itemId) { - - if (currentItem && currentItem.Id == itemId) { - Dashboard.navigate('index.html'); - } - }); + Events.on(LibraryBrowser, 'itemdeleting', onItemDeleted); }).on('pagebeforehide', "#itemDetailPage", function () { - Events.off(LibraryBrowser, 'itemdeleting.detailpage'); + Events.off(LibraryBrowser, 'itemdeleting', onItemDeleted); currentItem = null; var page = this; - $(page).off("click.moreScenes").off("click.morePeople").off("click.moreSpecials").off("click.moreCriticReviews"); - Events.off(ApiClient, 'websocketmessage', onWebSocketMessage); }); diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 87e67d44c6..3dbe33ad12 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -545,7 +545,7 @@ var id = item.Id || item.ItemId; if (item.CollectionType == 'livetv') { - return 'livetvsuggested.html'; + return 'livetvsuggested.html#liveTvSuggestedPage'; } if (item.CollectionType == 'channels') { @@ -2138,7 +2138,9 @@ html = Globalize.translate('ValueLinks', html); - $(linksElem).html(html).trigger('create'); + linksElem.innerHTML = html; + $(linksElem).trigger('create'); + $(linksElem).show(); } else { $(linksElem).hide(); @@ -2683,23 +2685,23 @@ removeClass(detailContentEffectedByImage, 'detailContentEffectedByPortraitImage'); elem.classList.add('thumbDetailImageContainer'); - elem.classList.add('portraitDetailImageContainer'); - elem.classList.add('squareDetailImageContainer'); + elem.classList.remove('portraitDetailImageContainer'); + elem.classList.remove('squareDetailImageContainer'); } else if (shape == 'square') { removeClass(detailContentEffectedByImage, 'detailContentEffectedByThumbImage'); removeClass(detailContentEffectedByImage, 'detailContentEffectedByPortraitImage'); addClass(detailContentEffectedByImage, 'detailContentEffectedBySquareImage'); - elem.classList.add('thumbDetailImageContainer'); - elem.classList.add('portraitDetailImageContainer'); + elem.classList.remove('thumbDetailImageContainer'); + elem.classList.remove('portraitDetailImageContainer'); elem.classList.add('squareDetailImageContainer'); } else { removeClass(detailContentEffectedByImage, 'detailContentEffectedByThumbImage'); removeClass(detailContentEffectedByImage, 'detailContentEffectedBySquareImage'); addClass(detailContentEffectedByImage, 'detailContentEffectedByPortraitImage'); - elem.classList.add('thumbDetailImageContainer'); + elem.classList.remove('thumbDetailImageContainer'); elem.classList.add('portraitDetailImageContainer'); elem.classList.remove('squareDetailImageContainer'); } diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index 26f5362f82..7311fcaa19 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -350,9 +350,9 @@ var href = card.getAttribute('data-href') || card.href; if (!href) { - var link = card.getElementsByTagName('a'); - if (link) { - href = link.href; + var links = card.getElementsByTagName('a'); + if (links.length) { + href = links[0].href; } } @@ -518,7 +518,7 @@ $('.detailsMenu').remove(); - var html = '
'; + var html = '
'; html += '
'; html += ''; @@ -850,18 +850,28 @@ preventHover = true; } - this.off('.cardMenu') - .on('contextmenu.cardMenu', '.card', onCardTapHold) - .off('.latestgroupings') - .on('click.latestgroupings', '.groupedCard', onGroupedCardClick) - .off('.dotmenu') - .on('click.dotmenu', '.listviewMenuButton', onListViewMenuButtonClick); + this.off('contextmenu', '.card', onCardTapHold); + this.on('contextmenu', '.card', onCardTapHold); + + this.off('click', '.groupedCard', onGroupedCardClick); + this.on('click', '.groupedCard', onGroupedCardClick); + + this.off('click', '.listviewMenuButton', onListViewMenuButtonClick); + this.on('click', '.listviewMenuButton', onListViewMenuButtonClick); if (!AppInfo.isTouchPreferred) { - this.off('.cardHoverMenu').on('mouseenter.cardHoverMenu', '.card:not(.bannerCard)', onHoverIn).on('mouseleave.cardHoverMenu', '.card:not(.bannerCard)', onHoverOut).on("touchstart.cardHoverMenu", '.card:not(.bannerCard)', preventTouchHover); + this.off('mouseenter', '.card:not(.bannerCard)', onHoverIn); + this.on('mouseenter', '.card:not(.bannerCard)', onHoverIn); + + this.off('mouseleave', '.card:not(.bannerCard)', onHoverOut); + this.on('mouseleave', '.card:not(.bannerCard)', onHoverOut); + + this.off("touchstart", '.card:not(.bannerCard)', preventTouchHover); + this.on("touchstart", '.card:not(.bannerCard)', preventTouchHover); } - this.off('.mediaDetails').on('click.mediaDetails', '.mediaItem', onCardClick); + this.off('click', '.mediaItem', onCardClick); + this.on('click', '.mediaItem', onCardClick); return this; }; @@ -927,6 +937,11 @@ }).get(); } + function onSyncJobListSubmit() { + + hideSelections($($.mobile.activePage)[0]); + } + function sync(page) { var selection = getSelectedItems(page); @@ -945,12 +960,8 @@ items: selection }); - Events.off(SyncManager, 'jobsubmit.librarylist'); - - Events.on(SyncManager, 'jobsubmit.librarylist', function () { - - hideSelections(page); - }); + Events.off(SyncManager, 'jobsubmit', onSyncJobListSubmit); + Events.on(SyncManager, 'jobsubmit', onSyncJobListSubmit); } function combineVersions(page) { @@ -1214,7 +1225,7 @@ } function initializeApiClient(apiClient) { - $(apiClient).off('websocketmessage.librarylist', onWebSocketMessage).on('websocketmessage.librarylist', onWebSocketMessage); + $(apiClient).off('websocketmessage', onWebSocketMessage).on('websocketmessage', onWebSocketMessage); } Dashboard.ready(function () { diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js index 8f70a5ad6b..97f558f8f2 100644 --- a/dashboard-ui/scripts/librarymenu.js +++ b/dashboard-ui/scripts/librarymenu.js @@ -125,11 +125,7 @@ if (AppInfo.isTouchPreferred) { - if ('ontouchend' in document) { - $('.mainDrawerButton').on('touchend click', openMainDrawer); - } else { - $('.mainDrawerButton').on('click', openMainDrawer); - } + $('.mainDrawerButton').on('touchend', openMainDrawer).on('click', openMainDrawer); } else { $('.mainDrawerButton').createHoverTouch().on('hovertouch', openMainDrawer); @@ -378,6 +374,13 @@ Events.on(drawer.querySelector('.lnkManageServer'), 'click', onManageServerClicked); } + function onSidebarLinkClick() { + var section = this.getElementsByClassName('sectionName')[0]; + var text = section ? section.innerHTML : this.innerHTML; + + document.querySelector('.libraryMenuButtonText').innerHTML = text; + } + function updateLibraryMenu(user) { if (!user) { @@ -462,14 +465,7 @@ libraryMenuOptions.innerHTML = html; var elem = libraryMenuOptions; - $('.sidebarLink', elem).off('click.updateText').on('click.updateText', function () { - - var section = this.getElementsByClassName('sectionName')[0]; - var text = section ? section.innerHTML : this.innerHTML; - - document.querySelector('.libraryMenuButtonText').innerHTML = text; - - }); + $('.sidebarLink', elem).off('click', onSidebarLinkClick).on('click', onSidebarLinkClick); }); if (user.Policy.IsAdministrator) { @@ -811,7 +807,7 @@ Events.off(page, 'swiperight', onPageSwipeLeft); if (canGoBack) { - Events.on(page, 'swiperight', onPageSwipeLeft); + //Events.on(page, 'swiperight', onPageSwipeLeft); } } @@ -862,9 +858,9 @@ function initializeApiClient(apiClient) { requiresLibraryMenuRefresh = true; - Events.off(apiClient, 'websocketmessage.librarymenu', onWebSocketMessage); + Events.off(apiClient, 'websocketmessage', onWebSocketMessage); - Events.on(apiClient, 'websocketmessage.librarymenu', onWebSocketMessage); + Events.on(apiClient, 'websocketmessage', onWebSocketMessage); } Dashboard.ready(function () { @@ -878,7 +874,13 @@ }); - Events.on(ConnectionManager, 'localusersignedin localusersignedout', function () { + Events.on(ConnectionManager, 'localusersignedin', function () { + requiresLibraryMenuRefresh = true; + requiresViewMenuRefresh = true; + requiresDrawerRefresh = true; + }); + + Events.on(ConnectionManager, 'localusersignedout', function () { requiresLibraryMenuRefresh = true; requiresViewMenuRefresh = true; requiresDrawerRefresh = true; diff --git a/dashboard-ui/scripts/livetvcomponents.js b/dashboard-ui/scripts/livetvcomponents.js index 1c99c46c75..6534dc14ed 100644 --- a/dashboard-ui/scripts/livetvcomponents.js +++ b/dashboard-ui/scripts/livetvcomponents.js @@ -208,7 +208,7 @@ if (currentPosterItem) { - $(currentPosterItem).off('click.overlay'); + $(currentPosterItem).off('click'); currentPosterItem = null; } } diff --git a/dashboard-ui/scripts/livetvnewrecording.js b/dashboard-ui/scripts/livetvnewrecording.js index d9379c3b38..8ede6a9b06 100644 --- a/dashboard-ui/scripts/livetvnewrecording.js +++ b/dashboard-ui/scripts/livetvnewrecording.js @@ -126,7 +126,7 @@ ApiClient.createLiveTvSeriesTimer(item).done(function () { Dashboard.hideLoadingMsg(); - Dashboard.navigate('livetvseriestimers.html'); + Dashboard.navigate('livetvsuggested.html#liveTvSeriesTimersPage'); }); @@ -134,7 +134,7 @@ ApiClient.createLiveTvTimer(item).done(function () { Dashboard.hideLoadingMsg(); - Dashboard.navigate('livetvtimers.html'); + Dashboard.navigate('livetvsuggested.html#liveTvTimersPage'); }); } diff --git a/dashboard-ui/scripts/livetvrecording.js b/dashboard-ui/scripts/livetvrecording.js index 6fe239556e..71ef931b75 100644 --- a/dashboard-ui/scripts/livetvrecording.js +++ b/dashboard-ui/scripts/livetvrecording.js @@ -14,7 +14,7 @@ Dashboard.alert(Globalize.translate('MessageRecordingDeleted')); - Dashboard.navigate('livetvrecordings.html'); + Dashboard.navigate('livetvsuggested.html#liveTvRecordingsPage'); }); } diff --git a/dashboard-ui/scripts/livetvtimer.js b/dashboard-ui/scripts/livetvtimer.js index 993af28389..6d42a9e7f1 100644 --- a/dashboard-ui/scripts/livetvtimer.js +++ b/dashboard-ui/scripts/livetvtimer.js @@ -14,7 +14,7 @@ Dashboard.alert(Globalize.translate('MessageRecordingCancelled')); - Dashboard.navigate('livetvtimers.html'); + Dashboard.navigate('livetvsuggested.html#liveTvTimersPage'); }); } diff --git a/dashboard-ui/scripts/mediacontroller.js b/dashboard-ui/scripts/mediacontroller.js index ebdeb4d364..728da6f476 100644 --- a/dashboard-ui/scripts/mediacontroller.js +++ b/dashboard-ui/scripts/mediacontroller.js @@ -39,7 +39,7 @@ function monitorPlayer(player) { - Events.on(player, 'playbackstart.mediacontroller', function (e, state) { + Events.on(player, 'playbackstart', function (e, state) { var info = { QueueableMediaTypes: state.NowPlayingItem.MediaType, @@ -53,7 +53,7 @@ }); - Events.on(player, 'playbackstop.mediacontroller', function (e, state) { + Events.on(player, 'playbackstop', function (e, state) { var stopInfo = { itemId: state.NowPlayingItem.Id, @@ -263,7 +263,7 @@ var keys = new bindKeys(self); - $(window).on("keydown", keys.keyBinding).on("keypress keyup", keys.keyPrevent); + $(window).on("keydown", keys.keyBinding).on("keypress", keys.keyPrevent).on("keyup", keys.keyPrevent); self.registerPlayer = function (player) { @@ -875,12 +875,14 @@ }); }); + function onCastButtonClicked() { + + showPlayerSelection(); + } + $(document).on('headercreated', function () { - $('.btnCast').off('.mediacontroller').on('click.mediacontroller', function () { - - showPlayerSelection(); - }); + $('.btnCast').off('click', onCastButtonClicked).on('click', onCastButtonClicked); }).on('pagebeforeshow', ".page", function () { diff --git a/dashboard-ui/scripts/mediaplayer-video.js b/dashboard-ui/scripts/mediaplayer-video.js index 62e91c1984..9fb27c0a5c 100644 --- a/dashboard-ui/scripts/mediaplayer-video.js +++ b/dashboard-ui/scripts/mediaplayer-video.js @@ -678,10 +678,9 @@ html += '
'; // videoBackdrop html += '
'; // mediaPlayer - $(document.body).append(html); - - var mediaPlayerElem = $('#mediaPlayer', document.body); - mediaPlayerElem.trigger('create'); + var div = document.createElement('div'); + div.innerHTML = html; + document.body.appendChild(div); } Dashboard.ready(function () { @@ -858,49 +857,73 @@ return html; } - function bindEventsForPlayback() { + function onPopState() { + // Stop playback on browser back button nav + self.stop(); + return; + } + + function onBodyMouseMove() { + idleHandler(); + } + + function onFullScreenChange() { + if (self.isFullScreen()) { + enterFullScreen(); + idleState = true; + + } else { + exitFullScreenToWindow(); + } + } + + function bindEventsForPlayback(mediaRenderer) { var hideElementsOnIdle = true; if (hideElementsOnIdle) { - $('.itemVideo').off('mousemove.videoplayer keydown.videoplayer scroll.videoplayer mousedown.videoplayer', idleHandler).on('mousemove.videoplayer keydown.videoplayer scroll.videoplayer mousedown.videoplayer', idleHandler).trigger('mousemove'); + + var itemVideo = document.querySelector('.itemVideo'); + if (itemVideo) { + Events.on(itemVideo, 'mousemove', idleHandler); + Events.on(itemVideo, 'keydown', idleHandler); + Events.on(itemVideo, 'scroll', idleHandler); + Events.on(itemVideo, 'mousedown', idleHandler); + idleHandler(); + } } - $(document).on('webkitfullscreenchange.videoplayer mozfullscreenchange.videoplayer msfullscreenchange.videoplayer fullscreenchange.videoplayer', function (e) { + $(document).on('webkitfullscreenchange', onFullScreenChange); + $(document).on('mozfullscreenchange', onFullScreenChange); + $(document).on('msfullscreenchange', onFullScreenChange); + $(document).on('fullscreenchange', onFullScreenChange); - if (self.isFullScreen()) { - enterFullScreen(); - idleState = true; - - } else { - exitFullScreenToWindow(); - } - }); - - // Stop playback on browser back button nav - $(window).one("popstate.videoplayer", function () { - self.stop(); - return; - }); + $(window).one("popstate", onPopState); if (hideElementsOnIdle) { - $(document.body).on("mousemove.videoplayer", function () { - - idleHandler(this); - }); + $(document.body).on("mousemove", onBodyMouseMove); } } - function unbindEventsForPlayback() { + function unbindEventsForPlayback(mediaRenderer) { - $(document).off('.videoplayer'); + $(document).off('webkitfullscreenchange', onFullScreenChange); + $(document).off('mozfullscreenchange', onFullScreenChange); + $(document).off('msfullscreenchange', onFullScreenChange); + $(document).off('fullscreenchange', onFullScreenChange); // Stop playback on browser back button nav - $(window).off("popstate.videoplayer"); + $(window).off("popstate", onPopState); - $(document.body).off("mousemove.videoplayer"); + $(document.body).off("mousemove", onBodyMouseMove); - $('.itemVideo').off('mousemove.videoplayer keydown.videoplayer scroll.videoplayer mousedown.videoplayer'); + var itemVideo = document.querySelector('.itemVideo'); + if (itemVideo) { + Events.off(itemVideo, 'mousemove', idleHandler); + Events.off(itemVideo, 'keydown', idleHandler); + Events.off(itemVideo, 'scroll', idleHandler); + Events.off(itemVideo, 'mousedown', idleHandler); + } } self.canAutoPlayVideo = function () { @@ -926,7 +949,7 @@ currentTimeElement.html('--:--'); - unbindEventsForPlayback(); + unbindEventsForPlayback(mediaRenderer); }; self.playVideo = function (item, mediaSource, startPosition) { @@ -1087,9 +1110,8 @@ }).one("playing.mediaplayerevent", function () { - // For some reason this is firing at the start, so don't bind until playback has begun - $(this).on("ended.playbackstopped", self.onPlaybackStopped).one('ended.playnext', self.playNextAfterEnded); + $(this).on("ended", self.onPlaybackStopped).one('ended', self.playNextAfterEnded); self.onPlaybackStart(this, item, mediaSource); @@ -1160,7 +1182,7 @@ } }); - bindEventsForPlayback(); + bindEventsForPlayback(mediaRenderer); mediaPlayerContainer.trigger('create'); @@ -1185,7 +1207,7 @@ } var controls = requiresNativeControls ? '.videoAdvancedControls' : '.videoControls'; - controls = document.getElementsByClassName(controls)[0]; + controls = document.querySelector(controls); var previousTrackButton = controls.getElementsByClassName('previousTrackButton')[0]; var nextTrackButton = controls.getElementsByClassName('nextTrackButton')[0]; diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index a1b5bf3d12..f9ae5be8cf 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -557,16 +557,16 @@ clearProgressInterval(); - Events.off(mediaRenderer, 'ended.playbackstopped'); - Events.off(mediaRenderer, 'ended.playnext'); + Events.off(mediaRenderer, 'ended', self.onPlaybackStopped); + Events.off(mediaRenderer, 'ended', self.playNextAfterEnded); $(mediaRenderer).one("play", function () { self.updateCanClientSeek(this); - Events.on(this, 'ended.playbackstopped', self.onPlaybackStopped); + Events.on(this, 'ended', self.onPlaybackStopped); - $(this).one('ended.playnext', self.playNextAfterEnded); + $(this).one('ended', self.playNextAfterEnded); self.startProgressInterval(); sendProgressUpdate(); @@ -1358,11 +1358,11 @@ mediaRenderer.stop(); - Events.off(mediaRenderer, "ended.playnext"); + Events.off(mediaRenderer, 'ended', self.playNextAfterEnded); $(mediaRenderer).one("ended", function() { - Events.off(this); + $(this).off('.mediaplayerevent'); this.cleanup(destroyRenderer); @@ -1568,7 +1568,7 @@ Events.off(mediaRenderer, '.mediaplayerevent'); - Events.off(mediaRenderer, 'ended.playbackstopped'); + Events.off(mediaRenderer, 'ended', self.onPlaybackStopped); self.cleanup(mediaRenderer); @@ -1697,9 +1697,9 @@ Logger.log('audio element event: playing'); // For some reason this is firing at the start, so don't bind until playback has begun - Events.on(this, "ended.playbackstopped", self.onPlaybackStopped); - - $(this).one('ended.playnext', self.playNextAfterEnded); + Events.on(this, 'ended', self.onPlaybackStopped); + + $(this).one('ended', self.playNextAfterEnded); self.onPlaybackStart(this, item, mediaSource); diff --git a/dashboard-ui/scripts/nowplayingbar.js b/dashboard-ui/scripts/nowplayingbar.js index 9cad9ebced..2b69f8dac9 100644 --- a/dashboard-ui/scripts/nowplayingbar.js +++ b/dashboard-ui/scripts/nowplayingbar.js @@ -449,7 +449,12 @@ if (currentPlayer) { - Events.off(currentPlayer, '.nowplayingbar'); + $(currentPlayer).off('playbackstart', onPlaybackStart) + .off('playbackstop', onPlaybackStopped) + .off('volumechange', onVolumeChanged) + .off('playstatechange', onStateChanged) + .off('positionchange', onStateChanged); + currentPlayer.endPlayerUpdates(); currentPlayer = null; @@ -486,11 +491,11 @@ onStateChanged.call(player, { type: 'init' }, state); }); - $(player).on('playbackstart.nowplayingbar', onPlaybackStart) - .on('playbackstop.nowplayingbar', onPlaybackStopped) - .on('volumechange.nowplayingbar', onVolumeChanged) - .on('playstatechange.nowplayingbar', onStateChanged) - .on('positionchange.nowplayingbar', onStateChanged); + $(player).on('playbackstart', onPlaybackStart) + .on('playbackstop', onPlaybackStopped) + .on('volumechange', onVolumeChanged) + .on('playstatechange', onStateChanged) + .on('positionchange', onStateChanged); } Dashboard.ready(function () { diff --git a/dashboard-ui/scripts/nowplayingpage.js b/dashboard-ui/scripts/nowplayingpage.js index 843ee13564..d6627314f9 100644 --- a/dashboard-ui/scripts/nowplayingpage.js +++ b/dashboard-ui/scripts/nowplayingpage.js @@ -565,7 +565,12 @@ if (currentPlayer) { - $(currentPlayer).off('.nowplayingpage'); + $(currentPlayer).off('playbackstart', onPlaybackStart) + .off('playbackstop', onPlaybackStopped) + .off('volumechange', onStateChanged) + .off('playstatechange', onStateChanged) + .off('positionchange', onStateChanged); + currentPlayer.endPlayerUpdates(); currentPlayer = null; } @@ -586,11 +591,11 @@ onStateChanged.call(player, { type: 'init' }, state); }); - $(player).on('playbackstart.nowplayingpage', onPlaybackStart) - .on('playbackstop.nowplayingpage', onPlaybackStopped) - .on('volumechange.nowplayingpage', onStateChanged) - .on('playstatechange.nowplayingpage', onStateChanged) - .on('positionchange.nowplayingpage', onStateChanged); + $(player).on('playbackstart', onPlaybackStart) + .on('playbackstop', onPlaybackStopped) + .on('volumechange', onStateChanged) + .on('playstatechange', onStateChanged) + .on('positionchange', onStateChanged); var playerInfo = MediaController.getPlayerInfo(); @@ -708,6 +713,10 @@ return true; } + function onPlayerChange() { + bindToPlayer($($.mobile.activePage)[0], MediaController.getCurrentPlayer()); + } + $(document).on('pageinitdepends', "#nowPlayingPage", function () { var page = this; @@ -766,10 +775,7 @@ Dashboard.ready(function () { - $(MediaController).on('playerchange.nowplayingpage', function () { - - bindToPlayer(page, MediaController.getCurrentPlayer()); - }); + $(MediaController).on('playerchange', onPlayerChange); bindToPlayer(page, MediaController.getCurrentPlayer()); @@ -787,7 +793,7 @@ releaseCurrentPlayer(); - $(MediaController).off('playerchange.nowplayingpage'); + $(MediaController).off('playerchange', onPlayerChange); lastPlayerState = null; $(document.body).removeClass('hiddenViewMenuBar').removeClass('hiddenNowPlayingBar'); diff --git a/dashboard-ui/scripts/search.js b/dashboard-ui/scripts/search.js index 6a9c30acbb..fd5f67d25b 100644 --- a/dashboard-ui/scripts/search.js +++ b/dashboard-ui/scripts/search.js @@ -227,14 +227,19 @@ function hideSearchMenu() { - if ($('.viewMenuSearch').is(':visible')) { + var viewMenuSearch = document.querySelector('.viewMenuSearch'); + + if (!viewMenuSearch) { + return; + } + + if (!viewMenuSearch.classList.contains('hide')) { require(["jquery", "velocity"], function ($, Velocity) { $('.btnCloseSearch').hide(); - var elem = $('.viewMenuSearch') - .css({ left: '0' })[0]; + viewMenuSearch.style.left = '0'; - Velocity.animate(elem, { "left": "100%" }, + Velocity.animate(viewMenuSearch, { "left": "100%" }, { complete: function () { $('.viewMenuSearch').visible(false); diff --git a/dashboard-ui/scripts/sections.js b/dashboard-ui/scripts/sections.js index 1c722035dc..7e97ca9f09 100644 --- a/dashboard-ui/scripts/sections.js +++ b/dashboard-ui/scripts/sections.js @@ -440,7 +440,7 @@ html += '
'; html += '

' + Globalize.translate('HeaderLatestTvRecordings') + '

'; - html += '' + Globalize.translate('ButtonMore') + ''; + html += '' + Globalize.translate('ButtonMore') + ''; html += '
'; } diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index ca0060c2b4..6d87c52b1f 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -33,7 +33,7 @@ var Dashboard = { //$.mobile.listview.prototype.options.dividerTheme = "b"; //$.mobile.popup.prototype.options.theme = "c"; - $.mobile.popup.prototype.options.transition = "pop"; + $.mobile.popup.prototype.options.transition = "none"; //$.mobile.keepNative = "textarea"; @@ -623,7 +623,7 @@ var Dashboard = { html += ''; $(document.body).append(html); - + document.body.classList.add('bodyWithPopupOpen'); // This timeout is obviously messy but it's unclear how to determine when the webcomponent is ready for use @@ -1734,9 +1734,9 @@ var AppInfo = {}; apiClient.getDefaultImageQuality = Dashboard.getDefaultImageQuality; apiClient.normalizeImageOptions = Dashboard.normalizeImageOptions; - $(apiClient).off('.dashboard') - .on("websocketmessage.dashboard", Dashboard.onWebSocketMessageReceived) - .on('requestfail.dashboard', Dashboard.onRequestFail); + $(apiClient).off("websocketmessage", Dashboard.onWebSocketMessageReceived).off('requestfail', Dashboard.onRequestFail); + + $(apiClient).on("websocketmessage", Dashboard.onWebSocketMessageReceived).on('requestfail', Dashboard.onRequestFail); } //localStorage.clear(); @@ -2014,11 +2014,12 @@ var AppInfo = {}; $(document).on('WebComponentsReady', function () { - var drawer = $('.mainDrawerPanel').removeClass('mainDrawerPanelPreInit')[0]; + var drawer = document.querySelector('.mainDrawerPanel'); + drawer.classList.remove('mainDrawerPanelPreInit'); drawer.forceNarrow = true; drawer.drawerWidth = screen.availWidth >= 330 ? "310px" : "270px"; - if ($.browser.safari) { + if ($.browser.safari && !AppInfo.isNativeApp) { drawer.disableEdgeSwipe = true; } diff --git a/dashboard-ui/scripts/syncactivity.js b/dashboard-ui/scripts/syncactivity.js index ea28ef4480..629e4aeed7 100644 --- a/dashboard-ui/scripts/syncactivity.js +++ b/dashboard-ui/scripts/syncactivity.js @@ -311,7 +311,7 @@ }); startListening(page); - $(ApiClient).on("websocketmessage.syncactivity", onWebSocketMessage); + $(ApiClient).on("websocketmessage", onWebSocketMessage); }).on('pagebeforehide', ".syncActivityPage", function () { @@ -323,7 +323,7 @@ }); stopListening(); - $(ApiClient).off(".syncactivity"); + $(ApiClient).off("websocketmessage", onWebSocketMessage); }); })(); \ No newline at end of file diff --git a/dashboard-ui/scripts/syncjob.js b/dashboard-ui/scripts/syncjob.js index 35227e6b7a..430b90a746 100644 --- a/dashboard-ui/scripts/syncjob.js +++ b/dashboard-ui/scripts/syncjob.js @@ -403,14 +403,14 @@ loadJob(page); startListening(page); - $(ApiClient).on("websocketmessage.syncJobPage", onWebSocketMessage); + $(ApiClient).on("websocketmessage", onWebSocketMessage); }).on('pagebeforehide', ".syncJobPage", function () { var page = this; stopListening(); - $(ApiClient).off(".syncJobPage"); + $(ApiClient).off("websocketmessage", onWebSocketMessage); }); })(); \ No newline at end of file diff --git a/dashboard-ui/scripts/taskbutton.js b/dashboard-ui/scripts/taskbutton.js index 47f139b5fe..92e4e97e2e 100644 --- a/dashboard-ui/scripts/taskbutton.js +++ b/dashboard-ui/scripts/taskbutton.js @@ -72,13 +72,16 @@ $.fn.taskButton = function (options) { }); } - function onButtonClick(instance, id) { + function onButtonClick() { + + var button = this; + var id = button.getAttribute('data-taskid'); var key = 'scheduledTaskButton' + options.taskKey; var expectedValue = '4'; if (appStorage.getItem(key) == expectedValue) { - onScheduledTaskMessageConfirmed(instance, id); + onScheduledTaskMessageConfirmed(button, id); } else { var msg = Globalize.translate('ConfirmMessageScheduledTaskButton'); @@ -91,13 +94,28 @@ $.fn.taskButton = function (options) { if (result) { appStorage.setItem(key, expectedValue); - onScheduledTaskMessageConfirmed(instance, id); + onScheduledTaskMessageConfirmed(button, id); } }); } } + function onSocketOpen() { + if (ApiClient.isWebSocketOpen()) { + ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000"); + } + } + + function onSocketMessage(e, msg) { + if (msg.MessageType == "ScheduledTasksInfo") { + + var tasks = msg.Data; + + updateTasks(self, tasks); + } + } + var self = this; if (options.panel) { @@ -106,8 +124,8 @@ $.fn.taskButton = function (options) { if (options.mode == 'off') { - this.off(".taskbutton"); - $(ApiClient).off(".taskbutton"); + this.off('click', onButtonClick); + $(ApiClient).off("websocketmessage", onSocketMessage).off('websocketopen', onSocketOpen); if (ApiClient.isWebSocketOpen()) { ApiClient.sendWebSocketMessage("ScheduledTasksInfoStop"); @@ -115,13 +133,7 @@ $.fn.taskButton = function (options) { } else if (this.length) { - this.on('click.taskbutton', function () { - - var button = this; - var id = button.getAttribute('data-taskid'); - - onButtonClick(self, id); - }); + this.on('click', onButtonClick); pollTasks(self); @@ -129,21 +141,7 @@ $.fn.taskButton = function (options) { ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000"); } - $(ApiClient).on("websocketmessage.taskbutton", function (e, msg) { - - if (msg.MessageType == "ScheduledTasksInfo") { - - var tasks = msg.Data; - - updateTasks(self, tasks); - } - - }).on('websocketopen.taskbutton', function () { - - if (ApiClient.isWebSocketOpen()) { - ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000"); - } - }); + $(ApiClient).on("websocketmessage", onSocketMessage).on('websocketopen', onSocketOpen); } return this; diff --git a/dashboard-ui/scripts/tvrecommended.js b/dashboard-ui/scripts/tvrecommended.js index 70639b22c8..101337fee5 100644 --- a/dashboard-ui/scripts/tvrecommended.js +++ b/dashboard-ui/scripts/tvrecommended.js @@ -18,16 +18,12 @@ if (LibraryMenu.getTopParentId()) { - $('.scopedLibraryViewNav', page).show(); - $('.globalNav', page).hide(); $('.scopedContent', page).show(); context = 'tv'; loadResume(page); } else { - $('.scopedLibraryViewNav', page).hide(); - $('.globalNav', page).show(); $('.scopedContent', page).hide(); } diff --git a/dashboard-ui/scripts/tvupcoming.js b/dashboard-ui/scripts/tvupcoming.js index 0d1fae2f6d..94e3c3bdff 100644 --- a/dashboard-ui/scripts/tvupcoming.js +++ b/dashboard-ui/scripts/tvupcoming.js @@ -2,20 +2,6 @@ $(document).on('pagebeforeshowready', "#tvUpcomingPage", function () { - var page = this; - - if (LibraryMenu.getTopParentId()) { - - $('.scopedLibraryViewNav', page).show(); - $('.globalNav', page).hide(); - - } else { - $('.scopedLibraryViewNav', page).hide(); - $('.globalNav', page).show(); - } - - }).on('pagebeforeshowready', "#tvUpcomingPage", function () { - Dashboard.showLoadingMsg(); var page = this; diff --git a/dashboard-ui/thirdparty/emby-icons.html b/dashboard-ui/thirdparty/emby-icons.html index ce4fe66a63..4285182475 100644 --- a/dashboard-ui/thirdparty/emby-icons.html +++ b/dashboard-ui/thirdparty/emby-icons.html @@ -107,6 +107,7 @@ See [iron-iconset](#iron-iconset) and [iron-iconset-svg](#iron-iconset-svg) for + diff --git a/dashboard-ui/tvrecommended.html b/dashboard-ui/tvrecommended.html index 5602d40ffd..b436a089e8 100644 --- a/dashboard-ui/tvrecommended.html +++ b/dashboard-ui/tvrecommended.html @@ -6,13 +6,7 @@
- -