fotoramajs 4.5.0 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -14
- data/Rakefile +4 -2
- data/lib/fotoramajs/helpers.rb +16 -0
- data/lib/fotoramajs/version.rb +1 -1
- data/lib/fotoramajs.rb +7 -0
- data/vendor/assets/javascripts/fotorama.js +344 -221
- data/vendor/assets/stylesheets/fotorama.css.scss +115 -97
- metadata +3 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Fotorama 4.5.
|
2
|
+
* Fotorama 4.5.2 | http://fotorama.io/license/
|
3
3
|
*/
|
4
4
|
(function (window, document, location, $, undefined) {
|
5
5
|
"use strict";
|
@@ -17,6 +17,8 @@ var _fotoramaClass = 'fotorama',
|
|
17
17
|
wrapPanYClass = wrapClass + '--pan-y',
|
18
18
|
wrapRtlClass = wrapClass + '--rtl',
|
19
19
|
wrapOnlyActiveClass = wrapClass + '--only-active',
|
20
|
+
wrapNoCaptionsClass = wrapClass + '--no-captions',
|
21
|
+
wrapToggleArrowsClass = wrapClass + '--toggle-arrows',
|
20
22
|
|
21
23
|
stageClass = _fotoramaClass + '__stage',
|
22
24
|
stageFrameClass = stageClass + '__frame',
|
@@ -82,7 +84,9 @@ var _fotoramaClass = 'fotorama',
|
|
82
84
|
captionClass = _fotoramaClass + '__caption',
|
83
85
|
captionWrapClass = _fotoramaClass + '__caption__wrap',
|
84
86
|
|
85
|
-
spinnerClass = _fotoramaClass + '__spinner'
|
87
|
+
spinnerClass = _fotoramaClass + '__spinner',
|
88
|
+
|
89
|
+
buttonAttributes = '" tabindex="0" role="button';
|
86
90
|
var JQUERY_VERSION = $ && $.fn.jquery.split('.');
|
87
91
|
|
88
92
|
if (!JQUERY_VERSION
|
@@ -361,8 +365,7 @@ var Modernizr = (function (window, document, undefined) {
|
|
361
365
|
|
362
366
|
return Modernizr;
|
363
367
|
})(window, document);
|
364
|
-
var
|
365
|
-
fullScreenApi = {
|
368
|
+
var fullScreenApi = {
|
366
369
|
ok: false,
|
367
370
|
is: function () {
|
368
371
|
return false;
|
@@ -846,8 +849,6 @@ var $WINDOW = $(window),
|
|
846
849
|
MOBILE = navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i),
|
847
850
|
SLOW = !CSS3 || MOBILE,
|
848
851
|
|
849
|
-
ADD_EVENT_LISTENER = 'addEventListener',
|
850
|
-
|
851
852
|
MS_POINTER = navigator.msPointerEnabled,
|
852
853
|
|
853
854
|
WHEEL = "onwheel" in document.createElement("div") ? "wheel" : document.onmousewheel !== undefined ? "mousewheel" : "DOMMouseScroll",
|
@@ -868,7 +869,80 @@ var $WINDOW = $(window),
|
|
868
869
|
NAV_DOT_FRAME_KEY = '$navDotFrame',
|
869
870
|
NAV_THUMB_FRAME_KEY = '$navThumbFrame',
|
870
871
|
|
871
|
-
|
872
|
+
AUTO = 'auto',
|
873
|
+
|
874
|
+
BEZIER = bez([.1, 0, .25, 1]),
|
875
|
+
|
876
|
+
MAX_WIDTH = 99999,
|
877
|
+
|
878
|
+
OPTIONS = {
|
879
|
+
// dimensions
|
880
|
+
width: null, // 500 || '100%'
|
881
|
+
minwidth: null,
|
882
|
+
maxwidth: '100%', // '100%'
|
883
|
+
height: null,
|
884
|
+
minheight: null,
|
885
|
+
maxheight: null,
|
886
|
+
|
887
|
+
ratio: null, // '16/9' || 500/333 || 1.5
|
888
|
+
|
889
|
+
margin: MARGIN,
|
890
|
+
glimpse: 0,
|
891
|
+
|
892
|
+
fit: 'contain', // 'cover' || 'scaledown' || 'none'
|
893
|
+
|
894
|
+
// navigation, thumbs
|
895
|
+
nav: 'dots', // 'thumbs' || false
|
896
|
+
navposition: 'bottom', // 'top'
|
897
|
+
navwidth: null,
|
898
|
+
thumbwidth: THUMB_SIZE,
|
899
|
+
thumbheight: THUMB_SIZE,
|
900
|
+
thumbmargin: MARGIN,
|
901
|
+
thumbborderwidth: MARGIN,
|
902
|
+
thumbfit: 'cover', // 'contain' || 'scaledown' || 'none'
|
903
|
+
|
904
|
+
allowfullscreen: false, // true || 'native'
|
905
|
+
|
906
|
+
transition: 'slide', // 'crossfade' || 'dissolve'
|
907
|
+
clicktransition: null,
|
908
|
+
transitionduration: TRANSITION_DURATION,
|
909
|
+
|
910
|
+
captions: true,
|
911
|
+
|
912
|
+
hash: false,
|
913
|
+
startindex: 0,
|
914
|
+
|
915
|
+
loop: false,
|
916
|
+
|
917
|
+
autoplay: false,
|
918
|
+
stopautoplayontouch: true,
|
919
|
+
|
920
|
+
keyboard: false,
|
921
|
+
|
922
|
+
arrows: true,
|
923
|
+
click: true,
|
924
|
+
swipe: true,
|
925
|
+
trackpad: false,
|
926
|
+
|
927
|
+
controlsonstart: true,
|
928
|
+
|
929
|
+
shuffle: false,
|
930
|
+
|
931
|
+
direction: 'ltr', // 'rtl'
|
932
|
+
|
933
|
+
shadows: true,
|
934
|
+
spinner: null
|
935
|
+
},
|
936
|
+
|
937
|
+
KEYBOARD_OPTIONS = {
|
938
|
+
left: true,
|
939
|
+
right: true,
|
940
|
+
down: false,
|
941
|
+
up: false,
|
942
|
+
space: false,
|
943
|
+
home: false,
|
944
|
+
end: false
|
945
|
+
};
|
872
946
|
function noop () {}
|
873
947
|
|
874
948
|
function minMaxLimit (value, min, max) {
|
@@ -887,10 +961,10 @@ function readPosition ($el) {
|
|
887
961
|
}
|
888
962
|
}
|
889
963
|
|
890
|
-
function getTranslate (pos
|
964
|
+
function getTranslate (pos/*, _001*/) {
|
891
965
|
var obj = {};
|
892
966
|
if (CSS3) {
|
893
|
-
obj.transform = 'translate3d(' + (pos + (_001 ? 0.001 : 0)) + 'px,0,0)'; // 0.001 to remove Retina artifacts
|
967
|
+
obj.transform = 'translate3d(' + (pos/* + (_001 ? 0.001 : 0)*/) + 'px,0,0)'; // 0.001 to remove Retina artifacts
|
894
968
|
} else {
|
895
969
|
obj.left = pos;
|
896
970
|
}
|
@@ -918,6 +992,9 @@ function measureIsValid (value) {
|
|
918
992
|
}
|
919
993
|
|
920
994
|
function getPosByIndex (index, side, margin, baseIndex) {
|
995
|
+
//console.log('getPosByIndex', index, side, margin, baseIndex);
|
996
|
+
//console.log((index - (baseIndex || 0)) * (side + (margin || 0)));
|
997
|
+
|
921
998
|
return (index - (baseIndex || 0)) * (side + (margin || 0));
|
922
999
|
}
|
923
1000
|
|
@@ -938,9 +1015,9 @@ function bindTransitionEnd ($el) {
|
|
938
1015
|
msTransition: 'MSTransitionEnd',
|
939
1016
|
transition: 'transitionend'
|
940
1017
|
};
|
941
|
-
el
|
1018
|
+
addEvent(el, transitionEndEvent[Modernizr.prefixed('transition')], function (e) {
|
942
1019
|
elData.tProp && e.propertyName.match(elData.tProp) && elData.onEndFn();
|
943
|
-
}
|
1020
|
+
});
|
944
1021
|
elData.tEnd = true;
|
945
1022
|
}
|
946
1023
|
|
@@ -968,7 +1045,7 @@ function afterTransition ($el, property, fn, time) {
|
|
968
1045
|
}
|
969
1046
|
|
970
1047
|
|
971
|
-
function stop ($el, left
|
1048
|
+
function stop ($el, left/*, _001*/) {
|
972
1049
|
if ($el.length) {
|
973
1050
|
var elData = $el.data();
|
974
1051
|
if (CSS3) {
|
@@ -982,7 +1059,7 @@ function stop ($el, left, _001) {
|
|
982
1059
|
return readPosition($el);
|
983
1060
|
});
|
984
1061
|
|
985
|
-
$el.css(getTranslate(lockedLeft
|
1062
|
+
$el.css(getTranslate(lockedLeft/*, _001*/));//.width(); // `.width()` for reflow
|
986
1063
|
return lockedLeft;
|
987
1064
|
}
|
988
1065
|
}
|
@@ -1044,7 +1121,7 @@ function findVideoId (href, forceVideo) {
|
|
1044
1121
|
type = 'custom';
|
1045
1122
|
}
|
1046
1123
|
|
1047
|
-
return id ? {id: id, type: type, s: href.search.replace(/^\?/, '')} : false;
|
1124
|
+
return id ? {id: id, type: type, s: href.search.replace(/^\?/, ''), p: getProtocol()} : false;
|
1048
1125
|
}
|
1049
1126
|
|
1050
1127
|
function getVideoThumbs (dataFrame, data, fotorama) {
|
@@ -1205,8 +1282,8 @@ function fit ($el, measuresToFit, method) {
|
|
1205
1282
|
$el.css({
|
1206
1283
|
width: Math.ceil(width),
|
1207
1284
|
height: Math.ceil(height),
|
1208
|
-
|
1209
|
-
|
1285
|
+
left: Math.floor(measuresToFit.w / 2 - width / 2),
|
1286
|
+
top: Math.floor(measuresToFit.h / 2 - height / 2)
|
1210
1287
|
});
|
1211
1288
|
|
1212
1289
|
elData.l = {
|
@@ -1310,10 +1387,10 @@ function clone (array) {
|
|
1310
1387
|
});
|
1311
1388
|
}
|
1312
1389
|
|
1313
|
-
function lockScroll (left, top) {
|
1314
|
-
$
|
1315
|
-
.scrollLeft(left)
|
1316
|
-
.scrollTop(top);
|
1390
|
+
function lockScroll ($el, left, top) {
|
1391
|
+
$el
|
1392
|
+
.scrollLeft(left || 0)
|
1393
|
+
.scrollTop(top || 0);
|
1317
1394
|
}
|
1318
1395
|
|
1319
1396
|
function optionsToLowerCase (options) {
|
@@ -1338,8 +1415,33 @@ function getRatio (_ratio) {
|
|
1338
1415
|
}
|
1339
1416
|
}
|
1340
1417
|
|
1418
|
+
function addEvent (el, e, fn, bool) {
|
1419
|
+
if (!e) return;
|
1420
|
+
el.addEventListener ? el.addEventListener(e, fn, !!bool) : el.attachEvent('on'+e, fn);
|
1421
|
+
}
|
1422
|
+
|
1423
|
+
function elIsDisabled (el) {
|
1424
|
+
return !!el.getAttribute('disabled');
|
1425
|
+
}
|
1426
|
+
|
1427
|
+
function disableAttr (FLAG) {
|
1428
|
+
return {tabindex: FLAG * -1 + '', disabled: FLAG};
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
function addEnterUp (el, fn) {
|
1432
|
+
addEvent(el, 'keyup', function (e) {
|
1433
|
+
elIsDisabled(el) || e.keyCode == 13 && fn.call(el, e);
|
1434
|
+
});
|
1435
|
+
}
|
1436
|
+
|
1437
|
+
function addFocus (el, fn) {
|
1438
|
+
addEvent(el, 'focus', el.onfocusin = function (e) {
|
1439
|
+
fn.call(el, e);
|
1440
|
+
}, true);
|
1441
|
+
}
|
1442
|
+
|
1341
1443
|
function stopEvent (e, stopPropagation) {
|
1342
|
-
e.preventDefault();
|
1444
|
+
e.preventDefault ? e.preventDefault() : (e.returnValue = false);
|
1343
1445
|
stopPropagation && e.stopPropagation();
|
1344
1446
|
}
|
1345
1447
|
|
@@ -1363,7 +1465,7 @@ function slide ($el, options) {
|
|
1363
1465
|
}
|
1364
1466
|
|
1365
1467
|
//console.time('var translate = $.extend');
|
1366
|
-
var translate = $.extend(getTranslate(elPos
|
1468
|
+
var translate = $.extend(getTranslate(elPos/*, options._001*/), options.width && {width: options.width});
|
1367
1469
|
//console.timeEnd('var translate = $.extend');
|
1368
1470
|
|
1369
1471
|
elData.sliding = true;
|
@@ -1552,26 +1654,24 @@ function touch ($el, options) {
|
|
1552
1654
|
}
|
1553
1655
|
|
1554
1656
|
if (MS_POINTER) {
|
1555
|
-
el
|
1556
|
-
document
|
1557
|
-
document
|
1558
|
-
document
|
1657
|
+
addEvent(el, 'MSPointerDown', onStart);
|
1658
|
+
addEvent(document, 'MSPointerMove', onMove);
|
1659
|
+
addEvent(document,'MSPointerCancel', onEnd);
|
1660
|
+
addEvent(document, 'MSPointerUp', onEnd);
|
1559
1661
|
} else {
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
el[ADD_EVENT_LISTENER]('touchend', onEnd, false);
|
1662
|
+
addEvent(el, 'touchstart', onStart);
|
1663
|
+
addEvent(el, 'touchmove', onMove);
|
1664
|
+
addEvent(el, 'touchend', onEnd);
|
1564
1665
|
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
window[ADD_EVENT_LISTENER]('scroll', onOtherEnd, false);
|
1569
|
-
}
|
1666
|
+
addEvent(document, 'touchstart', onOtherStart);
|
1667
|
+
addEvent(document, 'touchend', onOtherEnd);
|
1668
|
+
addEvent(document, 'touchcancel', onOtherEnd);
|
1570
1669
|
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1670
|
+
addEvent(window, 'scroll', onOtherEnd);
|
1671
|
+
|
1672
|
+
addEvent(el, 'mousedown', onStart);
|
1673
|
+
addEvent(document, 'mousemove', onMove);
|
1674
|
+
addEvent(document, 'mouseup', onEnd);
|
1575
1675
|
}
|
1576
1676
|
|
1577
1677
|
$el.on('click', 'a', function (e) {
|
@@ -1610,7 +1710,7 @@ function moveOnTouch ($el, options) {
|
|
1610
1710
|
[startTime, startCoo]
|
1611
1711
|
];
|
1612
1712
|
|
1613
|
-
startElPos = moveElPos = tail.noMove || noStop ? 0 : stop($el, (options.getPos || noop)()
|
1713
|
+
startElPos = moveElPos = tail.noMove || noStop ? 0 : stop($el, (options.getPos || noop)()/*, options._001*/);
|
1614
1714
|
|
1615
1715
|
(options.onStart || noop).call(el, e);
|
1616
1716
|
}
|
@@ -1651,7 +1751,7 @@ function moveOnTouch ($el, options) {
|
|
1651
1751
|
}
|
1652
1752
|
|
1653
1753
|
if (!tail.noMove) {
|
1654
|
-
$el.css(getTranslate(moveElPos
|
1754
|
+
$el.css(getTranslate(moveElPos/*, options._001*/));
|
1655
1755
|
if (!moved) {
|
1656
1756
|
moved = true;
|
1657
1757
|
// only for mouse
|
@@ -1741,13 +1841,11 @@ function moveOnTouch ($el, options) {
|
|
1741
1841
|
(options.onEnd || noop).call(el, $.extend(result, {moved: result.moved || longTouchFLAG && snap, pos: moveElPos, newPos: newPos, overPos: overPos, time: time}));
|
1742
1842
|
}
|
1743
1843
|
|
1744
|
-
tail = $.extend(touch(options.$wrap, {
|
1844
|
+
tail = $.extend(touch(options.$wrap, $.extend({}, options, {
|
1745
1845
|
onStart: onStart,
|
1746
1846
|
onMove: onMove,
|
1747
|
-
|
1748
|
-
|
1749
|
-
select: options.select
|
1750
|
-
}), tail);
|
1847
|
+
onEnd: onEnd
|
1848
|
+
})), tail);
|
1751
1849
|
|
1752
1850
|
return tail;
|
1753
1851
|
}
|
@@ -1760,10 +1858,10 @@ function wheel ($el, options) {
|
|
1760
1858
|
prevent: {}
|
1761
1859
|
};
|
1762
1860
|
|
1763
|
-
el
|
1861
|
+
addEvent(el, WHEEL, function (e) {
|
1764
1862
|
var yDelta = e.wheelDeltaY || -1 * e.deltaY || 0,
|
1765
1863
|
xDelta = e.wheelDeltaX || -1 * e.deltaX || 0,
|
1766
|
-
xWin = Math.abs(xDelta)
|
1864
|
+
xWin = Math.abs(xDelta) && !Math.abs(yDelta),
|
1767
1865
|
direction = getDirectionSign(xDelta < 0),
|
1768
1866
|
sameDirection = lastDirection === direction,
|
1769
1867
|
now = $.now(),
|
@@ -1791,13 +1889,13 @@ function wheel ($el, options) {
|
|
1791
1889
|
|
1792
1890
|
(options.onEnd || noop)(e, options.shift ? direction : xDelta);
|
1793
1891
|
|
1794
|
-
}
|
1892
|
+
});
|
1795
1893
|
|
1796
1894
|
return tail;
|
1797
1895
|
}
|
1798
1896
|
jQuery.Fotorama = function ($fotorama, opts) {
|
1799
|
-
$HTML = $
|
1800
|
-
$BODY = $
|
1897
|
+
$HTML = $('html');
|
1898
|
+
$BODY = $('body');
|
1801
1899
|
|
1802
1900
|
var that = this,
|
1803
1901
|
stamp = $.now(),
|
@@ -1817,8 +1915,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1817
1915
|
|
1818
1916
|
$stageShaft = $(div(stageShaftClass)).appendTo($stage),
|
1819
1917
|
$stageFrame = $(),
|
1820
|
-
$arrPrev = $(div(arrClass + ' ' + arrPrevClass
|
1821
|
-
$arrNext = $(div(arrClass + ' ' + arrNextClass
|
1918
|
+
$arrPrev = $(div(arrClass + ' ' + arrPrevClass + buttonAttributes)),
|
1919
|
+
$arrNext = $(div(arrClass + ' ' + arrNextClass + buttonAttributes)),
|
1822
1920
|
$arrs = $arrPrev.add($arrNext).appendTo($stage),
|
1823
1921
|
$navWrap = $(div(navWrapClass)),
|
1824
1922
|
$nav = $(div(navClass)).appendTo($navWrap),
|
@@ -1832,7 +1930,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1832
1930
|
|
1833
1931
|
$thumbBorder = $(div(thumbBorderClass)).appendTo($navShaft),
|
1834
1932
|
|
1835
|
-
$fullscreenIcon = $(div(fullscreenIconClass)),
|
1933
|
+
$fullscreenIcon = $(div(fullscreenIconClass + buttonAttributes)),
|
1836
1934
|
fullscreenIcon = $fullscreenIcon[0],
|
1837
1935
|
$videoPlay = $(div(videoPlayClass)),
|
1838
1936
|
$videoClose = $(div(videoCloseClass)).appendTo($stage),
|
@@ -1866,6 +1964,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1866
1964
|
o_transition,
|
1867
1965
|
o_shadows,
|
1868
1966
|
o_rtl,
|
1967
|
+
o_keyboard,
|
1869
1968
|
lastOptions = {},
|
1870
1969
|
|
1871
1970
|
measures = {},
|
@@ -1898,15 +1997,17 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1898
1997
|
fadeStack = [];
|
1899
1998
|
|
1900
1999
|
$wrap[STAGE_FRAME_KEY] = $(div(stageFrameClass));
|
1901
|
-
$wrap[NAV_THUMB_FRAME_KEY] = $(div(navFrameClass + ' ' + navFrameThumbClass, div(thumbClass)));
|
1902
|
-
$wrap[NAV_DOT_FRAME_KEY] = $(div(navFrameClass + ' ' + navFrameDotClass, div(dotClass)));
|
2000
|
+
$wrap[NAV_THUMB_FRAME_KEY] = $(div(navFrameClass + ' ' + navFrameThumbClass + buttonAttributes, div(thumbClass)));
|
2001
|
+
$wrap[NAV_DOT_FRAME_KEY] = $(div(navFrameClass + ' ' + navFrameDotClass + buttonAttributes, div(dotClass)));
|
1903
2002
|
|
1904
2003
|
toDeactivate[STAGE_FRAME_KEY] = [];
|
1905
2004
|
toDeactivate[NAV_THUMB_FRAME_KEY] = [];
|
1906
2005
|
toDeactivate[NAV_DOT_FRAME_KEY] = [];
|
1907
2006
|
toDetach[STAGE_FRAME_KEY] = {};
|
1908
2007
|
|
1909
|
-
$wrap
|
2008
|
+
$wrap
|
2009
|
+
.addClass(CSS3 ? wrapCss3Class : wrapCss2Class)
|
2010
|
+
.toggleClass(wrapNoControlsClass, !opts.controlsonstart);
|
1910
2011
|
|
1911
2012
|
fotoramaData.fotorama = this;
|
1912
2013
|
|
@@ -1929,29 +2030,42 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
1929
2030
|
});
|
1930
2031
|
}
|
1931
2032
|
|
2033
|
+
function allowKey (key) {
|
2034
|
+
return o_keyboard[key] || that.fullScreen;
|
2035
|
+
}
|
2036
|
+
|
1932
2037
|
function bindGlobalEvents (FLAG) {
|
1933
2038
|
var keydownCommon = 'keydown.' + _fotoramaClass,
|
1934
|
-
|
1935
|
-
|
2039
|
+
localStamp = _fotoramaClass + stamp,
|
2040
|
+
keydownLocal = 'keydown.' + localStamp,
|
2041
|
+
resizeLocal = 'resize.' + localStamp + ' ' + 'orientationchange.' + localStamp;
|
1936
2042
|
|
1937
2043
|
if (FLAG) {
|
1938
2044
|
$DOCUMENT
|
1939
2045
|
.on(keydownLocal, function (e) {
|
2046
|
+
var catched,
|
2047
|
+
index;
|
2048
|
+
|
1940
2049
|
if ($videoPlaying && e.keyCode === 27) {
|
1941
|
-
|
2050
|
+
catched = true;
|
1942
2051
|
unloadVideo($videoPlaying, true, true);
|
1943
2052
|
} else if (that.fullScreen || (opts.keyboard && !that.index)) {
|
1944
2053
|
if (e.keyCode === 27) {
|
1945
|
-
|
2054
|
+
catched = true;
|
1946
2055
|
that.cancelFullScreen();
|
1947
|
-
} else if (e.keyCode ===
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
2056
|
+
} else if ((e.shiftKey && e.keyCode === 32 && allowKey('space')) || (e.keyCode === 37 && allowKey('left')) || (e.keyCode === 38 && allowKey('up'))) {
|
2057
|
+
index = '<';
|
2058
|
+
} else if ((e.keyCode === 32 && allowKey('space')) || (e.keyCode === 39 && allowKey('right')) || (e.keyCode === 40 && allowKey('down'))) {
|
2059
|
+
index = '>';
|
2060
|
+
} else if (e.keyCode === 36 && allowKey('home')) {
|
2061
|
+
index = '<<';
|
2062
|
+
} else if (e.keyCode === 35 && allowKey('end')) {
|
2063
|
+
index = '>>';
|
1953
2064
|
}
|
1954
2065
|
}
|
2066
|
+
|
2067
|
+
(catched || index) && stopEvent(e);
|
2068
|
+
index && that.show({index: index, slow: e.altKey, user: true});
|
1955
2069
|
});
|
1956
2070
|
|
1957
2071
|
if (!that.index) {
|
@@ -2014,7 +2128,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2014
2128
|
stageShaftTouchTail.noMove = _noMove || o_fade;
|
2015
2129
|
stageShaftTouchTail.noSwipe = _noMove || !opts.swipe;
|
2016
2130
|
|
2017
|
-
!o_transition && $stageShaft.toggleClass(grabClass, !stageShaftTouchTail.noMove && !stageShaftTouchTail.noSwipe);
|
2131
|
+
!o_transition && $stageShaft.toggleClass(grabClass, !opts.click && !stageShaftTouchTail.noMove && !stageShaftTouchTail.noSwipe);
|
2018
2132
|
MS_POINTER && $wrap.toggleClass(wrapPanYClass, !stageShaftTouchTail.noSwipe);
|
2019
2133
|
}
|
2020
2134
|
|
@@ -2023,32 +2137,34 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2023
2137
|
opts.autoplay = Math.max(+interval || AUTOPLAY_INTERVAL, o_transitionDuration * 1.5);
|
2024
2138
|
}
|
2025
2139
|
|
2026
|
-
function addOrRemove (FLAG) {
|
2027
|
-
return FLAG ? 'add' : 'remove';
|
2028
|
-
}
|
2029
|
-
|
2030
2140
|
/**
|
2031
2141
|
* Options on the fly
|
2032
2142
|
* */
|
2033
2143
|
function setOptions () {
|
2034
2144
|
that.options = opts = optionsToLowerCase(opts);
|
2035
2145
|
|
2036
|
-
o_fade = opts.transition === 'crossfade' || opts.transition === 'dissolve';
|
2146
|
+
o_fade = (opts.transition === 'crossfade' || opts.transition === 'dissolve');
|
2037
2147
|
|
2038
|
-
o_loop = opts.loop && (size > 2 || o_fade);
|
2148
|
+
o_loop = opts.loop && (size > 2 || (o_fade && (!o_transition || o_transition !== 'slide')));
|
2039
2149
|
|
2040
2150
|
o_transitionDuration = +opts.transitionduration || TRANSITION_DURATION;
|
2041
2151
|
|
2042
2152
|
o_rtl = opts.direction === 'rtl';
|
2043
2153
|
|
2154
|
+
o_keyboard = $.extend({}, opts.keyboard && KEYBOARD_OPTIONS, opts.keyboard);
|
2155
|
+
|
2044
2156
|
var classes = {add: [], remove: []};
|
2045
2157
|
|
2158
|
+
function addOrRemoveClass (FLAG, value) {
|
2159
|
+
classes[FLAG ? 'add' : 'remove'].push(value);
|
2160
|
+
}
|
2161
|
+
|
2046
2162
|
if (size > 1) {
|
2047
2163
|
o_nav = opts.nav;
|
2048
2164
|
o_navTop = opts.navposition === 'top';
|
2049
2165
|
classes.remove.push(selectClass);
|
2050
2166
|
|
2051
|
-
$arrs.toggle(opts.arrows);
|
2167
|
+
$arrs.toggle(!!opts.arrows);
|
2052
2168
|
} else {
|
2053
2169
|
o_nav = false;
|
2054
2170
|
$arrs.hide();
|
@@ -2069,7 +2185,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2069
2185
|
|
2070
2186
|
stageNoMove();
|
2071
2187
|
|
2072
|
-
extendMeasures(opts,
|
2188
|
+
extendMeasures(opts, [measures]);
|
2073
2189
|
|
2074
2190
|
o_navThumbs = o_nav === 'thumbs';
|
2075
2191
|
|
@@ -2111,20 +2227,21 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2111
2227
|
o_allowFullScreen = opts.allowfullscreen;
|
2112
2228
|
|
2113
2229
|
if (o_allowFullScreen) {
|
2114
|
-
$fullscreenIcon.
|
2230
|
+
$fullscreenIcon.prependTo($stage);
|
2115
2231
|
o_nativeFullScreen = FULLSCREEN && o_allowFullScreen === 'native';
|
2116
2232
|
} else {
|
2117
2233
|
$fullscreenIcon.detach();
|
2118
2234
|
o_nativeFullScreen = false;
|
2119
2235
|
}
|
2120
2236
|
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2237
|
+
addOrRemoveClass(o_fade, wrapFadeClass);
|
2238
|
+
addOrRemoveClass(!o_fade, wrapSlideClass);
|
2239
|
+
addOrRemoveClass(!opts.captions, wrapNoCaptionsClass);
|
2240
|
+
addOrRemoveClass(o_rtl, wrapRtlClass);
|
2241
|
+
addOrRemoveClass(opts.arrows !== 'always', wrapToggleArrowsClass);
|
2125
2242
|
|
2126
2243
|
o_shadows = opts.shadows && !SLOW;
|
2127
|
-
|
2244
|
+
addOrRemoveClass(!o_shadows, wrapNoShadowsClass);
|
2128
2245
|
|
2129
2246
|
$wrap
|
2130
2247
|
.addClass(classes.add.join(' '))
|
@@ -2188,12 +2305,15 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2188
2305
|
|
2189
2306
|
function setMeasures (width, height, ratio, index) {
|
2190
2307
|
if (!measuresSetFLAG || (measuresSetFLAG === '*' && index === startIndex)) {
|
2308
|
+
|
2309
|
+
//console.log('setMeasures', index, opts.width, opts.height);
|
2310
|
+
|
2191
2311
|
width = measureIsValid(opts.width) || measureIsValid(width) || WIDTH;
|
2192
2312
|
height = measureIsValid(opts.height) || measureIsValid(height) || HEIGHT;
|
2193
2313
|
that.resize({
|
2194
2314
|
width: width,
|
2195
2315
|
ratio: opts.ratio || ratio || width / height
|
2196
|
-
}, 0, index
|
2316
|
+
}, 0, index !== startIndex && '*');
|
2197
2317
|
}
|
2198
2318
|
}
|
2199
2319
|
|
@@ -2292,8 +2412,12 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2292
2412
|
|
2293
2413
|
if (type === 'stage') {
|
2294
2414
|
triggerTriggerEvent('load');
|
2415
|
+
} else if (dataFrame.thumbratio === AUTO || !dataFrame.thumbratio && opts.thumbratio === AUTO) {
|
2416
|
+
// danger! reflow for all thumbnails
|
2417
|
+
dataFrame.thumbratio = imgData.measures.ratio;
|
2418
|
+
reset();
|
2295
2419
|
}
|
2296
|
-
},
|
2420
|
+
}, 0);
|
2297
2421
|
}
|
2298
2422
|
|
2299
2423
|
if (!src) {
|
@@ -2344,7 +2468,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2344
2468
|
}
|
2345
2469
|
|
2346
2470
|
function updateFotoramaState () {
|
2347
|
-
var $frame =
|
2471
|
+
var $frame = activeFrame[STAGE_FRAME_KEY];
|
2348
2472
|
|
2349
2473
|
if ($frame && !$frame.data().state) {
|
2350
2474
|
spinnerSpin($frame);
|
@@ -2355,6 +2479,17 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2355
2479
|
}
|
2356
2480
|
}
|
2357
2481
|
|
2482
|
+
function addNavFrameEvents (frame) {
|
2483
|
+
addEnterUp(frame, onNavFrameClick);
|
2484
|
+
addFocus(frame, function () {
|
2485
|
+
|
2486
|
+
setTimeout(function () {
|
2487
|
+
lockScroll($nav);
|
2488
|
+
}, 0);
|
2489
|
+
slideNavShaft({time: o_transitionDuration, guessIndex: $(this).data().eq, minMax: navShaftTouchTail});
|
2490
|
+
});
|
2491
|
+
}
|
2492
|
+
|
2358
2493
|
function frameDraw (indexes, type) {
|
2359
2494
|
eachIndex(indexes, type, function (i, index, dataFrame, $frame, key, frameData) {
|
2360
2495
|
if ($frame) return;
|
@@ -2362,6 +2497,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2362
2497
|
$frame = dataFrame[key] = $wrap[key].clone();
|
2363
2498
|
frameData = $frame.data();
|
2364
2499
|
frameData.data = dataFrame;
|
2500
|
+
var frame = $frame[0];
|
2365
2501
|
|
2366
2502
|
if (type === 'stage') {
|
2367
2503
|
|
@@ -2376,18 +2512,26 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2376
2512
|
.appendTo($frame);
|
2377
2513
|
}
|
2378
2514
|
|
2379
|
-
|
2380
|
-
$(div(captionClass, div(captionWrapClass, dataFrame.caption))).appendTo($frame);
|
2381
|
-
}
|
2515
|
+
dataFrame.caption && $(div(captionClass, div(captionWrapClass, dataFrame.caption))).appendTo($frame);
|
2382
2516
|
|
2383
2517
|
dataFrame.video && $frame
|
2384
2518
|
.addClass(stageFrameVideoClass)
|
2385
2519
|
.append($videoPlay.clone());
|
2386
2520
|
|
2521
|
+
// This solves tabbing problems
|
2522
|
+
addFocus(frame, function () {
|
2523
|
+
setTimeout(function () {
|
2524
|
+
lockScroll($stage);
|
2525
|
+
}, 0);
|
2526
|
+
clickToShow({index: frameData.eq, user: true});
|
2527
|
+
});
|
2528
|
+
|
2387
2529
|
$stageFrame = $stageFrame.add($frame);
|
2388
2530
|
} else if (type === 'navDot') {
|
2531
|
+
addNavFrameEvents(frame);
|
2389
2532
|
$navDotFrame = $navDotFrame.add($frame);
|
2390
2533
|
} else if (type === 'navThumb') {
|
2534
|
+
addNavFrameEvents(frame);
|
2391
2535
|
frameData.$wrap = $frame.children(':first');
|
2392
2536
|
$navThumbFrame = $navThumbFrame.add($frame);
|
2393
2537
|
if (dataFrame.video) {
|
@@ -2405,7 +2549,10 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2405
2549
|
eachIndex(indexes, 'stage', function (i, index, dataFrame, $frame, key, frameData) {
|
2406
2550
|
if (!$frame) return;
|
2407
2551
|
|
2408
|
-
|
2552
|
+
var normalizedIndex = normalizeIndex(index);
|
2553
|
+
frameData.eq = normalizedIndex;
|
2554
|
+
|
2555
|
+
toDetach[STAGE_FRAME_KEY][normalizedIndex] = $frame.css($.extend({left: o_fade ? 0 : getPosByIndex(index, measures.w, opts.margin, repositionIndex)}, o_fade && getDuration(0)));
|
2409
2556
|
|
2410
2557
|
if (isDetached($frame[0])) {
|
2411
2558
|
$frame.appendTo($stageShaft);
|
@@ -2430,7 +2577,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2430
2577
|
thisData = $this.data(),
|
2431
2578
|
eq = thisData.eq,
|
2432
2579
|
specialMeasures = {h: o_thumbSide2},
|
2433
|
-
specialFit =
|
2580
|
+
specialFit = (data[eq] || {}).thumbfit || opts.thumbfit;
|
2434
2581
|
|
2435
2582
|
specialMeasures.w = thisData.w;
|
2436
2583
|
|
@@ -2496,14 +2643,14 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2496
2643
|
}
|
2497
2644
|
|
2498
2645
|
function arrsUpdate () {
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2646
|
+
var disablePrev = disableDirrection(0),
|
2647
|
+
disableNext = disableDirrection(1);
|
2648
|
+
$arrPrev
|
2649
|
+
.toggleClass(arrDisabledClass, disablePrev)
|
2650
|
+
.attr(disableAttr(disablePrev));
|
2651
|
+
$arrNext
|
2652
|
+
.toggleClass(arrDisabledClass, disableNext)
|
2653
|
+
.attr(disableAttr(disableNext));
|
2507
2654
|
}
|
2508
2655
|
|
2509
2656
|
function stageWheelUpdate () {
|
@@ -2533,23 +2680,23 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2533
2680
|
}
|
2534
2681
|
|
2535
2682
|
function slideThumbBorder (time) {
|
2536
|
-
var navFrameData =
|
2683
|
+
var navFrameData = activeFrame[navFrameKey].data();
|
2537
2684
|
slide($thumbBorder, {
|
2538
|
-
time: time * .
|
2685
|
+
time: time * 1.2,
|
2539
2686
|
pos: navFrameData.l,
|
2540
2687
|
width: navFrameData.w - opts.thumbborderwidth * 2
|
2541
2688
|
});
|
2542
2689
|
}
|
2543
2690
|
|
2544
2691
|
function slideNavShaft (options) {
|
2545
|
-
//console.log('slideNavShaft');
|
2692
|
+
//console.log('slideNavShaft', options.guessIndex, options.keep, slideNavShaft.l);
|
2546
2693
|
var $guessNavFrame = data[options.guessIndex][navFrameKey];
|
2547
2694
|
if ($guessNavFrame) {
|
2548
2695
|
var overflowFLAG = navShaftTouchTail.min !== navShaftTouchTail.max,
|
2549
|
-
|
2550
|
-
l = overflowFLAG && (options.keep && slideNavShaft.l ? slideNavShaft.l : minMaxLimit((options.coo || measures.nw / 2) - getNavFrameBounds($guessNavFrame).c,
|
2696
|
+
minMax = options.minMax || overflowFLAG && getNavFrameBounds(activeFrame[navFrameKey]),
|
2697
|
+
l = overflowFLAG && (options.keep && slideNavShaft.l ? slideNavShaft.l : minMaxLimit((options.coo || measures.nw / 2) - getNavFrameBounds($guessNavFrame).c, minMax.min, minMax.max)),
|
2551
2698
|
pos = overflowFLAG && minMaxLimit(l, navShaftTouchTail.min, navShaftTouchTail.max),
|
2552
|
-
time = options.time * .
|
2699
|
+
time = options.time * 1.1;
|
2553
2700
|
|
2554
2701
|
slide($navShaft, {
|
2555
2702
|
time: time,
|
@@ -2568,7 +2715,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2568
2715
|
|
2569
2716
|
function navUpdate () {
|
2570
2717
|
deactivateFrames(navFrameKey);
|
2571
|
-
toDeactivate[navFrameKey].push(
|
2718
|
+
toDeactivate[navFrameKey].push(activeFrame[navFrameKey].addClass(activeClass));
|
2572
2719
|
}
|
2573
2720
|
|
2574
2721
|
function deactivateFrames (key) {
|
@@ -2600,8 +2747,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2600
2747
|
|
2601
2748
|
repositionIndex = dirtyIndex = activeIndex;
|
2602
2749
|
|
2603
|
-
var
|
2604
|
-
$frame = dataFrame[STAGE_FRAME_KEY];
|
2750
|
+
var $frame = activeFrame[STAGE_FRAME_KEY];
|
2605
2751
|
|
2606
2752
|
if ($frame) {
|
2607
2753
|
deactivateFrames(STAGE_FRAME_KEY);
|
@@ -2617,24 +2763,21 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2617
2763
|
}
|
2618
2764
|
}
|
2619
2765
|
|
2620
|
-
function extendMeasures (options,
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
minheight: measures.minheight,
|
2636
|
-
maxheight: measures.maxheight,
|
2637
|
-
ratio: measures.ratio
|
2766
|
+
function extendMeasures (options, measuresArray) {
|
2767
|
+
if (!options) return;
|
2768
|
+
|
2769
|
+
$.each(measuresArray, function (i, measures) {
|
2770
|
+
if (!measures) return;
|
2771
|
+
|
2772
|
+
$.extend(measures, {
|
2773
|
+
width: options.width || measures.width,
|
2774
|
+
height: options.height,
|
2775
|
+
minwidth: options.minwidth,
|
2776
|
+
maxwidth: options.maxwidth,
|
2777
|
+
minheight: options.minheight,
|
2778
|
+
maxheight: options.maxheight,
|
2779
|
+
ratio: getRatio(options.ratio)
|
2780
|
+
})
|
2638
2781
|
});
|
2639
2782
|
}
|
2640
2783
|
|
@@ -2689,7 +2832,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2689
2832
|
var _activeIndex = activeIndex;
|
2690
2833
|
|
2691
2834
|
|
2692
|
-
var frameData =
|
2835
|
+
var frameData = activeFrame[STAGE_FRAME_KEY].data();
|
2693
2836
|
waitFor(function () {
|
2694
2837
|
return frameData.state || _activeIndex !== activeIndex;
|
2695
2838
|
}, function () {
|
@@ -2749,9 +2892,12 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2749
2892
|
|
2750
2893
|
if (options.slow) time *= 10;
|
2751
2894
|
|
2895
|
+
var _activeFrame = activeFrame;
|
2752
2896
|
that.activeFrame = activeFrame = data[activeIndex];
|
2753
2897
|
////console.timeEnd('that.show prepare');
|
2754
2898
|
|
2899
|
+
var silent = _activeFrame === activeFrame;
|
2900
|
+
|
2755
2901
|
//setTimeout(function () {
|
2756
2902
|
////console.time('unloadVideo');
|
2757
2903
|
unloadVideo($videoPlaying, activeFrame.i !== data[normalizeIndex(repositionIndex)].i);
|
@@ -2766,7 +2912,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2766
2912
|
updateTouchTails('go', true);
|
2767
2913
|
////console.timeEnd('updateTouchTails');
|
2768
2914
|
////console.time('triggerEvent');
|
2769
|
-
|
2915
|
+
|
2916
|
+
silent || triggerEvent('show', {
|
2770
2917
|
user: options.user,
|
2771
2918
|
time: time
|
2772
2919
|
});
|
@@ -2783,9 +2930,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2783
2930
|
|
2784
2931
|
skipReposition || stageShaftReposition(true);
|
2785
2932
|
|
2786
|
-
|
2787
|
-
|
2788
|
-
if (!options.reset) {
|
2933
|
+
if (!silent) {
|
2789
2934
|
triggerEvent('showend', {
|
2790
2935
|
user: options.user
|
2791
2936
|
});
|
@@ -2818,8 +2963,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2818
2963
|
pos: -getPosByIndex(dirtyIndex, measures.w, opts.margin, repositionIndex),
|
2819
2964
|
overPos: overPos,
|
2820
2965
|
time: time,
|
2821
|
-
onEnd: onEnd
|
2822
|
-
_001: true
|
2966
|
+
onEnd: onEnd/*,
|
2967
|
+
_001: true*/
|
2823
2968
|
});
|
2824
2969
|
////console.timeEnd('slide');
|
2825
2970
|
} else {
|
@@ -2844,7 +2989,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2844
2989
|
|
2845
2990
|
////console.time('slideNavShaft');
|
2846
2991
|
var guessIndex = limitIndex(activeIndex + minMaxLimit(dirtyIndex - lastActiveIndex, -1, 1));
|
2847
|
-
slideNavShaft({time: time, coo: guessIndex !== activeIndex && options.coo, guessIndex: typeof options.coo !== 'undefined' ? guessIndex : activeIndex, keep:
|
2992
|
+
slideNavShaft({time: time, coo: guessIndex !== activeIndex && options.coo, guessIndex: typeof options.coo !== 'undefined' ? guessIndex : activeIndex, keep: silent});
|
2848
2993
|
////console.timeEnd('slideNavShaft');
|
2849
2994
|
|
2850
2995
|
////console.time('slideThumbBorder');
|
@@ -2868,7 +3013,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2868
3013
|
scrollTop = $WINDOW.scrollTop();
|
2869
3014
|
scrollLeft = $WINDOW.scrollLeft();
|
2870
3015
|
|
2871
|
-
lockScroll(
|
3016
|
+
lockScroll($WINDOW);
|
2872
3017
|
|
2873
3018
|
updateTouchTails('x', true);
|
2874
3019
|
|
@@ -2922,7 +3067,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2922
3067
|
that.resize();
|
2923
3068
|
loadImg(activeIndexes, 'stage');
|
2924
3069
|
|
2925
|
-
lockScroll(scrollLeft, scrollTop);
|
3070
|
+
lockScroll($WINDOW, scrollLeft, scrollTop);
|
2926
3071
|
|
2927
3072
|
triggerEvent('fullscreenexit');
|
2928
3073
|
}
|
@@ -2938,22 +3083,25 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2938
3083
|
return this;
|
2939
3084
|
};
|
2940
3085
|
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
3086
|
+
that.toggleFullScreen = function () {
|
3087
|
+
return that[(that.fullScreen ? 'cancel' : 'request') + 'FullScreen']();
|
3088
|
+
};
|
3089
|
+
|
3090
|
+
addEvent(document, fullScreenApi.event, function () {
|
3091
|
+
if (data && !fullScreenApi.is() && !$videoPlaying) {
|
3092
|
+
cancelFullScreen();
|
3093
|
+
}
|
3094
|
+
});
|
2948
3095
|
|
2949
3096
|
that.resize = function (options) {
|
2950
3097
|
if (!data) return this;
|
2951
3098
|
|
2952
|
-
extendMeasures(!that.fullScreen ? optionsToLowerCase(options) : {width: '100%', maxwidth: null, minwidth: null, height: '100%', maxheight: null, minheight: null}, that.fullScreen);
|
2953
|
-
|
2954
3099
|
var time = arguments[1] || 0,
|
2955
|
-
setFLAG = arguments[2]
|
2956
|
-
|
3100
|
+
setFLAG = arguments[2];
|
3101
|
+
|
3102
|
+
extendMeasures(!that.fullScreen ? optionsToLowerCase(options) : {width: '100%', maxwidth: null, minwidth: null, height: '100%', maxheight: null, minheight: null}, [measures, setFLAG || that.fullScreen || opts]);
|
3103
|
+
|
3104
|
+
var width = measures.width,
|
2957
3105
|
height = measures.height,
|
2958
3106
|
ratio = measures.ratio,
|
2959
3107
|
windowHeight = $WINDOW.height() - (o_nav ? $nav.height() : 0);
|
@@ -2961,7 +3109,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
2961
3109
|
if (measureIsValid(width)) {
|
2962
3110
|
$wrap
|
2963
3111
|
.addClass(wrapOnlyActiveClass)
|
2964
|
-
.css({width: width, minWidth: measures.minwidth, maxWidth: measures.maxwidth});
|
3112
|
+
.css({width: width, minWidth: measures.minwidth || 0, maxWidth: measures.maxwidth || MAX_WIDTH});
|
2965
3113
|
|
2966
3114
|
width = measures.W = measures.w = $wrap.width();
|
2967
3115
|
measures.nw = o_nav && numberFromWhatever(opts.navwidth, width) || width;
|
@@ -3043,11 +3191,13 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3043
3191
|
activeIndexes = [];
|
3044
3192
|
detachFrames(STAGE_FRAME_KEY);
|
3045
3193
|
|
3194
|
+
reset.ok = false;
|
3195
|
+
|
3046
3196
|
return this;
|
3047
3197
|
};
|
3048
3198
|
|
3049
3199
|
that.playVideo = function () {
|
3050
|
-
var dataFrame =
|
3200
|
+
var dataFrame = activeFrame,
|
3051
3201
|
video = dataFrame.video,
|
3052
3202
|
_activeIndex = activeIndex;
|
3053
3203
|
|
@@ -3066,6 +3216,9 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3066
3216
|
|
3067
3217
|
stageNoMove();
|
3068
3218
|
|
3219
|
+
$arrs.blur();
|
3220
|
+
$fullscreenIcon.blur();
|
3221
|
+
|
3069
3222
|
triggerEvent('loadvideo');
|
3070
3223
|
}
|
3071
3224
|
});
|
@@ -3109,7 +3262,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3109
3262
|
pointerFLAG = x && !disableDirrection(getDirection(x)) && opts.click;
|
3110
3263
|
|
3111
3264
|
if (stageCursor.p !== pointerFLAG
|
3112
|
-
&& (o_fade || !opts.swipe)
|
3113
3265
|
&& $stage.toggleClass(pointerClass, pointerFLAG)) {
|
3114
3266
|
stageCursor.p = pointerFLAG;
|
3115
3267
|
stageCursor.x = x;
|
@@ -3143,7 +3295,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3143
3295
|
if ($target.hasClass(videoPlayClass)) {
|
3144
3296
|
that.playVideo();
|
3145
3297
|
} else if (target === fullscreenIcon) {
|
3146
|
-
that
|
3298
|
+
that.toggleFullScreen();
|
3147
3299
|
} else if ($videoPlaying) {
|
3148
3300
|
target === videoClose && unloadVideo($videoPlaying, true, true);
|
3149
3301
|
} else {
|
@@ -3173,7 +3325,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3173
3325
|
|
3174
3326
|
////console.log('result', result);
|
3175
3327
|
|
3176
|
-
var toggleControlsFLAG = (MS_POINTER && !hoverFLAG || result.touch) && opts.arrows;
|
3328
|
+
var toggleControlsFLAG = (MS_POINTER && !hoverFLAG || result.touch) && opts.arrows && opts.arrows !== 'always';
|
3177
3329
|
|
3178
3330
|
if (result.moved || (toggleControlsFLAG && result.pos !== result.newPos && !result.control)) {
|
3179
3331
|
var index = getIndexByPos(result.newPos, measures.w, opts.margin, repositionIndex);
|
@@ -3191,7 +3343,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3191
3343
|
// getPos: function () {
|
3192
3344
|
// return -getPosByIndex(dirtyIndex, measures.w, opts.margin, repositionIndex);
|
3193
3345
|
// },
|
3194
|
-
_001: true,
|
3346
|
+
//_001: true,
|
3195
3347
|
timeLow: 1,
|
3196
3348
|
timeHigh: 1,
|
3197
3349
|
friction: 2,
|
@@ -3258,6 +3410,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3258
3410
|
navWheelTail.prevent = {'<': newPos >= navShaftTouchTail.max, '>': newPos <= navShaftTouchTail.min};
|
3259
3411
|
clearTimeout(navWheelTail.t);
|
3260
3412
|
navWheelTail.t = setTimeout(function () {
|
3413
|
+
slideNavShaft.l = newPos;
|
3261
3414
|
thumbsDraw(newPos, true)
|
3262
3415
|
}, TOUCH_TIMEOUT);
|
3263
3416
|
thumbsDraw(newPos);
|
@@ -3268,24 +3421,26 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3268
3421
|
function () {
|
3269
3422
|
setTimeout(function () {
|
3270
3423
|
if (touchedFLAG) return;
|
3271
|
-
hoverFLAG = true;
|
3272
|
-
toggleControlsClass(!hoverFLAG);
|
3424
|
+
toggleControlsClass(!(hoverFLAG = true));
|
3273
3425
|
}, 0);
|
3274
3426
|
}, function () {
|
3275
3427
|
if (!hoverFLAG) return;
|
3276
|
-
hoverFLAG = false;
|
3277
|
-
toggleControlsClass(!hoverFLAG);
|
3428
|
+
toggleControlsClass(!(hoverFLAG = false));
|
3278
3429
|
}
|
3279
3430
|
);
|
3280
3431
|
|
3281
|
-
function onNavFrameClick (e
|
3432
|
+
function onNavFrameClick (e) {
|
3282
3433
|
var index = $(this).data().eq;
|
3283
|
-
clickToShow({index: index, slow: e.altKey, user: true, coo: e._x - $nav.offset().left
|
3434
|
+
clickToShow({index: index, slow: e.altKey, user: true, coo: e._x - $nav.offset().left});
|
3435
|
+
}
|
3436
|
+
|
3437
|
+
function onArrClick (e) {
|
3438
|
+
clickToShow({index: $arrs.index(this) ? '>' : '<', slow: e.altKey, user: true});
|
3284
3439
|
}
|
3285
3440
|
|
3286
3441
|
smartClick($arrs, function (e) {
|
3287
3442
|
stopEvent(e);
|
3288
|
-
|
3443
|
+
onArrClick.call(this, e);
|
3289
3444
|
}, {
|
3290
3445
|
onStart: function () {
|
3291
3446
|
onTouchStart();
|
@@ -3294,7 +3449,29 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3294
3449
|
onTouchEnd: onTouchEnd
|
3295
3450
|
});
|
3296
3451
|
|
3452
|
+
function addFocusOnControls (el) {
|
3453
|
+
addFocus(el, function () {
|
3454
|
+
lockScroll($stage);
|
3455
|
+
setTimeout(function () {
|
3456
|
+
lockScroll($stage);
|
3457
|
+
}, 0);
|
3458
|
+
toggleControlsClass(false);
|
3459
|
+
});
|
3460
|
+
}
|
3461
|
+
|
3462
|
+
$arrs.each(function () {
|
3463
|
+
addEnterUp(this, function (e) {
|
3464
|
+
onArrClick.call(this, e);
|
3465
|
+
});
|
3466
|
+
addFocusOnControls(this);
|
3467
|
+
});
|
3468
|
+
|
3469
|
+
addEnterUp(fullscreenIcon, that.toggleFullScreen);
|
3470
|
+
addFocusOnControls(fullscreenIcon);
|
3471
|
+
|
3297
3472
|
function reset () {
|
3473
|
+
var ok = reset.ok;
|
3474
|
+
|
3298
3475
|
setData();
|
3299
3476
|
setOptions();
|
3300
3477
|
|
@@ -3305,7 +3482,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3305
3482
|
if (_startindex || opts.hash && location.hash) {
|
3306
3483
|
startIndex = getIndexFromHash(_startindex || location.hash.replace(/^#/, ''), data, that.index === 0 || _startindex, _startindex);
|
3307
3484
|
}
|
3308
|
-
activeIndex = repositionIndex = dirtyIndex = lastActiveIndex = startIndex = edgeIndex(startIndex) || 0;/*(o_rtl ? size - 1 : 0)
|
3485
|
+
activeIndex = repositionIndex = dirtyIndex = lastActiveIndex = startIndex = edgeIndex(startIndex) || 0;/*(o_rtl ? size - 1 : 0)*///;
|
3309
3486
|
}
|
3310
3487
|
|
3311
3488
|
if (size) {
|
@@ -3318,13 +3495,13 @@ jQuery.Fotorama = function ($fotorama, opts) {
|
|
3318
3495
|
activeIndexes = [];
|
3319
3496
|
detachFrames(STAGE_FRAME_KEY);
|
3320
3497
|
|
3321
|
-
|
3498
|
+
reset.ok = true;
|
3499
|
+
|
3500
|
+
that.show({index: activeIndex, time: 0});
|
3322
3501
|
that.resize();
|
3323
3502
|
} else {
|
3324
3503
|
that.destroy();
|
3325
3504
|
}
|
3326
|
-
|
3327
|
-
reset.ok = true;
|
3328
3505
|
}
|
3329
3506
|
|
3330
3507
|
function changeToRtl () {
|
@@ -3382,61 +3559,7 @@ $.fn.fotorama = function (opts) {
|
|
3382
3559
|
* 3. Defaults */
|
3383
3560
|
$.extend(
|
3384
3561
|
{},
|
3385
|
-
|
3386
|
-
// dimensions
|
3387
|
-
width: null, // 500 || '100%'
|
3388
|
-
minwidth: null,
|
3389
|
-
maxwidth: '100%', // '100%'
|
3390
|
-
height: null,
|
3391
|
-
minheight: null,
|
3392
|
-
maxheight: null,
|
3393
|
-
|
3394
|
-
ratio: null, // '16/9' || 500/333 || 1.5
|
3395
|
-
|
3396
|
-
margin: MARGIN,
|
3397
|
-
glimpse: 0,
|
3398
|
-
|
3399
|
-
// navigation, thumbs
|
3400
|
-
nav: 'dots', // 'thumbs' || false
|
3401
|
-
navposition: 'bottom', // 'top'
|
3402
|
-
navwidth: null,
|
3403
|
-
thumbwidth: THUMB_SIZE,
|
3404
|
-
thumbheight: THUMB_SIZE,
|
3405
|
-
thumbmargin: MARGIN,
|
3406
|
-
thumbborderwidth: MARGIN,
|
3407
|
-
|
3408
|
-
allowfullscreen: false, // true || 'native'
|
3409
|
-
|
3410
|
-
fit: 'contain', // 'cover' || 'scaledown' || 'none'
|
3411
|
-
|
3412
|
-
transition: 'slide', // 'crossfade' || 'dissolve'
|
3413
|
-
clicktransition: null,
|
3414
|
-
transitionduration: TRANSITION_DURATION,
|
3415
|
-
|
3416
|
-
captions: true,
|
3417
|
-
|
3418
|
-
hash: false,
|
3419
|
-
startindex: 0,
|
3420
|
-
|
3421
|
-
loop: false,
|
3422
|
-
|
3423
|
-
autoplay: false,
|
3424
|
-
stopautoplayontouch: true,
|
3425
|
-
|
3426
|
-
keyboard: false,
|
3427
|
-
|
3428
|
-
arrows: true,
|
3429
|
-
click: true,
|
3430
|
-
swipe: true,
|
3431
|
-
trackpad: true,
|
3432
|
-
|
3433
|
-
shuffle: false,
|
3434
|
-
|
3435
|
-
direction: 'ltr', // 'rtl'
|
3436
|
-
|
3437
|
-
shadows: true,
|
3438
|
-
spinner: null
|
3439
|
-
},
|
3562
|
+
OPTIONS,
|
3440
3563
|
window.fotoramaDefaults,
|
3441
3564
|
opts,
|
3442
3565
|
fotoramaData
|
@@ -3444,7 +3567,7 @@ $.fn.fotorama = function (opts) {
|
|
3444
3567
|
);
|
3445
3568
|
});
|
3446
3569
|
} else {
|
3447
|
-
fotorama.setOptions(opts);
|
3570
|
+
fotorama.setOptions(opts, true);
|
3448
3571
|
}
|
3449
3572
|
});
|
3450
3573
|
};
|
@@ -3495,8 +3618,8 @@ $.Fotorama.jst.video = function(v) {
|
|
3495
3618
|
var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
|
3496
3619
|
function print() { __p += __j.call(arguments, '') }
|
3497
3620
|
__p += '<div class="fotorama__video"><iframe src="';
|
3498
|
-
print((v.type == 'youtube' ? '
|
3499
|
-
__p += '" frameborder="0" allowfullscreen></iframe></div
|
3621
|
+
print((v.type == 'youtube' ? v.p + 'youtube.com/embed/' + v.id +'?autoplay=1' : v.type == 'vimeo' ? v.p + 'player.vimeo.com/video/' + v.id + '?autoplay=1&badge=0' : v.id) + (v.s && v.type != 'custom' ? '&' + v.s : '')) ;
|
3622
|
+
__p += '" frameborder="0" allowfullscreen></iframe></div>\n';
|
3500
3623
|
return __p
|
3501
3624
|
};
|
3502
3625
|
$(function () {
|