diff --git a/dashboard-ui/autoorganizelog.html b/dashboard-ui/autoorganizelog.html index 2db5c18dd7..d2dffd7328 100644 --- a/dashboard-ui/autoorganizelog.html +++ b/dashboard-ui/autoorganizelog.html @@ -4,7 +4,7 @@ ${TitleAutoOrganize} -
+
diff --git a/dashboard-ui/editcollectionitems.html b/dashboard-ui/editcollectionitems.html index aa72118445..6a27c76549 100644 --- a/dashboard-ui/editcollectionitems.html +++ b/dashboard-ui/editcollectionitems.html @@ -4,7 +4,7 @@ Emby -
+
@@ -68,10 +68,6 @@
- -
diff --git a/dashboard-ui/library.html b/dashboard-ui/library.html index 02050a7a46..387704ff9c 100644 --- a/dashboard-ui/library.html +++ b/dashboard-ui/library.html @@ -4,7 +4,7 @@ ${TitleMediaLibrary} -
+
diff --git a/dashboard-ui/livetvstatus.html b/dashboard-ui/livetvstatus.html index 94fee4897f..1a4c8472b1 100644 --- a/dashboard-ui/livetvstatus.html +++ b/dashboard-ui/livetvstatus.html @@ -4,7 +4,7 @@ ${TitleLiveTV} -
+
diff --git a/dashboard-ui/mypreferenceswebclient.html b/dashboard-ui/mypreferenceswebclient.html index 31959edb8d..e285a43a70 100644 --- a/dashboard-ui/mypreferenceswebclient.html +++ b/dashboard-ui/mypreferenceswebclient.html @@ -155,7 +155,7 @@
- +
diff --git a/dashboard-ui/mysync.html b/dashboard-ui/mysync.html index f32503ba16..186879e688 100644 --- a/dashboard-ui/mysync.html +++ b/dashboard-ui/mysync.html @@ -4,7 +4,7 @@ ${TitleSync} -
+
${TabSyncJobs} @@ -13,7 +13,7 @@
-
+
diff --git a/dashboard-ui/mysyncjob.html b/dashboard-ui/mysyncjob.html index 200238fe89..e29162a7c0 100644 --- a/dashboard-ui/mysyncjob.html +++ b/dashboard-ui/mysyncjob.html @@ -4,7 +4,7 @@ ${TitleSync} -
+
${TabSyncJobs} @@ -20,9 +20,6 @@
-
diff --git a/dashboard-ui/nowplaying.html b/dashboard-ui/nowplaying.html index caf0512c02..2b68f0dacb 100644 --- a/dashboard-ui/nowplaying.html +++ b/dashboard-ui/nowplaying.html @@ -4,7 +4,7 @@ Emby -
+
${TabNowPlaying} @@ -149,11 +149,6 @@
- -
diff --git a/dashboard-ui/scripts/chromecast.js b/dashboard-ui/scripts/chromecast.js index 4c027cc096..9fb95de4a3 100644 --- a/dashboard-ui/scripts/chromecast.js +++ b/dashboard-ui/scripts/chromecast.js @@ -743,12 +743,18 @@ self.volumeDown = function () { - self.setVolume(getCurrentVolume() - 2); + castPlayer.sendMessage({ + options: {}, + command: 'VolumeDown' + }); }; self.volumeUp = function () { - self.setVolume(getCurrentVolume() + 2); + castPlayer.sendMessage({ + options: {}, + command: 'VolumeUp' + }); }; self.setVolume = function (vol) { diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index 8fd2194df8..54cdd323c7 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -1377,7 +1377,7 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' var apiClient = ApiClient; - if (apiClient) { + if (apiClient && !AppInfo.isNativeApp) { showWelcomeIfNeeded(page, apiClient); } diff --git a/dashboard-ui/scripts/editcollectionitems.js b/dashboard-ui/scripts/editcollectionitems.js index 501b2add80..567e0eb23f 100644 --- a/dashboard-ui/scripts/editcollectionitems.js +++ b/dashboard-ui/scripts/editcollectionitems.js @@ -230,7 +230,14 @@ }); } - $(document).on('pageinit', "#editCollectionTitlesPage", function () { + function onSearchFormSubmit() { + var page = $(this).parents('.page'); + + showSearchResults(page, $('#txtLookupName', page).val()); + return false; + } + + $(document).on('pageinitdepends', "#editCollectionTitlesPage", function () { var page = this; @@ -270,8 +277,9 @@ removeItemsFromCollection(page); }); + $('.collectionItemSearchForm').off('submit', onSearchFormSubmit).on('submit', onSearchFormSubmit); - }).on('pagebeforeshow', "#editCollectionTitlesPage", function () { + }).on('pagebeforeshowready', "#editCollectionTitlesPage", function () { var page = this; @@ -290,15 +298,4 @@ $("body").off("popupafteropen.collections"); }); - window.EditCollectionItemsPage = { - - onSearchFormSubmit: function () { - - var page = $(this).parents('.page'); - - showSearchResults(page, $('#txtLookupName', page).val()); - return false; - } - }; - })(jQuery, document, window, window.FileReader, escape); \ No newline at end of file diff --git a/dashboard-ui/scripts/editorsidebar.js b/dashboard-ui/scripts/editorsidebar.js index 15d1a22a18..0c7eb6855f 100644 --- a/dashboard-ui/scripts/editorsidebar.js +++ b/dashboard-ui/scripts/editorsidebar.js @@ -396,7 +396,7 @@ updateEditorNode(this, item); - }).on('pagebeforeshow', ".metadataEditorPage", function () { + }).on('pagebeforeshowready', ".metadataEditorPage", function () { window.MetadataEditor = new metadataEditor(); diff --git a/dashboard-ui/scripts/nowplayingpage.js b/dashboard-ui/scripts/nowplayingpage.js index d8d4385692..dd0aed0ec6 100644 --- a/dashboard-ui/scripts/nowplayingpage.js +++ b/dashboard-ui/scripts/nowplayingpage.js @@ -714,13 +714,16 @@ return null; }; - $(document).on('pageinit', "#nowPlayingPage", function () { + $(document).on('pageinitdepends', "#nowPlayingPage", function () { var page = this; bindEvents(page); - }).on('pageshow', "#nowPlayingPage", function () { + $('.sendMessageForm').off('submit', NowPlayingPage.onMessageSubmit).on('submit', NowPlayingPage.onMessageSubmit); + $('.typeTextForm').off('submit', NowPlayingPage.onSendStringSubmit).on('submit', NowPlayingPage.onSendStringSubmit); + + }).on('pageshowready', "#nowPlayingPage", function () { var page = this; diff --git a/dashboard-ui/scripts/search.js b/dashboard-ui/scripts/search.js index 8af24a6911..397bff80ec 100644 --- a/dashboard-ui/scripts/search.js +++ b/dashboard-ui/scripts/search.js @@ -230,8 +230,7 @@ { complete: function () { $('.viewMenuSearch').addClass('hide'); - }, - duration: 'fast' + } }); }); } diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 457abf9a59..f1dc5ae7ac 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1822,13 +1822,13 @@ var AppInfo = {}; return false; }); + require(['filesystem']); + if (Dashboard.isRunningInCordova()) { requirejs(['thirdparty/cordova/connectsdk', 'scripts/registrationservices', 'thirdparty/cordova/volume', 'thirdparty/cordova/back']); if ($.browser.android) { - requirejs(['thirdparty/cordova/android/androidcredentials', 'thirdparty/cordova/android/immersive', 'thirdparty/cordova/android/filesystem']); - } else { - requirejs(['thirdparty/cordova/filesystem']); + requirejs(['thirdparty/cordova/android/androidcredentials', 'thirdparty/cordova/android/immersive', 'thirdparty/cordova/android/mediasession']); } if ($.browser.safari) { @@ -1839,7 +1839,6 @@ var AppInfo = {}; if ($.browser.chrome) { requirejs(['scripts/chromecast']); } - requirejs(['thirdparty/filesystem']); } } @@ -1884,6 +1883,16 @@ var AppInfo = {}; define("localassetmanager", ["thirdparty/apiclient/localassetmanager"]); } + if (Dashboard.isRunningInCordova() && $.browser.android) { + define("filesystem", ["thirdparty/cordova/android/filesystem"]); + } + else if (Dashboard.isRunningInCordova()) { + define("filesystem", ["thirdparty/cordova/filesystem"]); + } + else { + define("filesystem", ["thirdparty/filesystem"]); + } + define("connectservice", ["thirdparty/apiclient/connectservice"]); //requirejs(['http://viblast.com/player/free-version/qy2fdwajo1/viblast.js']); diff --git a/dashboard-ui/scripts/syncactivity.js b/dashboard-ui/scripts/syncactivity.js index 6e64c1db16..1cbcf77031 100644 --- a/dashboard-ui/scripts/syncactivity.js +++ b/dashboard-ui/scripts/syncactivity.js @@ -289,7 +289,7 @@ } - $(document).on('pageshow', ".syncActivityPage", function () { + $(document).on('pageshowready', ".syncActivityPage", function () { var page = this; diff --git a/dashboard-ui/scripts/syncjob.js b/dashboard-ui/scripts/syncjob.js index bb34b88aaa..f93620dc5c 100644 --- a/dashboard-ui/scripts/syncjob.js +++ b/dashboard-ui/scripts/syncjob.js @@ -373,7 +373,21 @@ } - $(document).on('pageshow', ".syncJobPage", function () { + function onSubmit() { + var form = this; + + var page = $(form).parents('.page'); + + saveJob(page); + + return false; + } + + $(document).on('pageinitdepends', ".syncJobPage", function () { + + $('.syncJobForm').off('submit', onSubmit).on('submit', onSubmit); + + }).on('pageshowready', ".syncJobPage", function () { var page = this; loadJob(page); @@ -389,18 +403,4 @@ $(ApiClient).off(".syncJobPage"); }); - window.SyncJobPage = { - - onSubmit: function () { - - var form = this; - - var page = $(form).parents('.page'); - - saveJob(page); - - return false; - } - }; - })(); \ No newline at end of file diff --git a/dashboard-ui/scripts/userprofilespage.js b/dashboard-ui/scripts/userprofilespage.js index 733e03c854..0097aa2271 100644 --- a/dashboard-ui/scripts/userprofilespage.js +++ b/dashboard-ui/scripts/userprofilespage.js @@ -430,7 +430,17 @@ }); } - $(document).on('pageinit', "#userProfilesPage", function () { + function onSubmit() { + var form = this; + + var page = $(form).parents('.page'); + + inviteUser(page); + + return false; + } + + $(document).on('pageinitdepends', "#userProfilesPage", function () { var page = this; @@ -439,25 +449,13 @@ showInvitePopup(page); }); - }).on('pagebeforeshow', "#userProfilesPage", function () { + $('.addUserForm').off('submit', onSubmit).on('submit', onSubmit); + + }).on('pagebeforeshowready', "#userProfilesPage", function () { var page = this; loadData(page); }); - window.UserProfilesPage = { - - onSubmit: function () { - - var form = this; - - var page = $(form).parents('.page'); - - inviteUser(page); - - return false; - } - }; - })(document, window, jQuery); \ No newline at end of file diff --git a/dashboard-ui/syncactivity.html b/dashboard-ui/syncactivity.html index 6d12b3bea4..176f5a4063 100644 --- a/dashboard-ui/syncactivity.html +++ b/dashboard-ui/syncactivity.html @@ -4,7 +4,7 @@ ${TitleSync} -
+
diff --git a/dashboard-ui/syncjob.html b/dashboard-ui/syncjob.html index 014ee76d63..6e25b9c455 100644 --- a/dashboard-ui/syncjob.html +++ b/dashboard-ui/syncjob.html @@ -4,7 +4,7 @@ ${TitleSync} -
+
@@ -23,9 +23,6 @@
-
diff --git a/dashboard-ui/thirdparty/cordova/android/mediasession.js b/dashboard-ui/thirdparty/cordova/android/mediasession.js new file mode 100644 index 0000000000..acc356d30f --- /dev/null +++ b/dashboard-ui/thirdparty/cordova/android/mediasession.js @@ -0,0 +1,148 @@ +(function () { + + // Reports media playback to the device for lock screen control + + var currentPlayer; + var lastPlayerState; + + function updatePlayerState(state, eventName) { + + if (!state.NowPlayingItem) { + hideMediaControls(); + return; + } + + // dummy this up + if (eventName == 'init') { + eventName = 'positionchange'; + } + + lastPlayerState = state; + + var playState = state.PlayState || {}; + + var nameHtml = MediaController.getNowPlayingNameHtml(state.NowPlayingItem) || ''; + var parts = nameHtml.split('
'); + + var artist = parts.length == 1 ? '' : parts[0]; + var title = parts[parts.length - 1]; + var album = state.NowPlayingItem.Album || ''; + var duration = state.NowPlayingItem.RunTimeTicks ? (state.NowPlayingItem.RunTimeTicks / 10000000) : 0; + var position = playState.PositionTicks ? (playState.PositionTicks / 10000000) : 0; + + var isPaused = playState.IsPaused || false; + var canSeek = playState.CanSeek || false; + + var url = ''; + var imgHeight = 200; + + var nowPlayingItem = state.NowPlayingItem; + + if (nowPlayingItem.PrimaryImageTag) { + + url = ApiClient.getScaledImageUrl(nowPlayingItem.PrimaryImageItemId, { + type: "Primary", + height: imgHeight, + tag: nowPlayingItem.PrimaryImageTag + }); + } else if (nowPlayingItem.ThumbImageTag) { + + url = ApiClient.getScaledImageUrl(nowPlayingItem.ThumbImageItemId, { + type: "Thumb", + height: imgHeight, + tag: nowPlayingItem.ThumbImageTag + }); + } + else if (nowPlayingItem.BackdropImageTag) { + + url = ApiClient.getScaledImageUrl(nowPlayingItem.BackdropItemId, { + type: "Backdrop", + height: imgHeight, + tag: nowPlayingItem.BackdropImageTag, + index: 0 + }); + + } + + MainActivity.updateMediaSession(eventName, title, artist, album, parseInt(duration), parseInt(position), url, canSeek, isPaused); + } + + function onStateChanged(e, state) { + + updatePlayerState(state, e.type); + } + + function onPlaybackStart(e, state) { + + console.log('nowplaying event: ' + e.type); + + var player = this; + + player.beginPlayerUpdates(); + + onStateChanged.call(player, e, state); + } + + function onPlaybackStopped(e, state) { + + console.log('nowplaying event: ' + e.type); + var player = this; + + player.endPlayerUpdates(); + + hideMediaControls(); + } + + function releaseCurrentPlayer() { + + if (currentPlayer) { + + $(currentPlayer).off('.cordovaremote'); + currentPlayer.endPlayerUpdates(); + currentPlayer = null; + + hideMediaControls(); + } + } + + function hideMediaControls() { + MainActivity.hideMediaSession(); + } + + function bindToPlayer(player) { + + releaseCurrentPlayer(); + + currentPlayer = player; + + console.log('binding remotecontrols to MediaPlayer'); + + player.getPlayerState().done(function (state) { + + if (state.NowPlayingItem) { + player.beginPlayerUpdates(); + } + + onStateChanged.call(player, { type: 'init' }, state); + }); + + $(player).on('playbackstart.cordovaremote', onPlaybackStart) + .on('playbackstop.cordovaremote', onPlaybackStopped) + .on('playstatechange.cordovaremote', onStateChanged) + .on('positionchange.cordovaremote', onStateChanged); + } + + Dashboard.ready(function () { + + console.log('binding remotecontrols to MediaController'); + + $(MediaController).on('playerchange', function () { + + bindToPlayer(MediaController.getCurrentPlayer()); + }); + + bindToPlayer(MediaController.getCurrentPlayer()); + + }); + +})(); \ No newline at end of file diff --git a/dashboard-ui/thirdparty/cordova/chromecast.js b/dashboard-ui/thirdparty/cordova/chromecast.js index 2c4e02387c..e266e8bd20 100644 --- a/dashboard-ui/thirdparty/cordova/chromecast.js +++ b/dashboard-ui/thirdparty/cordova/chromecast.js @@ -371,12 +371,18 @@ self.volumeDown = function () { - self.setVolume(getCurrentVolume() - 2); + sendMessageToDevice({ + options: {}, + command: 'VolumeDown' + }); }; self.volumeUp = function () { - self.setVolume(getCurrentVolume() + 2); + sendMessageToDevice({ + options: {}, + command: 'VolumeUp' + }); }; self.setVolume = function (vol) { diff --git a/dashboard-ui/userprofiles.html b/dashboard-ui/userprofiles.html index f97e9f05a0..335aa25bf0 100644 --- a/dashboard-ui/userprofiles.html +++ b/dashboard-ui/userprofiles.html @@ -4,7 +4,7 @@ ${TitleUsers} -
+
@@ -84,9 +84,6 @@
-
diff --git a/dashboard-ui/wizardlibrary.html b/dashboard-ui/wizardlibrary.html index 9f71779fa5..60039dbbcb 100644 --- a/dashboard-ui/wizardlibrary.html +++ b/dashboard-ui/wizardlibrary.html @@ -4,7 +4,7 @@ Emby -
+