|
|
@@ -78,51 +78,51 @@ define(['angular'], function (angular) {
|
|
|
* </li>
|
|
|
* </ul>
|
|
|
*/
|
|
|
- // angular.module('ui.tour', [])
|
|
|
- //
|
|
|
- // .directive('uiTour', ['$timeout', '$parse', function ($timeout, $parse) {
|
|
|
- // return {
|
|
|
- // link: function ($scope, $element, $attributes) {
|
|
|
- // var model = $parse($attributes.uiTour);
|
|
|
- //
|
|
|
- // // Watch model and change steps
|
|
|
- // $scope.$watch($attributes.uiTour, function (newVal, oldVal) {
|
|
|
- // if (angular.isNumber(newVal)) {
|
|
|
- // showStep(newVal)
|
|
|
- // } else {
|
|
|
- // if (angular.isString(newVal)) {
|
|
|
- // var stepNumber = 0,
|
|
|
- // children = $element.children()
|
|
|
- // angular.forEach(children, function (step, index) {
|
|
|
- // if (angular.element(step).attr('name') === newVal)
|
|
|
- // stepNumber = index + 1;
|
|
|
- // });
|
|
|
- // model.assign($scope, stepNumber);
|
|
|
- // } else {
|
|
|
- // model.assign($scope, newVal && 1 || 0);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- //
|
|
|
- // // Show step
|
|
|
- // function showStep(stepNumber) {
|
|
|
- // var elm, at, children = $element.children().removeClass('active');
|
|
|
- // elm = children.eq(stepNumber - 1);
|
|
|
- // if (stepNumber) {
|
|
|
- // at = elm.attr('at');
|
|
|
- // $timeout(function () {
|
|
|
- // var target = angular.element(elm.attr('target'))[0];
|
|
|
- // if (elm.attr('overlay') !== undefined) {
|
|
|
- // $('.tour-overlay').addClass('active').css({}).addClass('in');
|
|
|
- // }
|
|
|
- // elm.addClass('active');
|
|
|
- // });
|
|
|
- // } else {
|
|
|
- // $('.tour-overlay').removeClass('in');
|
|
|
- // $('.tour-overlay').removeClass('active');
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // };
|
|
|
- // }]);
|
|
|
+ angular.module('ui.tour', [])
|
|
|
+
|
|
|
+ .directive('uiTour', ['$timeout', '$parse', function ($timeout, $parse) {
|
|
|
+ return {
|
|
|
+ link: function ($scope, $element, $attributes) {
|
|
|
+ var model = $parse($attributes.uiTour);
|
|
|
+
|
|
|
+ // Watch model and change steps
|
|
|
+ $scope.$watch($attributes.uiTour, function (newVal, oldVal) {
|
|
|
+ if (angular.isNumber(newVal)) {
|
|
|
+ showStep(newVal)
|
|
|
+ } else {
|
|
|
+ if (angular.isString(newVal)) {
|
|
|
+ var stepNumber = 0,
|
|
|
+ children = $element.children()
|
|
|
+ angular.forEach(children, function (step, index) {
|
|
|
+ if (angular.element(step).attr('name') === newVal)
|
|
|
+ stepNumber = index + 1;
|
|
|
+ });
|
|
|
+ model.assign($scope, stepNumber);
|
|
|
+ } else {
|
|
|
+ model.assign($scope, newVal && 1 || 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // Show step
|
|
|
+ function showStep(stepNumber) {
|
|
|
+ var elm, at, children = $element.children().removeClass('active');
|
|
|
+ elm = children.eq(stepNumber - 1);
|
|
|
+ if (stepNumber) {
|
|
|
+ at = elm.attr('at');
|
|
|
+ $timeout(function () {
|
|
|
+ var target = angular.element(elm.attr('target'))[0];
|
|
|
+ if (elm.attr('overlay') !== undefined) {
|
|
|
+ $('.tour-overlay').addClass('active').css({}).addClass('in');
|
|
|
+ }
|
|
|
+ elm.addClass('active');
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $('.tour-overlay').removeClass('in');
|
|
|
+ $('.tour-overlay').removeClass('active');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }]);
|
|
|
});
|