Skip to content

Commit 32ec193

Browse files
committed
Merge branch 'master' of https://github.com/usablica/intro.js
2 parents e4bf592 + 96fd6ec commit 32ec193

File tree

2 files changed

+51
-50
lines changed

2 files changed

+51
-50
lines changed

intro.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@
8383

8484
if (this._options.steps) {
8585
//use steps passed programmatically
86-
var allIntroSteps = [];
87-
8886
for (var i = 0, stepsLength = this._options.steps.length; i < stepsLength; i++) {
8987
var currentItem = _cloneObject(this._options.steps[i]);
9088
//set the step
@@ -265,11 +263,15 @@
265263
*/
266264
function _cloneObject(object) {
267265
if (object == null || typeof (object) != 'object' || typeof (object.nodeType) != 'undefined') {
268-
return object;
266+
return object;
269267
}
270268
var temp = {};
271269
for (var key in object) {
270+
if (typeof (jQuery) != 'undefined' && object[key] instanceof jQuery) {
271+
temp[key] = object[key];
272+
} else {
272273
temp[key] = _cloneObject(object[key]);
274+
}
273275
}
274276
return temp;
275277
}
@@ -374,7 +376,7 @@
374376
var referenceLayer = targetElement.querySelector('.introjs-tooltipReferenceLayer');
375377
if (referenceLayer) {
376378
referenceLayer.parentNode.removeChild(referenceLayer);
377-
}
379+
}
378380
//remove disableInteractionLayer
379381
var disableInteractionLayer = targetElement.querySelector('.introjs-disableInteraction');
380382
if (disableInteractionLayer) {
@@ -398,7 +400,7 @@
398400
if (fixParents && fixParents.length > 0) {
399401
for (var i = fixParents.length - 1; i >= 0; i--) {
400402
fixParents[i].className = fixParents[i].className.replace(/introjs-fixParent/g, '').replace(/^\s+|\s+$/g, '');
401-
};
403+
}
402404
}
403405

404406
//clean listeners
@@ -461,7 +463,7 @@
461463
currentTooltipPosition = this._introItems[this._currentStep].position;
462464
if ((currentTooltipPosition == "auto" || this._options.tooltipPosition == "auto")) {
463465
if (currentTooltipPosition != "floating") { // Floating is always valid, no point in calculating
464-
currentTooltipPosition = _determineAutoPosition.call(this, targetElement, tooltipLayer, currentTooltipPosition)
466+
currentTooltipPosition = _determineAutoPosition.call(this, targetElement, tooltipLayer, currentTooltipPosition);
465467
}
466468
}
467469
targetOffset = _getOffset(targetElement);
@@ -481,7 +483,7 @@
481483
// In this case, right would have fallen below the bottom of the screen.
482484
// Modify so that the bottom of the tooltip connects with the target
483485
arrowLayer.className = "introjs-arrow left-bottom";
484-
tooltipLayer.style.top = "-" + (tooltipOffset.height - targetOffset.height - 20) + "px"
486+
tooltipLayer.style.top = "-" + (tooltipOffset.height - targetOffset.height - 20) + "px";
485487
} else {
486488
arrowLayer.className = 'introjs-arrow left';
487489
}
@@ -501,7 +503,6 @@
501503
}
502504
tooltipLayer.style.right = (targetOffset.width + 20) + 'px';
503505

504-
505506
break;
506507
case 'floating':
507508
arrowLayer.style.display = 'none';
@@ -593,26 +594,26 @@
593594
function _determineAutoPosition(targetElement, tooltipLayer, desiredTooltipPosition) {
594595

595596
// Take a clone of position precedence. These will be the available
596-
var possiblePositions = this._options.positionPrecedence.slice()
597+
var possiblePositions = this._options.positionPrecedence.slice();
597598

598-
var windowSize = _getWinSize()
599-
var tooltipHeight = _getOffset(tooltipLayer).height + 10
600-
var tooltipWidth = _getOffset(tooltipLayer).width + 20
601-
var targetOffset = _getOffset(targetElement)
599+
var windowSize = _getWinSize();
600+
var tooltipHeight = _getOffset(tooltipLayer).height + 10;
601+
var tooltipWidth = _getOffset(tooltipLayer).width + 20;
602+
var targetOffset = _getOffset(targetElement);
602603

603604
// If we check all the possible areas, and there are no valid places for the tooltip, the element
604605
// must take up most of the screen real estate. Show the tooltip floating in the middle of the screen.
605-
var calculatedPosition = "floating"
606+
var calculatedPosition = "floating";
606607

607608
// Check if the width of the tooltip + the starting point would spill off the right side of the screen
608609
// If no, neither bottom or top are valid
609610
if (targetOffset.left + tooltipWidth > windowSize.width || ((targetOffset.left + (targetOffset.width / 2)) - tooltipWidth) < 0) {
610-
_removeEntry(possiblePositions, "bottom")
611+
_removeEntry(possiblePositions, "bottom");
611612
_removeEntry(possiblePositions, "top");
612613
} else {
613614
// Check for space below
614615
if ((targetOffset.height + targetOffset.top + tooltipHeight) > windowSize.height) {
615-
_removeEntry(possiblePositions, "bottom")
616+
_removeEntry(possiblePositions, "bottom");
616617
}
617618

618619
// Check for space above
@@ -639,11 +640,11 @@
639640
// If the requested position is in the list, replace our calculated choice with that
640641
if (desiredTooltipPosition && desiredTooltipPosition != "auto") {
641642
if (possiblePositions.indexOf(desiredTooltipPosition) > -1) {
642-
calculatedPosition = desiredTooltipPosition
643+
calculatedPosition = desiredTooltipPosition;
643644
}
644645
}
645646

646-
return calculatedPosition
647+
return calculatedPosition;
647648
}
648649

649650
/**
@@ -838,7 +839,6 @@
838839
bulletsLayer.style.display = 'none';
839840
}
840841

841-
842842
var ulContainer = document.createElement('ul');
843843

844844
for (var i = 0, stepsLength = this._introItems.length; i < stepsLength; i++) {
@@ -995,7 +995,7 @@
995995
var zIndex = _getPropValue(parentElm, 'z-index');
996996
var opacity = parseFloat(_getPropValue(parentElm, 'opacity'));
997997
var transform = _getPropValue(parentElm, 'transform') || _getPropValue(parentElm, '-webkit-transform') || _getPropValue(parentElm, '-moz-transform') || _getPropValue(parentElm, '-ms-transform') || _getPropValue(parentElm, '-o-transform');
998-
if (/[0-9]+/.test(zIndex) || opacity < 1 || transform !== 'none') {
998+
if (/[0-9]+/.test(zIndex) || opacity < 1 || (transform !== 'none' && transform !== undefined)) {
999999
parentElm.className += ' introjs-fixParent';
10001000
}
10011001

0 commit comments

Comments
 (0)