Skip to content

Commit 2360507

Browse files
committed
ACP2E-4231: Fotorama can open Mini Cart on Image Viewer close action
1 parent 374d31a commit 2360507

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

lib/web/fotorama/fotorama.js

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const fotoramaVersion = '4.6.4';
100100
function (v) {
101101
return parseInt(v, 10);
102102
}),
103+
//eslint-disable-next-line no-unused-vars
103104
_ = {},
104105
Modernizr;
105106

@@ -500,6 +501,7 @@ const fotoramaVersion = '4.6.4';
500501
return C[0] + t * (2 * B[0] + 3 * A[0] * t);
501502
},
502503
xForT = function (t) {
504+
// eslint-disable-next-line no-shadow
503505
var x = t, i = 0, z;
504506

505507
while (++i < 14) {
@@ -810,7 +812,7 @@ const fotoramaVersion = '4.6.4';
810812
function getNumber() {
811813
var number;
812814

813-
for (var _i = 0, _l = arguments.length; _i < _l; _i++) {
815+
for (let _i = 0, _l = arguments.length; _i < _l; _i++) {
814816
number = _i ? arguments[_i]() : arguments[_i];
815817
if (typeof number === 'number') {
816818
break;
@@ -893,6 +895,7 @@ const fotoramaVersion = '4.6.4';
893895
return id ? {id: id, type: type, s: href.search.replace(/^\?/, ''), p: getProtocol()} : false;
894896
}
895897

898+
// eslint-disable-next-line no-shadow
896899
function updateData(data, _dataFrame, i, fotorama) {
897900
for (let _i = 0, _l = data.length; _i < _l; _i++) {
898901
let dataFrame = data[_i];
@@ -974,7 +977,7 @@ const fotoramaVersion = '4.6.4';
974977

975978
function optionsToLowerCase(options) {
976979
if (options) {
977-
var opts = {};
980+
let opts = {};
978981

979982
$.each(options, function (key, value) {
980983
opts[key.toLowerCase()] = value;
@@ -1035,6 +1038,7 @@ const fotoramaVersion = '4.6.4';
10351038
return !$.contains(document.documentElement, el);
10361039
}
10371040

1041+
// eslint-disable-next-line no-shadow
10381042
function waitFor(test, fn, timeout, i) {
10391043
if (!waitFor.i) {
10401044
waitFor.i = 1;
@@ -1058,6 +1062,7 @@ const fotoramaVersion = '4.6.4';
10581062
return waitFor.i++;
10591063
}
10601064

1065+
// eslint-disable-next-line no-shadow
10611066
waitFor.stop = function (i) {
10621067
waitFor.ii[i] = false;
10631068
};
@@ -1170,6 +1175,7 @@ const fotoramaVersion = '4.6.4';
11701175

11711176
while (l) {
11721177
// Pick a remaining element
1178+
// eslint-disable-next-line no-shadow
11731179
let i = Math.floor(Math.random() * l--),
11741180

11751181
// And swap it with the current element
@@ -1336,6 +1342,7 @@ const fotoramaVersion = '4.6.4';
13361342
* @param isExpected {bool} if items with caption need render them or not
13371343
* @returns {boolean} if true then caption should be rendered
13381344
*/
1345+
//eslint-disable-next-line
13391346
function isExpectedCaption(frameItem, isExpected, undefined) {
13401347
var expected = false,
13411348
frameExpected;
@@ -1360,6 +1367,7 @@ const fotoramaVersion = '4.6.4';
13601367
isExpectedCaption: isExpectedCaption
13611368
};
13621369

1370+
// eslint-disable-next-line no-use-before-define
13631371
}(UTIL || {}, jQuery));
13641372

13651373
function slide($el, options) {
@@ -1861,10 +1869,6 @@ const fotoramaVersion = '4.6.4';
18611869
calculateIndexes();
18621870
}
18631871

1864-
function limitIndex(index) {
1865-
return minMaxLimit(index, 0, size - 1);
1866-
}
1867-
18681872
jQuery.Fotorama = function ($fotorama, opts) {
18691873
var that = this,
18701874
stamp = $.now(),
@@ -1952,6 +1956,7 @@ const fotoramaVersion = '4.6.4';
19521956
scrollTop,
19531957
scrollLeft,
19541958

1959+
// eslint-disable-next-line no-unused-vars
19551960
showedFLAG,
19561961
pausedAutoplayFLAG,
19571962
stoppedAutoplayFLAG,
@@ -1986,11 +1991,16 @@ const fotoramaVersion = '4.6.4';
19861991

19871992
fotoramaData.fotorama = this;
19881993

1994+
function limitIndex(index) {
1995+
return minMaxLimit(index, 0, size - 1);
1996+
}
1997+
19891998
/**
19901999
* Search video items in incoming data and transform object for video layout.
19912000
*
19922001
*/
19932002
function checkForVideo() {
2003+
// eslint-disable-next-line no-shadow
19942004
$.each(data, function (i, dataFrame) {
19952005
if (!dataFrame.i) {
19962006
dataFrame.i = dataFrameCount++;
@@ -2025,10 +2035,12 @@ const fotoramaVersion = '4.6.4';
20252035
}
20262036

20272037
function setStagePosition() {
2038+
var padding = 0;
2039+
20282040
if ($stage !== undefined) {
20292041

20302042
if (opts.navdir === 'vertical') {
2031-
var padding = opts.thumbwidth + opts.thumbmargin;
2043+
padding = opts.thumbwidth + opts.thumbmargin;
20322044

20332045
$stage.css('left', padding);
20342046
$arrNext.css('right', padding);
@@ -2257,10 +2269,12 @@ const fotoramaVersion = '4.6.4';
22572269

22582270
}
22592271

2272+
// eslint-disable-next-line no-shadow
22602273
function getThumbsInSlide($el, opts) {
22612274
return Math.floor($wrap.width() / (opts.thumbwidth + opts.thumbmargin));
22622275
}
22632276

2277+
// eslint-disable-next-line no-shadow
22642278
function disableDirrection(i) {
22652279
return !o_loop && (!(activeIndex + i) || !(activeIndex - size + i)) && !$videoPlaying;
22662280
}
@@ -2335,6 +2349,7 @@ const fotoramaVersion = '4.6.4';
23352349
indexes = new Array(indexes);
23362350
rangeFLAG = true;
23372351
}
2352+
// eslint-disable-next-line no-shadow
23382353
return $.each(indexes, function (i, index) {
23392354
if (rangeFLAG) {index = i;}
23402355
if (typeof index === 'number') {
@@ -2441,6 +2456,7 @@ const fotoramaVersion = '4.6.4';
24412456
});
24422457
}
24432458

2459+
// eslint-disable-next-line no-shadow
24442460
function setMeasures(width, height, ratio, index) {
24452461
if (!measuresSetFLAG || measuresSetFLAG === '*' && index === startIndex) {
24462462

@@ -2709,6 +2725,7 @@ const fotoramaVersion = '4.6.4';
27092725
}
27102726

27112727
function frameDraw(indexes, type) {
2728+
// eslint-disable-next-line no-shadow
27122729
eachIndex(indexes, type, function (i, index, dataFrame, $frame, key, frameData) {
27132730
if ($frame) {return;}
27142731

@@ -2946,10 +2963,11 @@ const fotoramaVersion = '4.6.4';
29462963
}
29472964

29482965
function stageFramePosition(indexes) {
2966+
// eslint-disable-next-line no-shadow
29492967
eachIndex(indexes, 'stage', function (i, index, dataFrame, $frame, key, frameData) {
29502968
if (!$frame) {return;}
29512969

2952-
var normalizedIndex = normalizeIndex(index);
2970+
let normalizedIndex = normalizeIndex(index);
29532971

29542972
frameData.eq = normalizedIndex;
29552973

@@ -3061,6 +3079,7 @@ const fotoramaVersion = '4.6.4';
30613079
function detachFrames(key) {
30623080
var _toDetach = toDetach[key];
30633081

3082+
// eslint-disable-next-line no-shadow
30643083
$.each(activeIndexes, function (i, index) {
30653084
delete _toDetach[normalizeIndex(index)];
30663085
});
@@ -3604,6 +3623,7 @@ const fotoramaVersion = '4.6.4';
36043623
};
36053624

36063625
that.shuffle = function () {
3626+
// eslint-disable-next-line no-use-before-define
36073627
data && shuffle(data) && reset();
36083628
return this;
36093629
};
@@ -3774,7 +3794,7 @@ const fotoramaVersion = '4.6.4';
37743794
}
37753795

37763796
if (!result.moved) {
3777-
var target = result.$target.closest('.' + navFrameClass, $navShaft)[0];
3797+
let target = result.$target.closest('.' + navFrameClass, $navShaft)[0];
37783798

37793799
target && onNavFrameClick.call(target, result.startEvent);
37803800
} else if (result.pos !== result.newPos) {
@@ -3813,7 +3833,7 @@ const fotoramaVersion = '4.6.4';
38133833
onEnd: function (e, direction) {
38143834
onTouchStart();
38153835
onTouchEnd();
3816-
var newPos = stop($navShaft) + direction * 0.25;
3836+
let newPos = stop($navShaft) + direction * 0.25;
38173837

38183838
$navShaft.css(getTranslate(minMaxLimit(newPos, navShaftTouchTail.min, navShaftTouchTail.max),
38193839
opts.navdir));
@@ -3953,6 +3973,7 @@ const fotoramaVersion = '4.6.4';
39533973
}
39543974
}
39553975

3976+
// eslint-disable-next-line no-shadow
39563977
$.each('load push pop shift unshift reverse sort splice'.split(' '), function (i, method) {
39573978
that[method] = function () {
39583979
data = data || [];

0 commit comments

Comments
 (0)