fotoramajs 4.3.4.1 → 4.4.1

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fotoramajs (4.3.4.1)
4
+ fotoramajs (4.4.1)
5
5
  jquery-rails (>= 2.1.0)
6
6
  sprockets (>= 2)
7
7
 
@@ -1,3 +1,3 @@
1
1
  module Fotoramajs
2
- VERSION = "4.3.4.1"
2
+ VERSION = "4.4.1"
3
3
  end
@@ -1,8 +1,94 @@
1
1
  /*!
2
- * Fotorama 4.3.4.1 | http://fotorama.io/license/
2
+ * Fotorama 4.4.1 | http://fotorama.io/license/
3
3
  */
4
4
  (function (window, document, location, $, undefined) {
5
5
  "use strict";
6
+ var _fotoramaClass = 'fotorama',
7
+ _fullscreenClass = 'fullscreen',
8
+
9
+ wrapClass = _fotoramaClass + '__wrap',
10
+ wrapCss3Class = wrapClass + '--css3',
11
+ wrapVideoClass = wrapClass + '--video',
12
+ wrapFadeClass = wrapClass + '--fade',
13
+ wrapSlideClass = wrapClass + '--slide',
14
+ wrapNoControlsClass = wrapClass + '--no-controls',
15
+ wrapNoShadowsClass = wrapClass + '--no-shadows',
16
+ wrapPanYClass = wrapClass + '--pan-y',
17
+ wrapRtlClass = wrapClass + '--rtl',
18
+
19
+ stageClass = _fotoramaClass + '__stage',
20
+ stageFrameClass = stageClass + '__frame',
21
+ stageFrameVideoClass = stageFrameClass + '--video',
22
+ stageShaftClass = stageClass + '__shaft',
23
+ stageOnlyActiveClass = stageClass + '--only-active',
24
+
25
+ grabClass = _fotoramaClass + '__grab',
26
+ pointerClass = _fotoramaClass + '__pointer',
27
+
28
+ arrClass = _fotoramaClass + '__arr',
29
+ arrDisabledClass = arrClass + '--disabled',
30
+ arrPrevClass = arrClass + '--prev',
31
+ arrNextClass = arrClass + '--next',
32
+ arrArrClass = arrClass + '__arr',
33
+
34
+ navClass = _fotoramaClass + '__nav',
35
+ navWrapClass = navClass + '-wrap',
36
+ navShaftClass = navClass + '__shaft',
37
+ navDotsClass = navClass + '--dots',
38
+ navThumbsClass = navClass + '--thumbs',
39
+ navFrameClass = navClass + '__frame',
40
+ navFrameDotClass = navFrameClass + '--dot',
41
+ navFrameThumbClass = navFrameClass + '--thumb',
42
+
43
+ fadeClass = _fotoramaClass + '__fade',
44
+ fadeFrontClass = fadeClass + '-front',
45
+ fadeRearClass = fadeClass + '-rear',
46
+
47
+ shadowClass = _fotoramaClass + '__shadow',
48
+ shadowsClass = shadowClass + 's',
49
+ shadowsLeftClass = shadowsClass + '--left',
50
+ shadowsRightClass = shadowsClass + '--right',
51
+
52
+ activeClass = _fotoramaClass + '__active',
53
+ selectClass = _fotoramaClass + '__select',
54
+
55
+ hiddenClass = _fotoramaClass + '--hidden',
56
+
57
+ fullscreenClass = _fotoramaClass + '--fullscreen',
58
+ fullscreenIconClass = _fotoramaClass + '__fullscreen-icon',
59
+
60
+ errorClass = _fotoramaClass + '__error',
61
+ loadingClass = _fotoramaClass + '__loading',
62
+ loadedClass = _fotoramaClass + '__loaded',
63
+ loadedFullClass = loadedClass + '--full',
64
+ loadedImgClass = loadedClass + '--img',
65
+
66
+ grabbingClass = _fotoramaClass + '__grabbing',
67
+
68
+ imgClass = _fotoramaClass + '__img',
69
+ imgFullClass = imgClass + '--full',
70
+
71
+ dotClass = _fotoramaClass + '__dot',
72
+ thumbClass = _fotoramaClass + '__thumb',
73
+ thumbBorderClass = thumbClass + '-border',
74
+
75
+ htmlClass = _fotoramaClass + '__html',
76
+
77
+ videoClass = _fotoramaClass + '__video',
78
+ videoPlayClass = videoClass + '-play',
79
+ videoCloseClass = videoClass + '-close',
80
+
81
+ captionClass = _fotoramaClass + '__caption',
82
+
83
+ ooooClass = _fotoramaClass + '__oooo';
84
+ var JQUERY_VERSION = $ && $.fn.jquery.split('.');
85
+
86
+ if (!JQUERY_VERSION
87
+ || JQUERY_VERSION[0] < 1
88
+ || (JQUERY_VERSION[0] == 1 && JQUERY_VERSION[1] < 8)) {
89
+ window.console && console['error']('Fotorama requires jQuery 1.8 or later and will not run without it.');
90
+ return;
91
+ }
6
92
  // My Underscore :-)
7
93
  var _ = {};
8
94
  /* Modernizr 2.6.2 (Custom Build) | MIT & BSD
@@ -368,83 +454,6 @@ function bez (coOrdArray) {
368
454
  }
369
455
  return encodedFuncName;
370
456
  }
371
- var _fotoramaClass = 'fotorama',
372
- _fullscreenClass = 'fullscreen',
373
-
374
- wrapClass = _fotoramaClass + '__wrap',
375
- wrapCss3Class = wrapClass + '--css3',
376
- wrapVideoClass = wrapClass + '--video',
377
- wrapFadeClass = wrapClass + '--fade',
378
- wrapSlideClass = wrapClass + '--slide',
379
- wrapNoControlsClass = wrapClass + '--no-controls',
380
- wrapNoShadowsClass = wrapClass + '--no-shadows',
381
- wrapPanYClass = wrapClass + '--pan-y',
382
-
383
- stageClass = _fotoramaClass + '__stage',
384
- stageFrameClass = stageClass + '__frame',
385
- stageFrameVideoClass = stageFrameClass + '--video',
386
- stageShaftClass = stageClass + '__shaft',
387
- stageOnlyActiveClass = stageClass + '--only-active',
388
-
389
- grabClass = _fotoramaClass + '__grab',
390
- pointerClass = _fotoramaClass + '__pointer',
391
-
392
- arrClass = _fotoramaClass + '__arr',
393
- arrDisabledClass = arrClass + '--disabled',
394
- arrPrevClass = arrClass + '--prev',
395
- arrNextClass = arrClass + '--next',
396
- arrArrClass = arrClass + '__arr',
397
-
398
- navClass = _fotoramaClass + '__nav',
399
- navWrapClass = navClass + '-wrap',
400
- navShaftClass = navClass + '__shaft',
401
- navDotsClass = navClass + '--dots',
402
- navThumbsClass = navClass + '--thumbs',
403
- navFrameClass = navClass + '__frame',
404
- navFrameDotClass = navFrameClass + '--dot',
405
- navFrameThumbClass = navFrameClass + '--thumb',
406
-
407
- fadeClass = _fotoramaClass + '__fade',
408
- fadeFrontClass = fadeClass + '-front',
409
- fadeRearClass = fadeClass + '-rear',
410
-
411
- shadowClass = _fotoramaClass + '__shadow',
412
- shadowsClass = shadowClass + 's',
413
- shadowsLeftClass = shadowsClass + '--left',
414
- shadowsRightClass = shadowsClass + '--right',
415
-
416
- activeClass = _fotoramaClass + '__active',
417
- selectClass = _fotoramaClass + '__select',
418
-
419
- hiddenClass = _fotoramaClass + '--hidden',
420
-
421
- fullscreenClass = _fotoramaClass + '--fullscreen',
422
- fullscreenIconClass = _fotoramaClass + '__fullscreen-icon',
423
-
424
- errorClass = _fotoramaClass + '__error',
425
- loadingClass = _fotoramaClass + '__loading',
426
- loadedClass = _fotoramaClass + '__loaded',
427
- loadedFullClass = loadedClass + '--full',
428
- loadedImgClass = loadedClass + '--img',
429
-
430
- grabbingClass = _fotoramaClass + '__grabbing',
431
-
432
- imgClass = _fotoramaClass + '__img',
433
- imgFullClass = imgClass + '--full',
434
-
435
- dotClass = _fotoramaClass + '__dot',
436
- thumbClass = _fotoramaClass + '__thumb',
437
- thumbBorderClass = thumbClass + '-border',
438
-
439
- htmlClass = _fotoramaClass + '__html',
440
-
441
- videoClass = _fotoramaClass + '__video',
442
- videoPlayClass = videoClass + '-play',
443
- videoCloseClass = videoClass + '-close',
444
-
445
- captionClass = _fotoramaClass + '__caption',
446
-
447
- ooooClass = _fotoramaClass + '__oooo';
448
457
  var $WINDOW = $(window),
449
458
  $DOCUMENT = $(document),
450
459
  $HTML,
@@ -459,10 +468,17 @@ var $WINDOW = $(window),
459
468
  MOBILE = navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i),
460
469
  SLOW = !CSS3 || MOBILE,
461
470
 
471
+ ADD_EVENT_LISTENER = 'addEventListener',
472
+
462
473
  MS_POINTER = window.navigator.msPointerEnabled,
463
474
 
475
+ WHEEL = "onwheel" in document.createElement("div") ? "wheel" : document.onmousewheel !== undefined ? "mousewheel" : "DOMMouseScroll",
476
+
464
477
  TOUCH_TIMEOUT = 250,
465
478
  TRANSITION_DURATION = 300,
479
+
480
+ SCROLL_LOCK_TIMEOUT = 1400,
481
+
466
482
  AUTOPLAY_INTERVAL = 5000,
467
483
  MARGIN = 2,
468
484
  THUMB_SIZE = 64,
@@ -470,7 +486,6 @@ var $WINDOW = $(window),
470
486
  WIDTH = 500,
471
487
  HEIGHT = 333,
472
488
 
473
-
474
489
  STAGE_FRAME_KEY = '$stageFrame',
475
490
  NAV_DOT_FRAME_KEY = '$navDotFrame',
476
491
  NAV_THUMB_FRAME_KEY = '$navThumbFrame',
@@ -647,7 +662,7 @@ function findVideoId (href, forceVideo) {
647
662
  type = 'custom';
648
663
  }
649
664
 
650
- return id ? {id: id, type: type} : false;
665
+ return id ? {id: id, type: type, s: href.search.replace(/^\?/, '')} : false;
651
666
  }
652
667
 
653
668
  function getVideoThumbs (dataFrame, data, fotorama) {
@@ -939,6 +954,15 @@ function getRatio (_ratio) {
939
954
  return +ratio[0] / +ratio[1] || undefined;
940
955
  }
941
956
  }
957
+
958
+ function stopEvent (e, stopPropagation) {
959
+ e.preventDefault();
960
+ stopPropagation && e.stopPropagation();
961
+ }
962
+
963
+ function getDirectionSign (forward) {
964
+ return forward ? '>' : '<';
965
+ }
942
966
  function slide ($el, options) {
943
967
  var elPos = Math.round(options.pos),
944
968
  onEndFn = options.onEnd || noop;
@@ -1007,8 +1031,7 @@ function fade ($el1, $el2, $frames, options, fadeStack, chain) {
1007
1031
  var lastEvent,
1008
1032
  moveEventType,
1009
1033
  preventEvent,
1010
- preventEventTimeout,
1011
- addEventListener = 'addEventListener';
1034
+ preventEventTimeout;
1012
1035
 
1013
1036
  function extendEvent (e) {
1014
1037
  var touch = (e.touches || [])[0] || e;
@@ -1018,7 +1041,6 @@ function extendEvent (e) {
1018
1041
 
1019
1042
  function touch ($el, options) {
1020
1043
  var el = $el[0],
1021
- docTouchTimeout,
1022
1044
  tail = {},
1023
1045
  touchEnabledFLAG,
1024
1046
  startEvent,
@@ -1052,9 +1074,7 @@ function touch ($el, options) {
1052
1074
 
1053
1075
  touchEnabledFLAG = tail.flow = true;
1054
1076
 
1055
- if (!touchFLAG || tail.go) {
1056
- e.preventDefault();
1057
- }
1077
+ if (!touchFLAG || tail.go) stopEvent(e);
1058
1078
  }
1059
1079
 
1060
1080
  function onMove (e) {
@@ -1076,11 +1096,11 @@ function touch ($el, options) {
1076
1096
 
1077
1097
  if (touchFLAG && !tail.checked) {
1078
1098
  if (touchEnabledFLAG = xWin) {
1079
- e.preventDefault();
1099
+ stopEvent(e);
1080
1100
  }
1081
1101
  } else {
1082
1102
  //console.log('onMove e.preventDefault');
1083
- e.preventDefault();
1103
+ stopEvent(e);
1084
1104
  (options.onMove || noop).call(el, e, {touch: touchFLAG});
1085
1105
  }
1086
1106
 
@@ -1097,7 +1117,7 @@ function touch ($el, options) {
1097
1117
 
1098
1118
  if (!_touchEnabledFLAG || (targetIsLinkFlag && !tail.checked)) return;
1099
1119
 
1100
- e && e.preventDefault();
1120
+ e && stopEvent(e);
1101
1121
 
1102
1122
  preventEvent = true;
1103
1123
  clearTimeout(preventEventTimeout);
@@ -1109,35 +1129,33 @@ function touch ($el, options) {
1109
1129
 
1110
1130
  function onOtherStart () {
1111
1131
  if (tail.flow) return;
1112
- clearTimeout(docTouchTimeout);
1113
- docTouchTimeout = setTimeout(function () {
1132
+ setTimeout(function () {
1114
1133
  tail.flow = true;
1115
1134
  }, 10);
1116
1135
  }
1117
1136
 
1118
1137
  function onOtherEnd () {
1119
1138
  if (!tail.flow) return;
1120
- clearTimeout(docTouchTimeout);
1121
- docTouchTimeout = setTimeout(function () {
1139
+ setTimeout(function () {
1122
1140
  tail.flow = false;
1123
1141
  }, TOUCH_TIMEOUT);
1124
1142
  }
1125
1143
 
1126
1144
  if (MS_POINTER) {
1127
- el[addEventListener]('MSPointerDown', onStart, false);
1128
- document[addEventListener]('MSPointerMove', onMove, false);
1129
- document[addEventListener]('MSPointerCancel', onEnd, false);
1130
- document[addEventListener]('MSPointerUp', onEnd, false);
1145
+ el[ADD_EVENT_LISTENER]('MSPointerDown', onStart, false);
1146
+ document[ADD_EVENT_LISTENER]('MSPointerMove', onMove, false);
1147
+ document[ADD_EVENT_LISTENER]('MSPointerCancel', onEnd, false);
1148
+ document[ADD_EVENT_LISTENER]('MSPointerUp', onEnd, false);
1131
1149
  } else {
1132
- if (el[addEventListener]) {
1133
- el[addEventListener]('touchstart', onStart, false);
1134
- el[addEventListener]('touchmove', onMove, false);
1135
- el[addEventListener]('touchend', onEnd, false);
1150
+ if (el[ADD_EVENT_LISTENER]) {
1151
+ el[ADD_EVENT_LISTENER]('touchstart', onStart, false);
1152
+ el[ADD_EVENT_LISTENER]('touchmove', onMove, false);
1153
+ el[ADD_EVENT_LISTENER]('touchend', onEnd, false);
1136
1154
 
1137
- document[addEventListener]('touchstart', onOtherStart, false);
1138
- document[addEventListener]('touchend', onOtherEnd, false);
1139
- document[addEventListener]('touchcancel', onOtherEnd, false);
1140
- window[addEventListener]('scroll', onOtherEnd, false);
1155
+ document[ADD_EVENT_LISTENER]('touchstart', onOtherStart, false);
1156
+ document[ADD_EVENT_LISTENER]('touchend', onOtherEnd, false);
1157
+ document[ADD_EVENT_LISTENER]('touchcancel', onOtherEnd, false);
1158
+ window[ADD_EVENT_LISTENER]('scroll', onOtherEnd, false);
1141
1159
  }
1142
1160
 
1143
1161
  $el.on('mousedown', onStart);
@@ -1147,7 +1165,7 @@ function touch ($el, options) {
1147
1165
  }
1148
1166
 
1149
1167
  $el.on('click', 'a', function (e) {
1150
- tail.checked && e.preventDefault();
1168
+ tail.checked && stopEvent(e);
1151
1169
  });
1152
1170
 
1153
1171
  return tail;
@@ -1304,7 +1322,7 @@ function moveOnTouch ($el, options) {
1304
1322
 
1305
1323
  time *= slowFLAG ? 10 : 1;
1306
1324
 
1307
- (options.onEnd || noop).call(el, $.extend(result, {pos: moveElPos, newPos: newPos, overPos: overPos, time: time, moved: (longTouchFLAG && snap) || result.moved}));
1325
+ (options.onEnd || noop).call(el, $.extend(result, {pos: moveElPos, newPos: newPos, overPos: overPos, time: time, moved: longTouchFLAG ? snap : Math.abs(moveElPos - startElPos) > 3}));
1308
1326
  }
1309
1327
 
1310
1328
  tail = $.extend(touch(options.$wrap, {
@@ -1317,6 +1335,49 @@ function moveOnTouch ($el, options) {
1317
1335
 
1318
1336
  return tail;
1319
1337
  }
1338
+ function wheel ($el, options) {
1339
+ var el = $el[0],
1340
+ lockFLAG,
1341
+ lastDirection,
1342
+ /*unlockTimestamp,*/
1343
+ tail = {
1344
+ prevent: {}
1345
+ };
1346
+
1347
+ el[ADD_EVENT_LISTENER] && el[ADD_EVENT_LISTENER](WHEEL, function (e) {
1348
+ var yDelta = e.wheelDeltaY || -1 * e.deltaY || 0,
1349
+ xDelta = e.wheelDeltaX || -1 * e.deltaX || 0,
1350
+ xWin = Math.abs(xDelta) > Math.abs(yDelta),
1351
+ direction = getDirectionSign(xDelta < 0),
1352
+ sameDirection = lastDirection === direction;
1353
+
1354
+ //console.log('direction', direction);
1355
+ //console.log('lastDirection', lastDirection);
1356
+
1357
+ lastDirection = direction;
1358
+
1359
+ if (!xWin || !tail.ok || tail.prevent[direction] && !lockFLAG) {
1360
+ return;
1361
+ } else {
1362
+ stopEvent(e, true);
1363
+ if (lockFLAG && sameDirection /*|| $.now() - unlockTimestamp < TOUCH_TIMEOUT / 2*/) return;
1364
+ }
1365
+
1366
+ if (options.shift) {
1367
+ lockFLAG = true;
1368
+ clearTimeout(tail.t);
1369
+ tail.t = setTimeout(function () {
1370
+ //unlockTimestamp = $.now();
1371
+ lockFLAG = false;
1372
+ }, SCROLL_LOCK_TIMEOUT);
1373
+ }
1374
+
1375
+ (options.onEnd || noop)(e, options.shift ? direction : xDelta);
1376
+
1377
+ }, false);
1378
+
1379
+ return tail;
1380
+ }
1320
1381
 
1321
1382
 
1322
1383
  jQuery.Fotorama = function ($fotorama, opts) {
@@ -1385,13 +1446,16 @@ jQuery.Fotorama = function ($fotorama, opts) {
1385
1446
  o_thumbSide2,
1386
1447
  o_transitionDuration,
1387
1448
  o_shadows,
1449
+ o_rtl,
1388
1450
  lastOptions = {},
1389
1451
 
1390
1452
  measures = {},
1391
1453
  measuresSetFLAG,
1392
1454
 
1393
1455
  stageShaftTouchTail = {},
1456
+ stageWheelTail = {},
1394
1457
  navShaftTouchTail = {},
1458
+ navWheelTail = {},
1395
1459
 
1396
1460
  scrollTop,
1397
1461
  scrollLeft,
@@ -1459,17 +1523,17 @@ jQuery.Fotorama = function ($fotorama, opts) {
1459
1523
  $DOCUMENT
1460
1524
  .on(keydownLocal, function (e) {
1461
1525
  if ($videoPlaying && e.keyCode === 27) {
1462
- e.preventDefault();
1526
+ stopEvent(e);
1463
1527
  unloadVideo($videoPlaying, true, true);
1464
1528
  } else if (that.fullScreen || (opts.keyboard && !that.index)) {
1465
1529
  if (e.keyCode === 27) {
1466
- e.preventDefault();
1530
+ stopEvent(e);
1467
1531
  that.cancelFullScreen();
1468
1532
  } else if (e.keyCode === 39 || (e.keyCode === 40 && that.fullScreen)) {
1469
- e.preventDefault();
1533
+ stopEvent(e);
1470
1534
  that.show({index: '>', slow: e.altKey, direct: true});
1471
1535
  } else if (e.keyCode === 37 || (e.keyCode === 38 && that.fullScreen)) {
1472
- e.preventDefault();
1536
+ stopEvent(e);
1473
1537
  that.show({index: '<', slow: e.altKey, direct: true});
1474
1538
  }
1475
1539
  }
@@ -1560,6 +1624,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
1560
1624
 
1561
1625
  o_transitionDuration = +opts.transitionduration || TRANSITION_DURATION;
1562
1626
 
1627
+ o_rtl = opts.direction === 'rtl';
1628
+
1563
1629
  var classes = {add: [], remove: []};
1564
1630
 
1565
1631
  if (size > 1) {
@@ -1568,23 +1634,26 @@ jQuery.Fotorama = function ($fotorama, opts) {
1568
1634
  classes.remove.push(selectClass);
1569
1635
 
1570
1636
  $arrs.toggle(opts.arrows);
1571
-
1572
- arrsUpdate();
1573
1637
  } else {
1574
1638
  o_nav = false;
1575
1639
  $arrs.hide();
1576
1640
  }
1577
1641
 
1642
+ arrsUpdate();
1643
+ stageWheelUpdate();
1644
+
1578
1645
  if (opts.autoplay) setAutoplayInterval(opts.autoplay);
1579
1646
 
1580
1647
  o_thumbSide = numberFromMeasure(opts.thumbwidth) || THUMB_SIZE;
1581
1648
  o_thumbSide2 = numberFromMeasure(opts.thumbheight) || THUMB_SIZE;
1582
1649
 
1650
+ stageWheelTail.ok = navWheelTail.ok = opts.trackpad && !SLOW;
1651
+
1583
1652
  stageNoMove();
1584
1653
 
1585
1654
  extendMeasures(opts, true);
1586
1655
 
1587
- o_navThumbs = o_nav === 'thumbs'
1656
+ o_navThumbs = o_nav === 'thumbs';
1588
1657
 
1589
1658
  if (o_navThumbs) {
1590
1659
  frameDraw(size, 'navThumb');
@@ -1592,7 +1661,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
1592
1661
  $navFrame = $navThumbFrame;
1593
1662
  navFrameKey = NAV_THUMB_FRAME_KEY;
1594
1663
 
1595
- setStyle($style, $.Fotorama.jst.style({w: o_thumbSide, h: o_thumbSide2, m: MARGIN, s: stamp, q: !COMPAT}));
1664
+ setStyle($style, $.Fotorama.jst.style({w: o_thumbSide, h: o_thumbSide2, b: opts.thumbborderwidth, m: opts.thumbmargin, s: stamp, q: !COMPAT}));
1596
1665
 
1597
1666
  $nav
1598
1667
  .addClass(navThumbsClass)
@@ -1634,11 +1703,16 @@ jQuery.Fotorama = function ($fotorama, opts) {
1634
1703
  classes[addOrRemove(o_fade)].push(wrapFadeClass);
1635
1704
  classes[addOrRemove(!o_fade)].push(wrapSlideClass);
1636
1705
 
1706
+ classes[addOrRemove(o_rtl)].push(wrapRtlClass);
1707
+
1637
1708
  o_shadows = opts.shadows && !SLOW;
1638
1709
  classes[addOrRemove(!o_shadows)].push(wrapNoShadowsClass);
1639
1710
 
1640
1711
  ooooStop();
1641
1712
 
1713
+ // Glimpse
1714
+ $stageShaft.css({left: opts.glimpse, right: opts.glimpse, width: 'auto'});
1715
+
1642
1716
  $wrap
1643
1717
  .addClass(classes.add.join(' '))
1644
1718
  .removeClass(classes.remove.join(' '));
@@ -1667,13 +1741,13 @@ jQuery.Fotorama = function ($fotorama, opts) {
1667
1741
  }
1668
1742
 
1669
1743
  function setStageShaftMinmaxAndSnap () {
1670
- stageShaftData.min = o_loop ? -Infinity : -getPosByIndex(size - 1, measures.w, MARGIN, repositionIndex);
1671
- stageShaftData.max = o_loop ? Infinity : -getPosByIndex(0, measures.w, MARGIN, repositionIndex);
1672
- stageShaftData.snap = measures.w + MARGIN;
1744
+ stageShaftData.min = o_loop ? -Infinity : -getPosByIndex(size - 1, measures.w, opts.margin, repositionIndex);
1745
+ stageShaftData.max = o_loop ? Infinity : -getPosByIndex(0, measures.w, opts.margin, repositionIndex);
1746
+ stageShaftData.snap = measures.w + opts.margin;
1673
1747
  }
1674
1748
 
1675
1749
  function setNavShaftMinmax () {
1676
- navShaftData.min = Math.min(0, measures.w - $navShaft.width());
1750
+ navShaftData.min = Math.min(0, measures.W - $navShaft.width());
1677
1751
  navShaftData.max = 0;
1678
1752
  $navShaft.toggleClass(grabClass, !(navShaftTouchTail.noMove = navShaftData.min === navShaftData.max));
1679
1753
  }
@@ -1714,7 +1788,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
1714
1788
 
1715
1789
  if (!$frame) return;
1716
1790
 
1717
- var fullFLAG = that.fullScreen && dataFrame.full && !frameData.$full && type === 'stage';
1791
+ var fullFLAG = that.fullScreen && dataFrame.full && dataFrame.full !== dataFrame.img && !frameData.$full && type === 'stage';
1718
1792
 
1719
1793
  if (frameData.$img && !again && !fullFLAG) return;
1720
1794
 
@@ -1748,7 +1822,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
1748
1822
  dataFrame[srcKey] = src = dummy;
1749
1823
  loadImg([index], type, specialMeasures, specialFit, true);
1750
1824
  } else {
1751
- if (src && !dataFrame.html) {
1825
+ if (src && !dataFrame.html && !fullFLAG) {
1752
1826
  $frame
1753
1827
  .trigger('f:error')
1754
1828
  .removeClass(loadingClass)
@@ -1796,8 +1870,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
1796
1870
 
1797
1871
  fit($img, specialMeasures || measures, specialFit || dataFrame.fit || opts.fit);
1798
1872
 
1799
- $.Fotorama.cache[src] = 'loaded';
1800
- frameData.state = 'loaded';
1873
+ $.Fotorama.cache[src] = frameData.state = 'loaded';
1801
1874
 
1802
1875
  setTimeout(function () {
1803
1876
  $frame
@@ -1844,6 +1917,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
1844
1917
  })();
1845
1918
  }
1846
1919
 
1920
+ frameData.state = '';
1847
1921
  img.src = src;
1848
1922
  });
1849
1923
  }
@@ -1932,7 +2006,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
1932
2006
  eachIndex(indexes, 'stage', function (i, index, dataFrame, $frame, key, frameData) {
1933
2007
  if (!$frame) return;
1934
2008
 
1935
- toDetach[STAGE_FRAME_KEY][normalizeIndex(index)] = $frame.css($.extend({left: o_fade ? 0 : getPosByIndex(index, measures.w, MARGIN, repositionIndex)}, o_fade && getDuration(0)));
2009
+ toDetach[STAGE_FRAME_KEY][normalizeIndex(index)] = $frame.css($.extend({left: o_fade ? 0 : getPosByIndex(index, measures.w, opts.margin, repositionIndex)}, o_fade && getDuration(0)));
1936
2010
 
1937
2011
  if (isDetached($frame[0])) {
1938
2012
  $frame.appendTo($stageShaft);
@@ -2006,7 +2080,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2006
2080
 
2007
2081
  $this.css({width: thumbwidth});
2008
2082
 
2009
- left += thumbwidth + MARGIN;
2083
+ left += thumbwidth + opts.thumbmargin;
2010
2084
  })
2011
2085
  );
2012
2086
 
@@ -2023,12 +2097,20 @@ jQuery.Fotorama = function ($fotorama, opts) {
2023
2097
  }
2024
2098
 
2025
2099
  function arrsUpdate () {
2026
- $arrs.each(function (i) {
2027
- $(this).toggleClass(
2028
- arrDisabledClass,
2029
- disableDirrection(i)
2030
- );
2031
- });
2100
+ $arrPrev.toggleClass(
2101
+ arrDisabledClass,
2102
+ disableDirrection(0)
2103
+ );
2104
+ $arrNext.toggleClass(
2105
+ arrDisabledClass,
2106
+ disableDirrection(1)
2107
+ );
2108
+ }
2109
+
2110
+ function stageWheelUpdate () {
2111
+ if (stageWheelTail.ok) {
2112
+ stageWheelTail.prevent = {'<': disableDirrection(0), '>': disableDirrection(1)};
2113
+ }
2032
2114
  }
2033
2115
 
2034
2116
  function getNavFrameBounds ($navFrame) {
@@ -2046,8 +2128,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
2046
2128
 
2047
2129
  return {
2048
2130
  c: left + width / 2,
2049
- min: -left + MARGIN * 10,
2050
- max: -left + measures.w - width - MARGIN * 10
2131
+ min: -left + opts.thumbmargin * 10,
2132
+ max: -left + measures.w - width - opts.thumbmargin * 10
2051
2133
  };
2052
2134
  }
2053
2135
 
@@ -2056,7 +2138,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2056
2138
  slide($thumbBorder, {
2057
2139
  time: time * .9,
2058
2140
  pos: navFrameData.l,
2059
- width: navFrameData.w - MARGIN * 2
2141
+ width: navFrameData.w - opts.thumbborderwidth * 2
2060
2142
  });
2061
2143
  }
2062
2144
 
@@ -2207,7 +2289,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2207
2289
  }, function () {
2208
2290
  changeAutoplay.t = setTimeout(function () {
2209
2291
  if (pausedAutoplayFLAG || _activeIndex !== activeIndex) return;
2210
- that.show(o_loop ? '>' : normalizeIndex(activeIndex + 1));
2292
+ that.show(o_loop ? getDirectionSign(!o_rtl) : normalizeIndex(activeIndex + (o_rtl ? -1 : 1)));
2211
2293
  }, opts.autoplay);
2212
2294
  });
2213
2295
 
@@ -2281,6 +2363,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2281
2363
  triggerEvent('showend', options.direct);
2282
2364
 
2283
2365
  updateTouchTails('go', false);
2366
+ stageWheelUpdate();
2284
2367
 
2285
2368
  stageCursor();
2286
2369
  releaseAutoplay();
@@ -2289,7 +2372,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2289
2372
 
2290
2373
  if (!o_fade) {
2291
2374
  slide($stageShaft, {
2292
- pos: -getPosByIndex(dirtyIndex, measures.w, MARGIN, repositionIndex),
2375
+ pos: -getPosByIndex(dirtyIndex, measures.w, opts.margin, repositionIndex),
2293
2376
  overPos: overPos,
2294
2377
  time: time,
2295
2378
  onEnd: onEnd,
@@ -2352,6 +2435,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2352
2435
 
2353
2436
  that.resize();
2354
2437
  loadImg(activeIndexes, 'stage');
2438
+ updateFotoramaState();
2355
2439
 
2356
2440
  triggerEvent('fullscreenenter');
2357
2441
  }
@@ -2422,7 +2506,15 @@ jQuery.Fotorama = function ($fotorama, opts) {
2422
2506
  if (measureIsValid(width)) {
2423
2507
  $wrap.css({width: width, minWidth: measures.minwidth, maxWidth: measures.maxwidth});
2424
2508
 
2425
- width = measures.w = $wrap.width();
2509
+ width = measures.W = measures.w = $wrap.width();
2510
+
2511
+ if (opts.glimpse) {
2512
+ measures.w -= Math.round((numberFromPercent(opts.glimpse) / 100 * width || numberFromMeasure(opts.glimpse)) * 2);
2513
+ }
2514
+
2515
+ //console.log('measures.W', measures.W);
2516
+ //console.log('measures.w', measures.w);
2517
+
2426
2518
  height = numberFromPercent(height) / 100 * windowHeight || numberFromMeasure(height);
2427
2519
 
2428
2520
  height = height || (ratio && width / ratio);
@@ -2550,7 +2642,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2550
2642
  if (stageShaftTouchTail.flow) return;
2551
2643
 
2552
2644
  var x = e ? e.pageX : stageCursor.x,
2553
- pointerFLAG = e && !disableDirrection(getDirection(x)) && opts.click;
2645
+ pointerFLAG = x && !disableDirrection(getDirection(x)) && opts.click;
2554
2646
 
2555
2647
  if (stageCursor.p !== pointerFLAG
2556
2648
  && (o_fade || !opts.swipe)
@@ -2577,7 +2669,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2577
2669
  if (toggleControlsFLAG) {
2578
2670
  toggleControlsClass();
2579
2671
  } else if (opts.click) {
2580
- that.show({index: e.shiftKey || !getDirection(e._x) ? '<' : '>', slow: e.altKey, direct: true});
2672
+ that.show({index: e.shiftKey || getDirectionSign(getDirection(e._x)), slow: e.altKey, direct: true});
2581
2673
  }
2582
2674
  });
2583
2675
  }
@@ -2600,7 +2692,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2600
2692
  var toggleControlsFLAG = (MS_POINTER && !hoverFLAG || result.touch) && opts.arrows;
2601
2693
 
2602
2694
  if (result.moved || (toggleControlsFLAG && result.pos !== result.newPos)) {
2603
- var index = getIndexByPos(result.newPos, measures.w, MARGIN, repositionIndex);
2695
+ var index = getIndexByPos(result.newPos, measures.w, opts.margin, repositionIndex);
2604
2696
  that.show({
2605
2697
  index: index,
2606
2698
  time: o_fade ? o_transitionDuration : result.time,
@@ -2612,7 +2704,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2612
2704
  }
2613
2705
  },
2614
2706
  getPos: function () {
2615
- return -getPosByIndex(dirtyIndex, measures.w, MARGIN, repositionIndex);
2707
+ return -getPosByIndex(dirtyIndex, measures.w, opts.margin, repositionIndex);
2616
2708
  },
2617
2709
  _001: true,
2618
2710
  timeLow: 1,
@@ -2648,7 +2740,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2648
2740
  onEnd: onEnd
2649
2741
  });
2650
2742
  thumbsDraw(result.newPos);
2651
- setShadow($nav, findShadowEdge(result.newPos, navShaftData.min, navShaftData.max));
2743
+ o_shadows && setShadow($nav, findShadowEdge(result.newPos, navShaftData.min, navShaftData.max));
2652
2744
  } else {
2653
2745
  onEnd();
2654
2746
  }
@@ -2659,6 +2751,31 @@ jQuery.Fotorama = function ($fotorama, opts) {
2659
2751
  $wrap: $nav
2660
2752
  });
2661
2753
 
2754
+ stageWheelTail = wheel($stage, {
2755
+ shift: true,
2756
+ onEnd: function (e, direction) {
2757
+ //console.log('wheel $stage onEnd', direction);
2758
+ onTouchStart();
2759
+ that.show({index: direction, slow: e.altKey})
2760
+ }
2761
+ });
2762
+
2763
+ navWheelTail = wheel($nav, {
2764
+ onEnd: function (e, direction) {
2765
+ //console.log('wheel $nav onEnd', direction);
2766
+ onTouchStart();
2767
+ var newPos = stop($navShaft) + direction * .25;
2768
+ $navShaft.css(getTranslate(minMaxLimit(newPos, navShaftData.min, navShaftData.max)));
2769
+ o_shadows && setShadow($nav, findShadowEdge(newPos, navShaftData.min, navShaftData.max));
2770
+ navWheelTail.prevent = {'<': newPos >= navShaftData.max, '>': newPos <= navShaftData.min};
2771
+ clearTimeout(navWheelTail.t);
2772
+ navWheelTail.t = setTimeout(function () {
2773
+ thumbsDraw(newPos, true)
2774
+ }, TOUCH_TIMEOUT);
2775
+ thumbsDraw(newPos);
2776
+ }
2777
+ });
2778
+
2662
2779
  $wrap.hover(
2663
2780
  function () {
2664
2781
  setTimeout(function () {
@@ -2679,7 +2796,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2679
2796
  }
2680
2797
 
2681
2798
  smartClick($arrs, function (e) {
2682
- e.preventDefault();
2799
+ stopEvent(e);
2683
2800
  if ($videoPlaying) {
2684
2801
  unloadVideo($videoPlaying, true, true);
2685
2802
  } else {
@@ -2698,16 +2815,21 @@ jQuery.Fotorama = function ($fotorama, opts) {
2698
2815
  setData();
2699
2816
  setOptions();
2700
2817
 
2701
- if (!ready.ok) {
2702
- var _startindex;
2703
- // Only first time
2704
- if ((_startindex = opts.startindex) || opts.hash && location.hash) {
2818
+ if (!reset.i) {
2819
+ reset.i = true;
2820
+ // Only once
2821
+ var _startindex = opts.startindex;
2822
+ if (_startindex || opts.hash && location.hash) {
2705
2823
  startIndex = getIndexFromHash(_startindex || location.hash.replace(/^#/, ''), data, that.index === 0 || _startindex, _startindex);
2706
2824
  }
2707
- activeIndex = repositionIndex = dirtyIndex = lastActiveIndex = startIndex = edgeIndex(startIndex) || 0;
2825
+ activeIndex = repositionIndex = dirtyIndex = lastActiveIndex = startIndex = edgeIndex(startIndex) || 0;/*(o_rtl ? size - 1 : 0)*/;
2708
2826
  }
2709
2827
 
2710
2828
  if (size) {
2829
+ //console.log('activeIndex', activeIndex);
2830
+ if (changeToRtl()) return;
2831
+ //console.log('No changeToRtl, activeIndex is', activeIndex);
2832
+
2711
2833
  if ($videoPlaying) {
2712
2834
  unloadVideo($videoPlaying, true);
2713
2835
  }
@@ -2722,6 +2844,18 @@ jQuery.Fotorama = function ($fotorama, opts) {
2722
2844
  }
2723
2845
  }
2724
2846
 
2847
+ function changeToRtl () {
2848
+ //console.log('changeToRtl');
2849
+ if (!changeToRtl.f === o_rtl) {
2850
+ changeToRtl.f = o_rtl;
2851
+ activeIndex = size - 1 - activeIndex;
2852
+ //console.log('changeToRtl execute, activeIndex is', activeIndex);
2853
+ that.reverse();
2854
+
2855
+ return true;
2856
+ }
2857
+ }
2858
+
2725
2859
  $.each('load push pop shift unshift reverse sort splice'.split(' '), function (i, method) {
2726
2860
  that[method] = function () {
2727
2861
  data = data || [];
@@ -2775,15 +2909,21 @@ $.fn.fotorama = function (opts) {
2775
2909
  maxheight: null,
2776
2910
  ratio: null, // '16/9' || 500/333 || 1.5
2777
2911
 
2912
+ margin: MARGIN,
2913
+ glimpse: 0,
2914
+
2778
2915
  // navigation, thumbs
2779
2916
  nav: 'dots', // 'thumbs' || false
2780
2917
  navposition: 'bottom', // 'top'
2781
2918
  thumbwidth: THUMB_SIZE,
2782
2919
  thumbheight: THUMB_SIZE,
2920
+ thumbmargin: MARGIN,
2921
+ thumbborderwidth: MARGIN,
2783
2922
 
2784
2923
  arrows: true,
2785
2924
  click: true,
2786
2925
  swipe: true,
2926
+ trackpad: true,
2787
2927
 
2788
2928
  allowfullscreen: false, // true || 'native'
2789
2929
 
@@ -2806,8 +2946,11 @@ $.fn.fotorama = function (opts) {
2806
2946
 
2807
2947
  shuffle: false,
2808
2948
 
2809
- shadows: true
2949
+ shadows: true,
2950
+
2951
+ direction: 'ltr' // 'rtl'
2810
2952
  },
2953
+ window.fotoramaDefaults,
2811
2954
  opts,
2812
2955
  fotoramaData
2813
2956
  )
@@ -2851,9 +2994,9 @@ __p += '.fotorama' +
2851
2994
  'px}\n.fotorama' +
2852
2995
  ((__t = ( v.s )) == null ? '' : __t) +
2853
2996
  ' .fotorama__thumb-border{\nheight:' +
2854
- ((__t = ( v.h - v.m * (v.q ? 0 : 2) )) == null ? '' : __t) +
2997
+ ((__t = ( v.h - v.b * (v.q ? 0 : 2) )) == null ? '' : __t) +
2855
2998
  'px;\nborder-width:' +
2856
- ((__t = ( v.m )) == null ? '' : __t) +
2999
+ ((__t = ( v.b )) == null ? '' : __t) +
2857
3000
  'px;\nmargin-top:' +
2858
3001
  ((__t = ( v.m )) == null ? '' : __t) +
2859
3002
  'px}';
@@ -2864,11 +3007,11 @@ $.Fotorama.jst.video = function(v) {
2864
3007
  var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
2865
3008
  function print() { __p += __j.call(arguments, '') }
2866
3009
  __p += '<div class="fotorama__video"><iframe src="';
2867
- print(v.type == 'youtube' ? 'http://youtube.com/embed/' + v.id +'?autoplay=1' : v.type == 'vimeo' ? 'http://player.vimeo.com/video/' + v.id + '?autoplay=1&amp;badge=0' : v.id) ;
3010
+ print((v.type == 'youtube' ? 'http://youtube.com/embed/' + v.id +'?autoplay=1' : v.type == 'vimeo' ? 'http://player.vimeo.com/video/' + v.id + '?autoplay=1&badge=0' : v.id) + '&' + v.s) ;
2868
3011
  __p += '" frameborder="0" allowfullscreen></iframe></div>';
2869
3012
  return __p
2870
3013
  };
2871
3014
  $(function () {
2872
3015
  $('.' + _fotoramaClass + ':not([data-auto="false"])').fotorama();
2873
3016
  });
2874
- })(window, document, location, jQuery);
3017
+ })(window, document, location, window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Fotorama 4.3.4.1 | http://fotorama.io/license/
2
+ * Fotorama 4.4.1 | http://fotorama.io/license/
3
3
  */
4
4
  .fotorama__stage__shaft,
5
5
  .fotorama__stage__frame,
@@ -23,7 +23,6 @@
23
23
  border-radius: 0 !important;
24
24
  box-shadow: none !important;
25
25
  padding: 0;
26
- margin: 0;
27
26
  }
28
27
 
29
28
  .fotorama__wrap .fotorama__grab {
@@ -188,15 +187,14 @@
188
187
  overflow: hidden;
189
188
  }
190
189
 
191
- .fotorama > * {
192
- visibility: hidden;
193
- }
194
-
195
- .fotorama.fotorama--noscript > *,
196
190
  .fotorama > .fotorama__wrap {
197
191
  visibility: visible;
198
192
  }
199
193
 
194
+ .fotorama--hidden-before-ready > * {
195
+ visibility: hidden;
196
+ }
197
+
200
198
  .fullscreen {
201
199
  width: 100% !important;
202
200
  height: 100% !important;
@@ -219,6 +217,7 @@
219
217
  background: #000;
220
218
  width: 100% !important;
221
219
  height: 100% !important;
220
+ margin: 0 !important;
222
221
  }
223
222
 
224
223
  .fotorama--fullscreen .fotorama__stage,
@@ -231,6 +230,10 @@
231
230
  position: relative;
232
231
  }
233
232
 
233
+ .fotorama__wrap--rtl .fotorama__stage__frame {
234
+ direction: rtl;
235
+ }
236
+
234
237
  .fotorama__stage,
235
238
  .fotorama__nav {
236
239
  overflow: hidden;
@@ -462,6 +465,11 @@
462
465
  display: none;
463
466
  }
464
467
 
468
+ .fotorama__wrap--rtl .fotorama__caption {
469
+ left: auto;
470
+ right: 0;
471
+ }
472
+
465
473
  .fotorama__oooo {
466
474
  width: 6px;
467
475
  height: 6px;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fotoramajs
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.4.1
4
+ version: 4.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-09 00:00:00.000000000 Z
12
+ date: 2013-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprockets
@@ -79,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  segments:
81
81
  - 0
82
- hash: 4017034132781727142
82
+ hash: -479234972122176432
83
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  segments:
90
90
  - 0
91
- hash: 4017034132781727142
91
+ hash: -479234972122176432
92
92
  requirements: []
93
93
  rubyforge_project:
94
94
  rubygems_version: 1.8.23