diff --git a/src/styles/components/helptour.scss b/src/styles/components/helptour.scss index c784352d..03202721 100644 --- a/src/styles/components/helptour.scss +++ b/src/styles/components/helptour.scss @@ -23,11 +23,17 @@ } .helptour { + .tourControl { + top: initial; + bottom: 10px; + left: 10px; + max-width: none; + } .in { display: block; } .popover { - opacity: 0.85; + opacity: 0.95; } .meetingRoom { top: 84px; diff --git a/static/js/directives/helptour.js b/static/js/directives/helptour.js index 2c72647d..04f7df15 100644 --- a/static/js/directives/helptour.js +++ b/static/js/directives/helptour.js @@ -24,20 +24,45 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html //helptour return [function() { - var controller = ['$scope', '$timeout', '$modal', 'userSettingsData', function($scope, $timeout, $modal, userSettingsData) { - var displayTime = 500; + var controller = ['$scope', '$timeout', '$modal', 'userSettingsData', '$q', function($scope, $timeout, $modal, userSettingsData, $q) { + var displayTime = 2000; var shown = localStorage.getItem('mediastream-helptour'); - var doStep = function(i, elem) { - $timeout(function() { - $(elem).addClass('in'); + var timeoutAutoStepsIn = []; + var timeoutAutoStepsOut = []; + var reset = function() { + $scope.toAutourPaused = false; + $($scope.steps[$scope.currentIndex]).removeClass('in'); + $scope.currentIndex = null; + }; + var outStep = function(i, elem) { + $(elem).removeClass('in'); + }; + var inStep = function(i, elem) { + $(elem).addClass('in'); + $scope.currentIndex = i; + }; + var autoStep = function(i, elem) { + timeoutAutoStepsIn[i] = $timeout(function() { + inStep(i, elem); }, displayTime * i, true); - $timeout(function() { - $(elem).removeClass('in'); + timeoutAutoStepsOut[i] = $timeout(function() { + outStep(i, elem); }, displayTime * (i + 1), true); }; - var startTour = function() { + var autoTour = function(start) { + start = start ? start - 1 : 0; $scope.steps.each(function(i, x) { - doStep(i, x); + if(i >= start) { + autoStep(i, x); + } + }); + }; + var manualTour = function() { + timeoutAutoStepsIn.forEach(function(promise) { + $timeout.cancel(promise); + }); + timeoutAutoStepsOut.forEach(function(promise) { + $timeout.cancel(promise); }); }; var introTour = function() { @@ -45,7 +70,7 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html var controller = ['$scope', '$modalInstance', function(scope, $modalInstance) { scope.goTour = function() { $modalInstance.dismiss(); - startTour(); + autoTour(); }; }]; $modal.open({ @@ -58,15 +83,43 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html introTour(); localStorage.setItem('mediastream-helptour', true); } - $scope.$on('showHelpTour', function(current, last) { - if(current) { - introTour(); + $scope.tourPaused = false; + $scope.currentIndex = null; + $scope.stepBeginning = function() { + outStep($scope.currentIndex, $scope.steps[$scope.currentIndex]); + inStep(0, $scope.steps[0]); + }; + $scope.stepBackward = function() { + outStep($scope.currentIndex, $scope.steps[$scope.currentIndex]); + inStep($scope.currentIndex - 1, $scope.steps[$scope.currentIndex - 1]); + }; + $scope.stepForward = function() { + outStep($scope.currentIndex, $scope.steps[$scope.currentIndex]); + inStep($scope.currentIndex + 1, $scope.steps[$scope.currentIndex + 1]); + }; + $scope.stepEnd = function() { + outStep($scope.currentIndex, $scope.steps[$scope.currentIndex]); + inStep($scope.steps.length - 1, $scope.steps[$scope.steps.length - 1]); + }; + $scope.togglePause = function() { + $scope.tourPaused = !$scope.tourPaused; + if ($scope.tourPaused) { + manualTour(); + } else { + autoTour($scope.currentIndex); } + }; + $scope.exitTour = function() { + manualTour(); + reset(); + }; + $scope.$on('showHelpTour', function() { + introTour(); }); }]; var link = function($scope, $elem, $attrs) { - $scope.steps = $elem.find('.popover'); + $scope.steps = $elem.find('.tourSteps .popover'); }; return { diff --git a/static/partials/helpoverlay.html b/static/partials/helpoverlay.html index 70c0fcef..170e9609 100644 --- a/static/partials/helpoverlay.html +++ b/static/partials/helpoverlay.html @@ -1,10 +1,27 @@
{{_('Congratulations! Anonymous secure peer to peer chat and video calls are a short click away. Quickly get started with the features tour below.')}}
+{{_('Congratulations! Anonymous secure peer to peer chat and video calls are a short click away. Quickly get started with the features tour below. The tour can be accessed again under settings.')}}