Skip to content

Commit 65d466c

Browse files
committed
Merge pull request #1 from Alexandre-io/fix-codacy-err
fix(codacy): follow codacy recommandations
2 parents 231f604 + f65a5ad commit 65d466c

File tree

2 files changed

+37
-28
lines changed

2 files changed

+37
-28
lines changed

src/introduction.css

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
background: -o-radial-gradient(center, ellipse cover, rgba(0, 0, 0, 0.4) 0, rgba(0, 0, 0, 0.9) 100%);
1616
background: -ms-radial-gradient(center, ellipse cover, rgba(0, 0, 0, 0.4) 0, rgba(0, 0, 0, 0.9) 100%);
1717
background: radial-gradient(center, ellipse cover, rgba(0, 0, 0, 0.4) 0, rgba(0, 0, 0, 0.9) 100%);
18-
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#66000000', endColorstr='#e6000000', GradientType=1);
1918
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
2019
filter: alpha(opacity=50);
2120
-webkit-transition: all 0.3s ease-out;
@@ -41,7 +40,6 @@
4140
tr.introjs-showElement > td,
4241
tr.introjs-showElement > th {
4342
z-index: 9999 !important;
44-
display: absolute;
4543
}
4644

4745
.introjs-disableInteraction {
@@ -226,23 +224,25 @@ tr.introjs-showElement > th {
226224
}
227225

228226
.introjs-tooltiptext {
229-
padding: 8px 0px 0px 8px;
227+
padding: 8px 0 0 8px;
230228
}
231229

232230
.introjs-button {
233231
border-radius: 3px;
234232
box-sizing: border-box;
235233
-moz-user-select: none;
234+
-webkit-user-select: none;
235+
-ms-user-select: none;
236236
position: relative;
237-
outline: 0px none;
238-
border: 0px none;
237+
outline: 0 none;
238+
border: 0 none;
239239
display: inline-block;
240240
align-items: center;
241-
padding: 0px 6px;
241+
padding: 0 6px;
242242
margin: 6px 8px;
243243
line-height: 36px;
244244
min-height: 36px;
245-
background: transparent none repeat scroll 0px 0px;
245+
background: transparent none repeat scroll 0 0;
246246
white-space: nowrap;
247247
min-width: 88px;
248248
text-align: center;
@@ -263,7 +263,7 @@ tr.introjs-showElement > th {
263263
}
264264

265265
.introjs-nextbutton {
266-
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.26);
266+
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
267267
}
268268

269269
.introjs-disabled,
@@ -294,17 +294,17 @@ tr.introjs-showElement > th {
294294
width: 6px;
295295
height: 6px;
296296
background: #ccc;
297-
border-radius: 10px;
298297
-moz-border-radius: 10px;
299298
-webkit-border-radius: 10px;
299+
border-radius: 10px;
300300
text-decoration: none;
301301
}
302302

303303
.introjs-bullets ul li a:hover {
304304
background: #999;
305305
}
306306

307-
.introjs-bullets ul li a.active {
307+
.introjs-bullets ul li .active {
308308
background: #999;
309309
}
310310

@@ -318,7 +318,7 @@ tr.introjs-showElement > th {
318318

319319
.introjs-progressbar {
320320
float: left;
321-
width: 0%;
321+
width: 0;
322322
height: 100%;
323323
font-size: 10px;
324324
line-height: 10px;

src/introduction.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
if (currentEl.getAttribute('data-step') === null) {
159159

160160
while (true) {
161-
if (typeof introItems[nextStep] == 'undefined') {
161+
if (typeof introItems[nextStep] === 'undefined') {
162162
break;
163163
}
164164
else {
@@ -251,7 +251,7 @@
251251
}
252252
};
253253

254-
self._onResize = function(e) {
254+
self._onResize = function() {
255255
_setHelperLayerPosition.call(self, document.querySelector('.introjs-helperLayer'));
256256
_setHelperLayerPosition.call(self, document.querySelector('.introjs-tooltipReferenceLayer'));
257257
};
@@ -302,7 +302,7 @@
302302
}
303303
var temp = {};
304304
for (var key in object) {
305-
if (typeof(jQuery) != 'undefined' && object[key] instanceof jQuery) {
305+
if (typeof(jQuery) !== 'undefined' && object[key] instanceof jQuery) {
306306
temp[key] = object[key];
307307
}
308308
else {
@@ -486,7 +486,9 @@
486486
}
487487

488488
//prevent error when `this._currentStep` is undefined
489-
if (!this._introItems[this._currentStep]) return;
489+
if (!this._introItems[this._currentStep]) {
490+
return;
491+
}
490492

491493
//if we have a custom css class for each step
492494
currentStepObj = this._introItems[this._currentStep];
@@ -500,8 +502,8 @@
500502
tooltipLayer.className = ('introjs-tooltip ' + tooltipCssClass).replace(/^\s+|\s+$/g, '');
501503

502504
currentTooltipPosition = this._introItems[this._currentStep].position;
503-
if ((currentTooltipPosition == "auto" || this._options.tooltipPosition == "auto")) {
504-
if (currentTooltipPosition != "floating") { // Floating is always valid, no point in calculating
505+
if ((currentTooltipPosition === "auto" || this._options.tooltipPosition === "auto")) {
506+
if (currentTooltipPosition !== "floating") { // Floating is always valid, no point in calculating
505507
currentTooltipPosition = _determineAutoPosition.call(this, targetElement, tooltipLayer, currentTooltipPosition);
506508
}
507509
}
@@ -688,7 +690,7 @@
688690
}
689691

690692
// If the requested position is in the list, replace our calculated choice with that
691-
if (desiredTooltipPosition && desiredTooltipPosition != "auto") {
693+
if (desiredTooltipPosition && desiredTooltipPosition !== "auto") {
692694
if (possiblePositions.indexOf(desiredTooltipPosition) > -1) {
693695
calculatedPosition = desiredTooltipPosition;
694696
}
@@ -725,7 +727,7 @@
725727
elementPosition = _getOffset(currentElement.element),
726728
widthHeightPadding = 10;
727729

728-
if (currentElement.position == 'floating') {
730+
if (currentElement.position === 'floating') {
729731
widthHeightPadding = 0;
730732
}
731733

@@ -846,7 +848,9 @@
846848

847849
//show the tooltip
848850
oldtooltipContainer.style.opacity = 1;
849-
if (oldHelperNumberLayer) oldHelperNumberLayer.style.opacity = 1;
851+
if (oldHelperNumberLayer) {
852+
oldHelperNumberLayer.style.opacity = 1;
853+
}
850854

851855
//reset button focus
852856
if (self._options.showSkipButton && nextTooltipButton.tabIndex === -1) {
@@ -902,7 +906,9 @@
902906
self.goToStep(this.getAttribute('data-stepnumber'));
903907
}; // jshint ignore:line
904908

905-
if (l === (targetElement.step - 1)) anchorLink.className = 'active';
909+
if (l === (targetElement.step - 1)) {
910+
anchorLink.className = 'active';
911+
}
906912

907913
anchorLink.href = 'javascript:void(0);'; // jshint ignore:line
908914
anchorLink.innerHTML = " ";
@@ -950,10 +956,10 @@
950956
nextTooltipButton = document.createElement('a');
951957

952958
nextTooltipButton.onclick = function() {
953-
if (!self._options.showSkipButton && self._introItems.length - 1 == self._currentStep && typeof(self._introCompleteCallback) === 'function') {
959+
if (!self._options.showSkipButton && self._introItems.length - 1 === self._currentStep && typeof(self._introCompleteCallback) === 'function') {
954960
self._introCompleteCallback.call(self);
955961
}
956-
if (!self._options.showSkipButton && self._introItems.length - 1 != self._currentStep && typeof(self._introExitCallback) === 'function') {
962+
if (!self._options.showSkipButton && self._introItems.length - 1 !== self._currentStep && typeof(self._introExitCallback) === 'function') {
957963
self._introExitCallback.call(self);
958964
}
959965
if (self._introItems.length - 1 != self._currentStep) {
@@ -992,11 +998,11 @@
992998
skipTooltipButton.innerHTML = this._options.skipLabel;
993999

9941000
skipTooltipButton.onclick = function() {
995-
if (self._introItems.length - 1 == self._currentStep && typeof(self._introCompleteCallback) === 'function') {
1001+
if (self._introItems.length - 1 === self._currentStep && typeof(self._introCompleteCallback) === 'function') {
9961002
self._introCompleteCallback.call(self);
9971003
}
9981004

999-
if (self._introItems.length - 1 != self._currentStep && typeof(self._introExitCallback) === 'function') {
1005+
if (self._introItems.length - 1 !== self._currentStep && typeof(self._introExitCallback) === 'function') {
10001006
self._introExitCallback.call(self);
10011007
}
10021008

@@ -1036,7 +1042,7 @@
10361042
nextTooltipButton.innerHTML = this._options.nextLabel;
10371043
}
10381044
}
1039-
else if (this._introItems.length - 1 == this._currentStep || this._introItems.length == 1) {
1045+
else if (this._introItems.length - 1 === this._currentStep || this._introItems.length === 1) {
10401046
if (this._options.showSkipButton) {
10411047
skipTooltipButton.innerHTML = this._options.doneLabel;
10421048
nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-disabled';
@@ -1074,7 +1080,9 @@
10741080

10751081
var parentElm = targetElement.element.parentNode;
10761082
while (parentElm !== null) {
1077-
if (parentElm.tagName.toLowerCase() === 'body') break;
1083+
if (parentElm.tagName.toLowerCase() === 'body') {
1084+
break;
1085+
}
10781086

10791087
//fix The Stacking Contenxt problem.
10801088
//More detail: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context
@@ -1340,8 +1348,9 @@
13401348
break;
13411349
case 'touchend':
13421350
event_handle.touches[event.type] = true;
1343-
if (!event_handle.touches.touchmove.entered)
1351+
if (!event_handle.touches.touchmove.entered) {
13441352
break;
1353+
}
13451354
event_handle._y_diff = event_handle.touches.touchstart.y > event_handle.touches.touchmove.y ? event_handle.touches.touchstart.y - event_handle.touches.touchmove.y : event_handle.touches.touchmove.y - event_handle.touches.touchstart.y;
13461355
event_handle._x_diff = event_handle.touches.touchstart.x > event_handle.touches.touchmove.x ? event_handle.touches.touchstart.x - event_handle.touches.touchmove.x : event_handle.touches.touchmove.x - event_handle.touches.touchstart.x;
13471356
if (event_handle.touches.touchstart.x > -1 && event_handle.touches.touchmove.x > -1 && event_handle._x_diff > event_handle._x_min_length && event_handle._x_diff >= event_handle._y_diff) {

0 commit comments

Comments
 (0)