|
83 | 83 |
|
84 | 84 | if (this._options.steps) {
|
85 | 85 | //use steps passed programmatically
|
86 |
| - var allIntroSteps = []; |
87 |
| - |
88 | 86 | for (var i = 0, stepsLength = this._options.steps.length; i < stepsLength; i++) {
|
89 | 87 | var currentItem = _cloneObject(this._options.steps[i]);
|
90 | 88 | //set the step
|
|
258 | 256 | */
|
259 | 257 | function _cloneObject(object) {
|
260 | 258 | if (object == null || typeof (object) != 'object' || typeof (object.nodeType) != 'undefined') {
|
261 |
| - return object; |
| 259 | + return object; |
262 | 260 | }
|
263 | 261 | var temp = {};
|
264 | 262 | for (var key in object) {
|
265 |
| - temp[key] = _cloneObject(object[key]); |
| 263 | + temp[key] = _cloneObject(object[key]); |
266 | 264 | }
|
267 | 265 | return temp;
|
268 | 266 | }
|
|
367 | 365 | var referenceLayer = targetElement.querySelector('.introjs-tooltipReferenceLayer');
|
368 | 366 | if (referenceLayer) {
|
369 | 367 | referenceLayer.parentNode.removeChild(referenceLayer);
|
370 |
| - } |
| 368 | + } |
371 | 369 | //remove disableInteractionLayer
|
372 | 370 | var disableInteractionLayer = targetElement.querySelector('.introjs-disableInteraction');
|
373 | 371 | if (disableInteractionLayer) {
|
|
391 | 389 | if (fixParents && fixParents.length > 0) {
|
392 | 390 | for (var i = fixParents.length - 1; i >= 0; i--) {
|
393 | 391 | fixParents[i].className = fixParents[i].className.replace(/introjs-fixParent/g, '').replace(/^\s+|\s+$/g, '');
|
394 |
| - }; |
| 392 | + } |
395 | 393 | }
|
396 | 394 |
|
397 | 395 | //clean listeners
|
|
454 | 452 | currentTooltipPosition = this._introItems[this._currentStep].position;
|
455 | 453 | if ((currentTooltipPosition == "auto" || this._options.tooltipPosition == "auto")) {
|
456 | 454 | if (currentTooltipPosition != "floating") { // Floating is always valid, no point in calculating
|
457 |
| - currentTooltipPosition = _determineAutoPosition.call(this, targetElement, tooltipLayer, currentTooltipPosition) |
| 455 | + currentTooltipPosition = _determineAutoPosition.call(this, targetElement, tooltipLayer, currentTooltipPosition); |
458 | 456 | }
|
459 | 457 | }
|
460 |
| - var targetOffset = _getOffset(targetElement) |
461 |
| - var tooltipHeight = _getOffset(tooltipLayer).height |
462 |
| - var windowSize = _getWinSize() |
| 458 | + |
| 459 | + var targetOffset = _getOffset(targetElement); |
| 460 | + var tooltipHeight = _getOffset(tooltipLayer).height; |
| 461 | + var windowSize = _getWinSize(); |
| 462 | + |
463 | 463 | switch (currentTooltipPosition) {
|
464 | 464 | case 'top':
|
465 | 465 | tooltipLayer.style.left = '15px';
|
|
472 | 472 | // In this case, right would have fallen below the bottom of the screen.
|
473 | 473 | // Modify so that the bottom of the tooltip connects with the target
|
474 | 474 | arrowLayer.className = "introjs-arrow left-bottom";
|
475 |
| - tooltipLayer.style.top = "-" + (tooltipHeight - targetOffset.height - 20) + "px" |
| 475 | + tooltipLayer.style.top = "-" + (tooltipHeight - targetOffset.height - 20) + "px"; |
476 | 476 | }
|
477 | 477 | arrowLayer.className = 'introjs-arrow left';
|
478 | 478 | break;
|
|
484 | 484 | if (targetOffset.top + tooltipHeight > windowSize.height) {
|
485 | 485 | // In this case, left would have fallen below the bottom of the screen.
|
486 | 486 | // Modify so that the bottom of the tooltip connects with the target
|
487 |
| - tooltipLayer.style.top = "-" + (tooltipHeight - targetOffset.height - 20) + "px" |
| 487 | + tooltipLayer.style.top = "-" + (tooltipHeight - targetOffset.height - 20) + "px"; |
488 | 488 | arrowLayer.className = 'introjs-arrow right-bottom';
|
489 | 489 | } else {
|
490 | 490 | arrowLayer.className = 'introjs-arrow right';
|
491 | 491 | }
|
492 | 492 | tooltipLayer.style.right = (targetOffset.width + 20) + 'px';
|
493 | 493 |
|
494 |
| - |
495 | 494 | break;
|
496 | 495 | case 'floating':
|
497 | 496 | arrowLayer.style.display = 'none';
|
|
548 | 547 | function _determineAutoPosition(targetElement, tooltipLayer, desiredTooltipPosition) {
|
549 | 548 |
|
550 | 549 | // Take a clone of position precedence. These will be the available
|
551 |
| - var possiblePositions = this._options.positionPrecedence.slice() |
| 550 | + var possiblePositions = this._options.positionPrecedence.slice(); |
552 | 551 |
|
553 |
| - var windowSize = _getWinSize() |
554 |
| - var tooltipHeight = _getOffset(tooltipLayer).height + 10 |
555 |
| - var tooltipWidth = _getOffset(tooltipLayer).width + 20 |
556 |
| - var targetOffset = _getOffset(targetElement) |
| 552 | + var windowSize = _getWinSize(); |
| 553 | + var tooltipHeight = _getOffset(tooltipLayer).height + 10; |
| 554 | + var tooltipWidth = _getOffset(tooltipLayer).width + 20; |
| 555 | + var targetOffset = _getOffset(targetElement); |
557 | 556 |
|
558 | 557 | // If we check all the possible areas, and there are no valid places for the tooltip, the element
|
559 | 558 | // must take up most of the screen real estate. Show the tooltip floating in the middle of the screen.
|
560 |
| - var calculatedPosition = "floating" |
| 559 | + var calculatedPosition = "floating"; |
561 | 560 |
|
562 | 561 | // Check if the width of the tooltip + the starting point would spill off the right side of the screen
|
563 | 562 | // If no, neither bottom or top are valid
|
564 | 563 | if (targetOffset.left + tooltipWidth > windowSize.width || ((targetOffset.left + (targetOffset.width / 2)) - tooltipWidth) < 0) {
|
565 |
| - _removeEntry(possiblePositions, "bottom") |
| 564 | + _removeEntry(possiblePositions, "bottom"); |
566 | 565 | _removeEntry(possiblePositions, "top");
|
567 | 566 | } else {
|
568 | 567 | // Check for space below
|
569 | 568 | if ((targetOffset.height + targetOffset.top + tooltipHeight) > windowSize.height) {
|
570 |
| - _removeEntry(possiblePositions, "bottom") |
| 569 | + _removeEntry(possiblePositions, "bottom"); |
571 | 570 | }
|
572 | 571 |
|
573 | 572 | // Check for space above
|
|
594 | 593 | // If the requested position is in the list, replace our calculated choice with that
|
595 | 594 | if (desiredTooltipPosition && desiredTooltipPosition != "auto") {
|
596 | 595 | if (possiblePositions.indexOf(desiredTooltipPosition) > -1) {
|
597 |
| - calculatedPosition = desiredTooltipPosition |
| 596 | + calculatedPosition = desiredTooltipPosition; |
598 | 597 | }
|
599 | 598 | }
|
600 | 599 |
|
601 |
| - return calculatedPosition |
| 600 | + return calculatedPosition; |
602 | 601 | }
|
603 | 602 |
|
604 | 603 | /**
|
|
793 | 792 | bulletsLayer.style.display = 'none';
|
794 | 793 | }
|
795 | 794 |
|
796 |
| - |
797 | 795 | var ulContainer = document.createElement('ul');
|
798 | 796 |
|
799 | 797 | for (var i = 0, stepsLength = this._introItems.length; i < stepsLength; i++) {
|
|
0 commit comments