diff --git a/dashboard-ui/css/images/tour/dashboard/chapters.png b/dashboard-ui/css/images/tour/dashboard/chapters.png new file mode 100644 index 000000000..f833bd955 Binary files /dev/null and b/dashboard-ui/css/images/tour/dashboard/chapters.png differ diff --git a/dashboard-ui/css/images/tour/dashboard/cinemamode.png b/dashboard-ui/css/images/tour/dashboard/cinemamode.png new file mode 100644 index 000000000..c2eed1dbf Binary files /dev/null and b/dashboard-ui/css/images/tour/dashboard/cinemamode.png differ diff --git a/dashboard-ui/css/images/tour/dashboard/dashboard.png b/dashboard-ui/css/images/tour/dashboard/dashboard.png new file mode 100644 index 000000000..79828727b Binary files /dev/null and b/dashboard-ui/css/images/tour/dashboard/dashboard.png differ diff --git a/dashboard-ui/css/images/tour/dashboard/notifications.png b/dashboard-ui/css/images/tour/dashboard/notifications.png new file mode 100644 index 000000000..4c1b40698 Binary files /dev/null and b/dashboard-ui/css/images/tour/dashboard/notifications.png differ diff --git a/dashboard-ui/css/images/tour/dashboard/plugins.png b/dashboard-ui/css/images/tour/dashboard/plugins.png new file mode 100644 index 000000000..f72b725a2 Binary files /dev/null and b/dashboard-ui/css/images/tour/dashboard/plugins.png differ diff --git a/dashboard-ui/css/images/tour/dashboard/scheduledtasks.png b/dashboard-ui/css/images/tour/dashboard/scheduledtasks.png new file mode 100644 index 000000000..b6a9da63f Binary files /dev/null and b/dashboard-ui/css/images/tour/dashboard/scheduledtasks.png differ diff --git a/dashboard-ui/css/images/tour/dashboard/subtitles.png b/dashboard-ui/css/images/tour/dashboard/subtitles.png new file mode 100644 index 000000000..fad5557cb Binary files /dev/null and b/dashboard-ui/css/images/tour/dashboard/subtitles.png differ diff --git a/dashboard-ui/css/images/tour/dashboard/users.png b/dashboard-ui/css/images/tour/dashboard/users.png new file mode 100644 index 000000000..814bca1f3 Binary files /dev/null and b/dashboard-ui/css/images/tour/dashboard/users.png differ diff --git a/dashboard-ui/dashboard.html b/dashboard-ui/dashboard.html index 8a07f5bc9..7cfa54138 100644 --- a/dashboard-ui/dashboard.html +++ b/dashboard-ui/dashboard.html @@ -16,6 +16,13 @@
+ +
diff --git a/dashboard-ui/index.html b/dashboard-ui/index.html index 0a57ab304..2df73c191 100644 --- a/dashboard-ui/index.html +++ b/dashboard-ui/index.html @@ -19,7 +19,7 @@ diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index ea2262e51..f33623e59 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -1069,10 +1069,7 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow) var color = entry.Severity == 'Error' || entry.Severity == 'Fatal' || entry.Severity == 'Warn' ? '#cc0000' : 'green'; - html += '
' + date.toLocaleDateString() + ' ' + date.toLocaleTimeString().toLowerCase() + '
'; - - html += '
'; - + html += '
'; if (entry.UserId && entry.UserPrimaryImageTag) { var userImgUrl = ApiClient.getUserImageUrl(entry.UserId, { @@ -1083,6 +1080,10 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow) html += ''; } + html += date.toLocaleDateString() + ' ' + date.toLocaleTimeString().toLowerCase(); + html += '
'; + + html += '
'; html += entry.Name; html += '
'; @@ -1204,7 +1205,7 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow) } function startListening() { - + if (ApiClient.isWebSocketOpen()) { ApiClient.sendWebSocketMessage("ActivityLogEntryStart", "0,1500"); } @@ -1241,4 +1242,75 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow) return this; }; +})(jQuery, document, window); + +(function ($, document, window) { + + var welcomeDismissValue = '6'; + var welcomeTourKey = 'welcomeTour'; + + function dismissWelcome(page, userId) { + + ApiClient.getDisplayPreferences('dashboard', userId, 'dashboard').done(function (result) { + + result.CustomPrefs[welcomeTourKey] = welcomeDismissValue; + ApiClient.updateDisplayPreferences('dashboard', result, userId, 'dashboard'); + + $(page).off('pagebeforeshow.checktour'); + }); + } + + function showWelcomeIfNeeded(page) { + + var userId = Dashboard.getCurrentUserId(); + + ApiClient.getDisplayPreferences('dashboard', userId, 'dashboard').done(function (result) { + + if (result.CustomPrefs[welcomeTourKey] == welcomeDismissValue) { + $('.welcomeMessage', page).hide(); + } else { + $('.welcomeMessage', page).show(); + } + }); + } + + function takeTour(page, userId) { + + $.swipebox([ + { href: 'css/images/tour/dashboard/dashboard.png', title: Globalize.translate('DashboardTourDashboard') }, + { href: 'css/images/tour/dashboard/users.png', title: Globalize.translate('DashboardTourUsers') }, + { href: 'css/images/tour/dashboard/cinemamode.png', title: Globalize.translate('DashboardTourCinemaMode') }, + { href: 'css/images/tour/dashboard/chapters.png', title: Globalize.translate('DashboardTourChapters') }, + { href: 'css/images/tour/dashboard/subtitles.png', title: Globalize.translate('DashboardTourSubtitles') }, + { href: 'css/images/tour/dashboard/plugins.png', title: Globalize.translate('DashboardTourPlugins') }, + { href: 'css/images/tour/dashboard/notifications.png', title: Globalize.translate('DashboardTourNotifications') }, + { href: 'css/images/tour/dashboard/scheduledtasks.png', title: Globalize.translate('DashboardTourScheduledTasks') }, + { href: 'css/images/tour/enjoy.jpg', title: Globalize.translate('MessageEnjoyYourStay') } + ], { + afterClose: function () { + dismissWelcome(page, userId); + $('.welcomeMessage', page).hide(); + }, + hideBarsDelay: 30000 + }); + } + + $(document).on('pageinit', "#dashboardPage", function () { + + var page = this; + + var userId = Dashboard.getCurrentUserId(); + + $('.btnTakeTour', page).on('click', function () { + takeTour(page, userId); + }); + + }).on('pagebeforeshow.checktour', "#dashboardPage", function () { + + var page = this; + + showWelcomeIfNeeded(page); + + }); + })(jQuery, document, window); \ No newline at end of file diff --git a/dashboard-ui/scripts/indexpage.js b/dashboard-ui/scripts/indexpage.js index 149ee4aae..d160cd4e9 100644 --- a/dashboard-ui/scripts/indexpage.js +++ b/dashboard-ui/scripts/indexpage.js @@ -536,6 +536,10 @@ }); } + function showWelcomeIfNeeded() { + + } + function takeTour(page, userId) { $.swipebox([ @@ -568,7 +572,7 @@ var userId = Dashboard.getCurrentUserId(); - $('.btnDismissWelcome', page).on('click', function () { + $('.btnTakeTour', page).on('click', function () { takeTour(page, userId); }); diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 25c355d41..7d4f70efa 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -591,6 +591,8 @@ getUserDataCssClass: function (key) { + if (!key) return ''; + return 'libraryItemUserData' + key.replace(new RegExp(' ', 'g'), ''); }, diff --git a/dashboard-ui/scripts/notifications.js b/dashboard-ui/scripts/notifications.js index 823c65d1a..4d42fc418 100644 --- a/dashboard-ui/scripts/notifications.js +++ b/dashboard-ui/scripts/notifications.js @@ -46,8 +46,6 @@ html += '
'; - html += ''; - html += '
'; html += '
'; @@ -58,30 +56,18 @@ $(this).off("panelclose").remove(); - }).on('click', '.btnMarkRead', function () { - - var ids = $('.unreadFlyoutNotification').map(function () { - - return this.getAttribute('data-notificationid'); - - }).get(); - - self.markNotificationsRead(ids, function () { - - $('.notificationsFlyout').panel("close"); - - }); - }); self.isFlyout = true; var startIndex = 0; - var limit = 5; + var limit = 4; var elem = $('.notificationsFlyoutlist'); - var markReadButton = $('.btnMarkReadContainer'); - refreshNotifications(startIndex, limit, elem, markReadButton, false); + refreshNotifications(startIndex, limit, elem, null, false).done(function() { + + self.markNotificationsRead([]); + }); }; self.markNotificationsRead = function (ids, callback) { @@ -92,7 +78,9 @@ self.updateNotificationCount(); - callback(); + if (callback) { + callback(); + } }); @@ -107,7 +95,7 @@ function refreshNotifications(startIndex, limit, elem, btn, showPaging) { - ApiClient.getNotifications(Dashboard.getCurrentUserId(), { StartIndex: startIndex, Limit: limit }).done(function (result) { + return ApiClient.getNotifications(Dashboard.getCurrentUserId(), { StartIndex: startIndex, Limit: limit }).done(function (result) { listUnreadNotifications(result.Notifications, result.TotalRecordCount, startIndex, limit, elem, btn, showPaging); @@ -118,20 +106,25 @@ if (!totalRecordCount) { elem.html('

' + Globalize.translate('LabelNoUnreadNotifications') + '

'); - btn.hide(); + + if (btn) { + btn.hide(); + } return; } Notifications.total = totalRecordCount; - if (list.filter(function (n) { + if (btn) { + if (list.filter(function (n) { - return !n.IsRead; + return !n.IsRead; - }).length) { - btn.show(); - } else { - btn.hide(); + }).length) { + btn.show(); + } else { + btn.hide(); + } } var html = ''; diff --git a/dashboard-ui/thirdparty/mediabrowser.apiclient.js b/dashboard-ui/thirdparty/mediabrowser.apiclient.js index 586b759d8..9dd9b1139 100644 --- a/dashboard-ui/thirdparty/mediabrowser.apiclient.js +++ b/dashboard-ui/thirdparty/mediabrowser.apiclient.js @@ -334,7 +334,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi throw new Error("null userId"); } - if (!idList || !idList.length) { + if (!idList) { throw new Error("null idList"); }