@ -24,20 +24,45 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html
//helptour
//helptour
return [ function ( ) {
return [ function ( ) {
var controller = [ '$scope' , '$timeout' , '$modal' , 'userSettingsData' , function ( $scope , $timeout , $modal , userSettingsData ) {
var controller = [ '$scope' , '$timeout' , '$modal' , 'userSettingsData' , '$q' , function ( $scope , $timeout , $modal , userSettingsData , $q ) {
var displayTime = 5 00;
var displayTime = 20 00;
var shown = localStorage . getItem ( 'mediastream-helptour' ) ;
var shown = localStorage . getItem ( 'mediastream-helptour' ) ;
var doStep = function ( i , elem ) {
var timeoutAutoStepsIn = [ ] ;
$timeout ( function ( ) {
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' ) ;
$ ( elem ) . addClass ( 'in' ) ;
$scope . currentIndex = i ;
} ;
var autoStep = function ( i , elem ) {
timeoutAutoStepsIn [ i ] = $timeout ( function ( ) {
inStep ( i , elem ) ;
} , displayTime * i , true ) ;
} , displayTime * i , true ) ;
$timeout ( function ( ) {
timeoutAutoStepsOut [ i ] = $timeout ( function ( ) {
$ ( elem ) . removeClass ( 'in' ) ;
outStep ( i , elem ) ;
} , displayTime * ( i + 1 ) , true ) ;
} , displayTime * ( i + 1 ) , true ) ;
} ;
} ;
var startTour = function ( ) {
var autoTour = function ( start ) {
start = start ? start - 1 : 0 ;
$scope . steps . each ( function ( i , x ) {
$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 ( ) {
var introTour = function ( ) {
@ -45,7 +70,7 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html
var controller = [ '$scope' , '$modalInstance' , function ( scope , $modalInstance ) {
var controller = [ '$scope' , '$modalInstance' , function ( scope , $modalInstance ) {
scope . goTour = function ( ) {
scope . goTour = function ( ) {
$modalInstance . dismiss ( ) ;
$modalInstance . dismiss ( ) ;
start Tour( ) ;
auto Tour( ) ;
} ;
} ;
} ] ;
} ] ;
$modal . open ( {
$modal . open ( {
@ -58,15 +83,43 @@ define(['jquery', 'text!partials/helpoverlay.html', 'text!partials/helptour.html
introTour ( ) ;
introTour ( ) ;
localStorage . setItem ( 'mediastream-helptour' , true ) ;
localStorage . setItem ( 'mediastream-helptour' , true ) ;
}
}
$scope . $on ( 'showHelpTour' , function ( current , last ) {
$scope . tourPaused = false ;
if ( current ) {
$scope . currentIndex = null ;
introTour ( ) ;
$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 ) {
var link = function ( $scope , $elem , $attrs ) {
$scope . steps = $elem . find ( '.popover' ) ;
$scope . steps = $elem . find ( '.tourSteps . popover' ) ;
} ;
} ;
return {
return {