|
|
|
@ -30,29 +30,35 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html |
|
|
|
var timeoutAutoStepsIn = []; |
|
|
|
var timeoutAutoStepsIn = []; |
|
|
|
var timeoutAutoStepsOut = []; |
|
|
|
var timeoutAutoStepsOut = []; |
|
|
|
var reset = function() { |
|
|
|
var reset = function() { |
|
|
|
$scope.toAutourPaused = false; |
|
|
|
outStep(); |
|
|
|
$($scope.steps[$scope.currentIndex]).removeClass('in'); |
|
|
|
$scope.tourPaused = false; |
|
|
|
$scope.currentIndex = null; |
|
|
|
$scope.currentIndex = null; |
|
|
|
}; |
|
|
|
}; |
|
|
|
var outStep = function(i, elem) { |
|
|
|
var outStep = function() { |
|
|
|
$(elem).removeClass('in'); |
|
|
|
$($scope.steps[$scope.currentIndex]).removeClass('in'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
var inStep = function(i, elem) { |
|
|
|
var inStep = function(i, elem) { |
|
|
|
$(elem).addClass('in'); |
|
|
|
|
|
|
|
$scope.currentIndex = i; |
|
|
|
$scope.currentIndex = i; |
|
|
|
|
|
|
|
$($scope.steps[i]).addClass('in'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
var autoStep = function(i, elem) { |
|
|
|
var autoStep = function(i, elem) { |
|
|
|
timeoutAutoStepsIn[i] = $timeout(function() { |
|
|
|
timeoutAutoStepsIn[i] = $timeout(function() { |
|
|
|
inStep(i, elem); |
|
|
|
inStep(i); |
|
|
|
}, displayTime * i, true); |
|
|
|
}, displayTime * i, true); |
|
|
|
timeoutAutoStepsOut[i] = $timeout(function() { |
|
|
|
timeoutAutoStepsOut[i] = $timeout(function() { |
|
|
|
outStep(i, elem); |
|
|
|
outStep(i); |
|
|
|
|
|
|
|
if ($scope.steps.length === i + 1) { |
|
|
|
|
|
|
|
$scope.togglePause(); |
|
|
|
|
|
|
|
} |
|
|
|
}, displayTime * (i + 1), true); |
|
|
|
}, displayTime * (i + 1), true); |
|
|
|
}; |
|
|
|
}; |
|
|
|
var autoTour = function(start) { |
|
|
|
var autoTour = function(startIndex) { |
|
|
|
start = start ? start - 1 : 0; |
|
|
|
// start again from the beginning
|
|
|
|
|
|
|
|
if (startIndex === undefined || startIndex === $scope.steps.length - 1) { |
|
|
|
|
|
|
|
startIndex = 0; |
|
|
|
|
|
|
|
} |
|
|
|
$scope.steps.each(function(i, x) { |
|
|
|
$scope.steps.each(function(i, x) { |
|
|
|
if(i >= start) { |
|
|
|
if (i >= startIndex) { |
|
|
|
autoStep(i, x); |
|
|
|
autoStep(i, x); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -86,20 +92,32 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html |
|
|
|
$scope.tourPaused = false; |
|
|
|
$scope.tourPaused = false; |
|
|
|
$scope.currentIndex = null; |
|
|
|
$scope.currentIndex = null; |
|
|
|
$scope.stepBeginning = function() { |
|
|
|
$scope.stepBeginning = function() { |
|
|
|
outStep($scope.currentIndex, $scope.steps[$scope.currentIndex]); |
|
|
|
if (!$scope.tourPaused) { |
|
|
|
inStep(0, $scope.steps[0]); |
|
|
|
$scope.togglePause(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
outStep(); |
|
|
|
|
|
|
|
inStep(0); |
|
|
|
}; |
|
|
|
}; |
|
|
|
$scope.stepBackward = function() { |
|
|
|
$scope.stepBackward = function() { |
|
|
|
outStep($scope.currentIndex, $scope.steps[$scope.currentIndex]); |
|
|
|
if (!$scope.tourPaused) { |
|
|
|
inStep($scope.currentIndex - 1, $scope.steps[$scope.currentIndex - 1]); |
|
|
|
$scope.togglePause(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
outStep(); |
|
|
|
|
|
|
|
inStep($scope.currentIndex - 1); |
|
|
|
}; |
|
|
|
}; |
|
|
|
$scope.stepForward = function() { |
|
|
|
$scope.stepForward = function() { |
|
|
|
outStep($scope.currentIndex, $scope.steps[$scope.currentIndex]); |
|
|
|
if (!$scope.tourPaused) { |
|
|
|
inStep($scope.currentIndex + 1, $scope.steps[$scope.currentIndex + 1]); |
|
|
|
$scope.togglePause(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
outStep(); |
|
|
|
|
|
|
|
inStep($scope.currentIndex + 1); |
|
|
|
}; |
|
|
|
}; |
|
|
|
$scope.stepEnd = function() { |
|
|
|
$scope.stepEnd = function() { |
|
|
|
outStep($scope.currentIndex, $scope.steps[$scope.currentIndex]); |
|
|
|
if (!$scope.tourPaused) { |
|
|
|
inStep($scope.steps.length - 1, $scope.steps[$scope.steps.length - 1]); |
|
|
|
$scope.togglePause(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
outStep(); |
|
|
|
|
|
|
|
inStep($scope.steps.length - 1); |
|
|
|
}; |
|
|
|
}; |
|
|
|
$scope.togglePause = function() { |
|
|
|
$scope.togglePause = function() { |
|
|
|
$scope.tourPaused = !$scope.tourPaused; |
|
|
|
$scope.tourPaused = !$scope.tourPaused; |
|
|
|
@ -110,7 +128,9 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
$scope.exitTour = function() { |
|
|
|
$scope.exitTour = function() { |
|
|
|
manualTour(); |
|
|
|
if (!$scope.tourPaused) { |
|
|
|
|
|
|
|
manualTour(); |
|
|
|
|
|
|
|
} |
|
|
|
reset(); |
|
|
|
reset(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
$scope.$on('showHelpTour', function() { |
|
|
|
$scope.$on('showHelpTour', function() { |
|
|
|
|