|
1 | 1 | /**
|
2 |
| - * Intro.js v0.5.0 |
| 2 | + * Intro.js v0.6.0 |
3 | 3 | * https://github.com/usablica/intro.js
|
4 | 4 | * MIT licensed
|
5 | 5 | *
|
|
19 | 19 | }
|
20 | 20 | } (this, function (exports) {
|
21 | 21 | //Default config/variables
|
22 |
| - var VERSION = '0.5.0'; |
| 22 | + var VERSION = '0.6.0'; |
23 | 23 |
|
24 | 24 | /**
|
25 | 25 | * IntroJs main class
|
|
113 | 113 |
|
114 | 114 | if (currentElement.getAttribute('data-step') == null) {
|
115 | 115 |
|
116 |
| - while(true) { |
| 116 | + while (true) { |
117 | 117 | if (typeof introItems[nextStep] == 'undefined') {
|
118 | 118 | break;
|
119 | 119 | } else {
|
|
148 | 148 | //then, start the show
|
149 | 149 | _nextStep.call(self);
|
150 | 150 |
|
151 |
| - var skipButton = targetElm.querySelector('.introjs-skipbutton'), |
| 151 | + var skipButton = targetElm.querySelector('.introjs-skipbutton'), |
152 | 152 | nextStepButton = targetElm.querySelector('.introjs-nextbutton');
|
153 | 153 |
|
154 | 154 | self._onKeyDown = function(e) {
|
|
179 | 179 | };
|
180 | 180 |
|
181 | 181 | if (window.addEventListener) {
|
182 |
| - if(this._options.keyboardNavigation) { |
| 182 | + if (this._options.keyboardNavigation) { |
183 | 183 | window.addEventListener('keydown', self._onKeyDown, true);
|
184 | 184 | }
|
185 | 185 | //for window resize
|
186 | 186 | window.addEventListener("resize", self._onResize, true);
|
187 | 187 | } else if (document.attachEvent) { //IE
|
188 |
| - if(this._options.keyboardNavigation) { |
| 188 | + if (this._options.keyboardNavigation) { |
189 | 189 | document.attachEvent('onkeydown', self._onKeyDown);
|
190 | 190 | }
|
191 | 191 | //for window resize
|
|
204 | 204 | function _goToStep(step) {
|
205 | 205 | //because steps starts with zero
|
206 | 206 | this._currentStep = step - 2;
|
207 |
| - if(typeof (this._introItems) !== 'undefined') { |
| 207 | + if (typeof (this._introItems) !== 'undefined') { |
208 | 208 | _nextStep.call(this);
|
209 | 209 | }
|
210 | 210 | }
|
|
321 | 321 | tooltipLayer.style.left = null;
|
322 | 322 |
|
323 | 323 | //prevent error when `this._currentStep` is undefined
|
324 |
| - if(!this._introItems[this._currentStep]) return; |
| 324 | + if (!this._introItems[this._currentStep]) return; |
325 | 325 |
|
326 | 326 | var tooltipCssClass = '';
|
327 | 327 |
|
|
371 | 371 | * @param {Object} helperLayer
|
372 | 372 | */
|
373 | 373 | function _setHelperLayerPosition(helperLayer) {
|
374 |
| - if(helperLayer) { |
| 374 | + if (helperLayer) { |
375 | 375 | //prevent error when `this._currentStep` in undefined
|
376 |
| - if(!this._introItems[this._currentStep]) return; |
| 376 | + if (!this._introItems[this._currentStep]) return; |
377 | 377 |
|
378 | 378 | var elementPosition = _getOffset(this._introItems[this._currentStep].element);
|
379 | 379 | //set new position to helper layer
|
|
401 | 401 | oldHelperLayer = document.querySelector('.introjs-helperLayer'),
|
402 | 402 | elementPosition = _getOffset(targetElement.element);
|
403 | 403 |
|
404 |
| - if(oldHelperLayer != null) { |
| 404 | + if (oldHelperLayer != null) { |
405 | 405 | var oldHelperNumberLayer = oldHelperLayer.querySelector('.introjs-helperNumberLayer'),
|
406 | 406 | oldtooltipLayer = oldHelperLayer.querySelector('.introjs-tooltiptext'),
|
407 | 407 | oldArrowLayer = oldHelperLayer.querySelector('.introjs-arrow'),
|
|
433 | 433 | }
|
434 | 434 | self._lastShowElementTimer = setTimeout(function() {
|
435 | 435 | //set current step to the label
|
436 |
| - if(oldHelperNumberLayer != null) { |
| 436 | + if (oldHelperNumberLayer != null) { |
437 | 437 | oldHelperNumberLayer.innerHTML = targetElement.step;
|
438 | 438 | }
|
439 | 439 | //set current tooltip text
|
|
477 | 477 | var nextTooltipButton = document.createElement('a');
|
478 | 478 |
|
479 | 479 | nextTooltipButton.onclick = function() {
|
480 |
| - if(self._introItems.length - 1 != self._currentStep) { |
| 480 | + if (self._introItems.length - 1 != self._currentStep) { |
481 | 481 | _nextStep.call(self);
|
482 | 482 | }
|
483 | 483 | };
|
|
489 | 489 | var prevTooltipButton = document.createElement('a');
|
490 | 490 |
|
491 | 491 | prevTooltipButton.onclick = function() {
|
492 |
| - if(self._currentStep != 0) { |
| 492 | + if (self._currentStep != 0) { |
493 | 493 | _previousStep.call(self);
|
494 | 494 | }
|
495 | 495 | };
|
|
556 | 556 | }
|
557 | 557 |
|
558 | 558 | var parentElm = targetElement.element.parentNode;
|
559 |
| - while(parentElm != null) { |
560 |
| - if(parentElm.tagName.toLowerCase() === 'body') break; |
| 559 | + while (parentElm != null) { |
| 560 | + if (parentElm.tagName.toLowerCase() === 'body') break; |
561 | 561 |
|
562 | 562 | var zIndex = _getPropValue(parentElm, 'z-index');
|
563 |
| - if(/[0-9]+/.test(zIndex)) { |
| 563 | + if (/[0-9]+/.test(zIndex)) { |
564 | 564 | parentElm.className += ' introjs-fixParent';
|
565 | 565 | }
|
566 | 566 | parentElm = parentElm.parentNode;
|
|
667 | 667 | } else {
|
668 | 668 | //set overlay layer position
|
669 | 669 | var elementPosition = _getOffset(targetElm);
|
670 |
| - if(elementPosition) { |
| 670 | + if (elementPosition) { |
671 | 671 | styleText += 'width: ' + elementPosition.width + 'px; height:' + elementPosition.height + 'px; top:' + elementPosition.top + 'px;left: ' + elementPosition.left + 'px;';
|
672 | 672 | overlayLayer.setAttribute('style', styleText);
|
673 | 673 | }
|
|
714 | 714 | //calculate element top and left
|
715 | 715 | var _x = 0;
|
716 | 716 | var _y = 0;
|
717 |
| - while(element && !isNaN(element.offsetLeft) && !isNaN(element.offsetTop)) { |
| 717 | + while (element && !isNaN(element.offsetLeft) && !isNaN(element.offsetTop)) { |
718 | 718 | _x += element.offsetLeft;
|
719 | 719 | _y += element.offsetTop;
|
720 | 720 | element = element.offsetParent;
|
|
0 commit comments