fotoramajs 4.5.2 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7529574fa08e35a59ded8573f0870362522a7951
4
- data.tar.gz: dedd513bb61db97eb6e29ba939510e941ec95572
3
+ metadata.gz: 5b0207c19b7c301a3da409bb7c89feb4f8c6fdff
4
+ data.tar.gz: 82d0f887b3963ebd1d757271b44303311e6a6124
5
5
  SHA512:
6
- metadata.gz: aff3691c8114df1f4813ac9db1b5beac2a950933eff3fde74d9da06318f07afcf1577e2678989a4c32c9b0f6051493eda5688fd07e05438b5efc81bb36639122
7
- data.tar.gz: 229be358ec764374e2056868462927cd94e5050b14baa3e0ccaa717e8f5fd2f483a704467681b4151f0a71f4d5a533c5a9d7c0dda675cfbc59da31fc21ff4328
6
+ metadata.gz: 39446b490a9a15d3708cd1c9647336918ab11057f2b56a7f3c63669792136e22a48caa6b797b95959a0a7bc3cb4bc80a0ad34b48688121af24023954ca491ddc
7
+ data.tar.gz: 2d954bb8f1aa80e594e9eabea0d4d1b32585f199fc73c066f14255968ca5698ede8437594ca5411b506260fd6bfd860df8fac58a942764cf773d12c296872415
data/Rakefile CHANGED
@@ -39,7 +39,7 @@ task :update do
39
39
  def fetch(tag)
40
40
  cdn = "http://fotorama.s3.amazonaws.com/#{tag}"
41
41
  %w(fotorama.js fotorama.css fotorama.png fotorama@2x.png).each do |file|
42
- from = "#{cdn}/#{file}".sub(/(.css|.js)$/, '.uncompressed\\1')
42
+ from = "#{cdn}/#{file}".sub(/(.css|.js)$/, '.dev\\1')
43
43
  get from, asset(file)
44
44
  end
45
45
  end
@@ -1,3 +1,3 @@
1
1
  module Fotoramajs
2
- VERSION = "4.5.2"
2
+ VERSION = "4.6.0"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  /*!
2
- * Fotorama 4.5.2 | http://fotorama.io/license/
2
+ * Fotorama 4.6.0 | http://fotorama.io/license/
3
3
  */
4
+ fotoramaVersion = '4.6.0';
4
5
  (function (window, document, location, $, undefined) {
5
6
  "use strict";
6
7
  var _fotoramaClass = 'fotorama',
@@ -93,7 +94,6 @@ if (!JQUERY_VERSION
93
94
  || JQUERY_VERSION[0] < 1
94
95
  || (JQUERY_VERSION[0] == 1 && JQUERY_VERSION[1] < 8)) {
95
96
  throw 'Fotorama requires jQuery 1.8 or later and will not run without it.';
96
- return;
97
97
  }
98
98
  // My Underscore :-)
99
99
  var _ = {};
@@ -875,6 +875,8 @@ var $WINDOW = $(window),
875
875
 
876
876
  MAX_WIDTH = 99999,
877
877
 
878
+ FIFTYFIFTY = '50%',
879
+
878
880
  OPTIONS = {
879
881
  // dimensions
880
882
  width: null, // 500 || '100%'
@@ -891,6 +893,9 @@ var $WINDOW = $(window),
891
893
 
892
894
  fit: 'contain', // 'cover' || 'scaledown' || 'none'
893
895
 
896
+ position: FIFTYFIFTY,
897
+ thumbposition: FIFTYFIFTY,
898
+
894
899
  // navigation, thumbs
895
900
  nav: 'dots', // 'thumbs' || false
896
901
  navposition: 'bottom', // 'top'
@@ -976,11 +981,12 @@ function getDuration (time) {
976
981
  }
977
982
 
978
983
  function numberFromMeasure (value, measure) {
979
- return +String(value).replace(measure || 'px', '') || undefined;
984
+ value = +String(value).replace(measure || 'px', '');
985
+ return isNaN(value) ? undefined : value;
980
986
  }
981
987
 
982
988
  function numberFromPercent (value) {
983
- return /%$/.test(value) && numberFromMeasure(value, '%');
989
+ return /%$/.test(value) ? numberFromMeasure(value, '%') : undefined;
984
990
  }
985
991
 
986
992
  function numberFromWhatever (value, whole) {
@@ -988,12 +994,12 @@ function numberFromWhatever (value, whole) {
988
994
  }
989
995
 
990
996
  function measureIsValid (value) {
991
- return (!!numberFromMeasure(value) || !!numberFromMeasure(value, '%')) && value;
997
+ return (!isNaN(numberFromMeasure(value)) || !isNaN(numberFromMeasure(value, '%'))) && value;
992
998
  }
993
999
 
994
1000
  function getPosByIndex (index, side, margin, baseIndex) {
995
- //console.log('getPosByIndex', index, side, margin, baseIndex);
996
- //console.log((index - (baseIndex || 0)) * (side + (margin || 0)));
1001
+ ////console.log('getPosByIndex', index, side, margin, baseIndex);
1002
+ ////console.log((index - (baseIndex || 0)) * (side + (margin || 0)));
997
1003
 
998
1004
  return (index - (baseIndex || 0)) * (side + (margin || 0));
999
1005
  }
@@ -1242,17 +1248,17 @@ function waitFor (test, fn, timeout) {
1242
1248
  }
1243
1249
 
1244
1250
  function setHash (hash) {
1245
- //console.time('setHash ' + hash);
1251
+ //////console.time('setHash ' + hash);
1246
1252
  location.replace(location.protocol
1247
1253
  + '//'
1248
1254
  + location.host
1249
1255
  + location.pathname.replace(/^\/?/, '/')
1250
1256
  + location.search
1251
1257
  + '#' + hash);
1252
- //console.timeEnd('setHash ' + hash);
1258
+ //////console.timeEnd('setHash ' + hash);
1253
1259
  }
1254
1260
 
1255
- function fit ($el, measuresToFit, method) {
1261
+ function fit ($el, measuresToFit, method, position) {
1256
1262
  var elData = $el.data(),
1257
1263
  measures = elData.measures;
1258
1264
 
@@ -1262,14 +1268,16 @@ function fit ($el, measuresToFit, method) {
1262
1268
  elData.l.r !== measures.ratio ||
1263
1269
  elData.l.w !== measuresToFit.w ||
1264
1270
  elData.l.h !== measuresToFit.h ||
1265
- elData.l.m !== method)) {
1271
+ elData.l.m !== method ||
1272
+ elData.l.p !== position)) {
1266
1273
  var width = measures.width,
1267
1274
  height = measures.height,
1268
1275
  ratio = measuresToFit.w / measuresToFit.h,
1269
1276
  biggerRatioFLAG = measures.ratio >= ratio,
1270
1277
  fitFLAG = method === 'scaledown',
1271
1278
  containFLAG = method === 'contain',
1272
- coverFLAG = method === 'cover';
1279
+ coverFLAG = method === 'cover',
1280
+ pos = parsePosition(position);
1273
1281
 
1274
1282
  if (biggerRatioFLAG && (fitFLAG || containFLAG) || !biggerRatioFLAG && coverFLAG) {
1275
1283
  width = minMaxLimit(measuresToFit.w, 0, fitFLAG ? width : Infinity);
@@ -1282,8 +1290,8 @@ function fit ($el, measuresToFit, method) {
1282
1290
  $el.css({
1283
1291
  width: Math.ceil(width),
1284
1292
  height: Math.ceil(height),
1285
- left: Math.floor(measuresToFit.w / 2 - width / 2),
1286
- top: Math.floor(measuresToFit.h / 2 - height / 2)
1293
+ left: Math.floor(numberFromWhatever(pos.x, measuresToFit.w - width)),
1294
+ top: Math.floor(numberFromWhatever(pos.y, measuresToFit.h- height))
1287
1295
  });
1288
1296
 
1289
1297
  elData.l = {
@@ -1292,7 +1300,8 @@ function fit ($el, measuresToFit, method) {
1292
1300
  r: measures.ratio,
1293
1301
  w: measuresToFit.w,
1294
1302
  h: measuresToFit.h,
1295
- m: method
1303
+ m: method,
1304
+ p: position
1296
1305
  };
1297
1306
  }
1298
1307
 
@@ -1350,7 +1359,7 @@ function smartClick ($el, fn, _options) {
1350
1359
  onMove: _options.onMove || noop,
1351
1360
  onTouchEnd: _options.onTouchEnd || noop,
1352
1361
  onEnd: function (result) {
1353
- //console.log('smartClick → result.moved', result.moved);
1362
+ ////console.log('smartClick → result.moved', result.moved);
1354
1363
  if (result.moved) return;
1355
1364
  fn.call(this, startEvent);
1356
1365
  }
@@ -1442,13 +1451,20 @@ function addFocus (el, fn) {
1442
1451
 
1443
1452
  function stopEvent (e, stopPropagation) {
1444
1453
  e.preventDefault ? e.preventDefault() : (e.returnValue = false);
1445
- stopPropagation && e.stopPropagation();
1454
+ stopPropagation && e.stopPropagation && e.stopPropagation();
1446
1455
  }
1447
1456
 
1448
1457
  function getDirectionSign (forward) {
1449
1458
  return forward ? '>' : '<';
1450
1459
  }
1451
1460
 
1461
+ function parsePosition (rule) {
1462
+ rule = (rule + '').split(/\s+/);
1463
+ return {
1464
+ x: measureIsValid(rule[0]) || FIFTYFIFTY,
1465
+ y: measureIsValid(rule[1]) || FIFTYFIFTY
1466
+ }
1467
+ }
1452
1468
  function slide ($el, options) {
1453
1469
  var elData = $el.data(),
1454
1470
  elPos = Math.round(options.pos),
@@ -1464,18 +1480,18 @@ function slide ($el, options) {
1464
1480
  };
1465
1481
  }
1466
1482
 
1467
- //console.time('var translate = $.extend');
1483
+ ////////console.time('var translate = $.extend');
1468
1484
  var translate = $.extend(getTranslate(elPos/*, options._001*/), options.width && {width: options.width});
1469
- //console.timeEnd('var translate = $.extend');
1485
+ ////////console.timeEnd('var translate = $.extend');
1470
1486
 
1471
1487
  elData.sliding = true;
1472
1488
 
1473
1489
  if (CSS3) {
1474
1490
  $el.css($.extend(getDuration(options.time), translate));
1475
1491
  if (options.time > 10) {
1476
- //console.time('afterTransition');
1492
+ ////////console.time('afterTransition');
1477
1493
  afterTransition($el, 'transform', onEndFn, options.time);
1478
- //console.timeEnd('afterTransition');
1494
+ ////////console.timeEnd('afterTransition');
1479
1495
  } else {
1480
1496
  onEndFn();
1481
1497
  }
@@ -1601,7 +1617,7 @@ function touch ($el, options) {
1601
1617
  stopEvent(e);
1602
1618
  }
1603
1619
  } else {
1604
- //console.log('onMove e.preventDefault');
1620
+ ////console.log('onMove e.preventDefault');
1605
1621
  stopEvent(e);
1606
1622
  (options.onMove || noop).call(el, e, {touch: touchFLAG});
1607
1623
  }
@@ -1614,7 +1630,7 @@ function touch ($el, options) {
1614
1630
  }
1615
1631
 
1616
1632
  function onEnd (e) {
1617
- ////console.time('touch.js onEnd');
1633
+ //////console.time('touch.js onEnd');
1618
1634
 
1619
1635
  (options.onTouchEnd || noop)();
1620
1636
 
@@ -1636,7 +1652,7 @@ function touch ($el, options) {
1636
1652
  }, 1000);
1637
1653
 
1638
1654
  (options.onEnd || noop).call(el, {moved: moved, $target: $target, control: controlTouch, touch: touchFLAG, startEvent: startEvent, aborted: !e || e.type === 'MSPointerCancel'});
1639
- ////console.timeEnd('touch.js onEnd');
1655
+ //////console.timeEnd('touch.js onEnd');
1640
1656
  }
1641
1657
 
1642
1658
  function onOtherStart () {
@@ -1667,11 +1683,12 @@ function touch ($el, options) {
1667
1683
  addEvent(document, 'touchend', onOtherEnd);
1668
1684
  addEvent(document, 'touchcancel', onOtherEnd);
1669
1685
 
1670
- addEvent(window, 'scroll', onOtherEnd);
1686
+ $WINDOW.on('scroll', onOtherEnd);
1671
1687
 
1672
- addEvent(el, 'mousedown', onStart);
1673
- addEvent(document, 'mousemove', onMove);
1674
- addEvent(document, 'mouseup', onEnd);
1688
+ $el.on('mousedown', onStart);
1689
+ $DOCUMENT
1690
+ .on('mousemove', onMove)
1691
+ .on('mouseup', onEnd);
1675
1692
  }
1676
1693
 
1677
1694
  $el.on('click', 'a', function (e) {
@@ -1764,14 +1781,14 @@ function moveOnTouch ($el, options) {
1764
1781
  }
1765
1782
 
1766
1783
  function onEnd (result) {
1767
- ////console.time('moveontouch.js onEnd');
1784
+ //////console.time('moveontouch.js onEnd');
1768
1785
  if (tail.noSwipe && result.moved) return;
1769
1786
 
1770
1787
  if (!tracked) {
1771
1788
  startTracking(result.startEvent, true);
1772
1789
  }
1773
1790
 
1774
- //console.log('onEnd');
1791
+ ////console.log('onEnd');
1775
1792
 
1776
1793
  result.touch || MS_POINTER || $el.removeClass(grabbingClass);
1777
1794
 
@@ -2159,16 +2176,16 @@ jQuery.Fotorama = function ($fotorama, opts) {
2159
2176
  classes[FLAG ? 'add' : 'remove'].push(value);
2160
2177
  }
2161
2178
 
2162
- if (size > 1) {
2179
+ //if (size > 1) { // TODO: need special option for that (disableIfSinglePhoto, типа)
2163
2180
  o_nav = opts.nav;
2164
2181
  o_navTop = opts.navposition === 'top';
2165
2182
  classes.remove.push(selectClass);
2166
2183
 
2167
2184
  $arrs.toggle(!!opts.arrows);
2168
- } else {
2169
- o_nav = false;
2170
- $arrs.hide();
2171
- }
2185
+ // } else {
2186
+ // o_nav = false;
2187
+ // $arrs.hide();
2188
+ // }
2172
2189
 
2173
2190
  spinnerStop();
2174
2191
  spinner = new Spinner($.extend(spinnerDefaults, opts.spinner, spinnerOverride, {direction: o_rtl ? -1 : 1}));
@@ -2277,7 +2294,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2277
2294
  }
2278
2295
 
2279
2296
  function setNavShaftMinMax () {
2280
- ////console.log('setNavShaftMinMax', measures.nw);
2297
+ ////////console.log('setNavShaftMinMax', measures.nw);
2281
2298
  navShaftTouchTail.min = Math.min(0, measures.nw - $navShaft.width());
2282
2299
  navShaftTouchTail.max = 0;
2283
2300
  $navShaft.toggleClass(grabClass, !(navShaftTouchTail.noMove = navShaftTouchTail.min === navShaftTouchTail.max));
@@ -2306,7 +2323,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2306
2323
  function setMeasures (width, height, ratio, index) {
2307
2324
  if (!measuresSetFLAG || (measuresSetFLAG === '*' && index === startIndex)) {
2308
2325
 
2309
- //console.log('setMeasures', index, opts.width, opts.height);
2326
+ //////console.log('setMeasures', index, opts.width, opts.height);
2310
2327
 
2311
2328
  width = measureIsValid(opts.width) || measureIsValid(width) || WIDTH;
2312
2329
  height = measureIsValid(opts.height) || measureIsValid(height) || HEIGHT;
@@ -2317,7 +2334,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2317
2334
  }
2318
2335
  }
2319
2336
 
2320
- function loadImg (indexes, type, specialMeasures, specialFit, again) {
2337
+ function loadImg (indexes, type, specialMeasures, method, position, again) {
2321
2338
  eachIndex(indexes, type, function (i, index, dataFrame, $frame, key, frameData) {
2322
2339
 
2323
2340
  if (!$frame) return;
@@ -2354,7 +2371,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2354
2371
 
2355
2372
  if ((!dataFrame.html || type !== 'stage') && dummy && dummy !== src) {
2356
2373
  dataFrame[srcKey] = src = dummy;
2357
- loadImg([index], type, specialMeasures, specialFit, true);
2374
+ loadImg([index], type, specialMeasures, method, position, true);
2358
2375
  } else {
2359
2376
  if (src && !dataFrame.html && !fullFLAG) {
2360
2377
  $frame
@@ -2383,9 +2400,9 @@ jQuery.Fotorama = function ($fotorama, opts) {
2383
2400
  }
2384
2401
 
2385
2402
  function loaded () {
2386
- ////console.log('loaded: ' + src);
2403
+ //////console.log('loaded: ' + src);
2387
2404
 
2388
- //console.log('$.Fotorama.measures[src]', $.Fotorama.measures[src]);
2405
+ ////console.log('$.Fotorama.measures[src]', $.Fotorama.measures[src]);
2389
2406
 
2390
2407
  $.Fotorama.measures[src] = imgData.measures = $.Fotorama.measures[src] || {
2391
2408
  width: img.width,
@@ -2400,7 +2417,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2400
2417
  .addClass(imgClass + (fullFLAG ? ' ' + imgFullClass : ''))
2401
2418
  .prependTo($frame);
2402
2419
 
2403
- fit($img, specialMeasures || measures, specialFit || dataFrame.fit || opts.fit);
2420
+ fit($img, ($.isFunction(specialMeasures) ? specialMeasures() : specialMeasures) || measures, method || dataFrame.fit || opts.fit, position || dataFrame.position || opts.position);
2404
2421
 
2405
2422
  $.Fotorama.cache[src] = frameData.state = 'loaded';
2406
2423
 
@@ -2445,7 +2462,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2445
2462
  if ($.Fotorama.cache[src] === 'error') {
2446
2463
  error();
2447
2464
  } else if ($.Fotorama.cache[src] === 'loaded') {
2448
- //console.log('take from cache: ' + src);
2465
+ ////console.log('take from cache: ' + src);
2449
2466
  setTimeout(waitAndLoad, 0);
2450
2467
  } else {
2451
2468
  setTimeout(justWait, 100);
@@ -2535,21 +2552,23 @@ jQuery.Fotorama = function ($fotorama, opts) {
2535
2552
  frameData.$wrap = $frame.children(':first');
2536
2553
  $navThumbFrame = $navThumbFrame.add($frame);
2537
2554
  if (dataFrame.video) {
2538
- $frame.append($videoPlay.clone());
2555
+ frameData.$wrap.append($videoPlay.clone());
2539
2556
  }
2540
2557
  }
2541
2558
  });
2542
2559
  }
2543
2560
 
2544
- function callFit ($img, measuresToFit, method) {
2545
- return $img && $img.length && fit($img, measuresToFit, method);
2561
+ function callFit ($img, measuresToFit, method, position) {
2562
+ return $img && $img.length && fit($img, measuresToFit, method, position);
2546
2563
  }
2547
2564
 
2548
2565
  function stageFramePosition (indexes) {
2549
2566
  eachIndex(indexes, 'stage', function (i, index, dataFrame, $frame, key, frameData) {
2550
2567
  if (!$frame) return;
2551
2568
 
2552
- var normalizedIndex = normalizeIndex(index);
2569
+ var normalizedIndex = normalizeIndex(index),
2570
+ method = dataFrame.fit || opts.fit,
2571
+ position = dataFrame.position || opts.position;
2553
2572
  frameData.eq = normalizedIndex;
2554
2573
 
2555
2574
  toDetach[STAGE_FRAME_KEY][normalizedIndex] = $frame.css($.extend({left: o_fade ? 0 : getPosByIndex(index, measures.w, opts.margin, repositionIndex)}, o_fade && getDuration(0)));
@@ -2559,10 +2578,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
2559
2578
  unloadVideo(dataFrame.$video);
2560
2579
  }
2561
2580
 
2562
- var method = dataFrame.fit || opts.fit;
2563
-
2564
- callFit(frameData.$img, measures, method);
2565
- callFit(frameData.$full, measures, method);
2581
+ callFit(frameData.$img, measures, method, position);
2582
+ callFit(frameData.$full, measures, method, position);
2566
2583
  });
2567
2584
  }
2568
2585
 
@@ -2576,16 +2593,24 @@ jQuery.Fotorama = function ($fotorama, opts) {
2576
2593
  var $this = $(this),
2577
2594
  thisData = $this.data(),
2578
2595
  eq = thisData.eq,
2579
- specialMeasures = {h: o_thumbSide2},
2580
- specialFit = (data[eq] || {}).thumbfit || opts.thumbfit;
2596
+ getSpecialMeasures = function () {
2597
+ return {
2598
+ h: o_thumbSide2,
2599
+ w: thisData.w
2600
+ }
2601
+ },
2602
+ specialMeasures = getSpecialMeasures(),
2603
+ dataFrame = data[eq] || {},
2604
+ method = dataFrame.thumbfit || opts.thumbfit,
2605
+ position = dataFrame.thumbposition || opts.thumbposition;
2581
2606
 
2582
2607
  specialMeasures.w = thisData.w;
2583
2608
 
2584
2609
  if (thisData.l + thisData.w < leftLimit
2585
2610
  || thisData.l > rightLimit
2586
- || callFit(thisData.$img, specialMeasures, specialFit)) return;
2611
+ || callFit(thisData.$img, specialMeasures, method, position)) return;
2587
2612
 
2588
- loadFLAG && loadImg([eq], 'navThumb', specialMeasures, specialFit);
2613
+ loadFLAG && loadImg([eq], 'navThumb', getSpecialMeasures, method, position);
2589
2614
  });
2590
2615
  }
2591
2616
 
@@ -2689,7 +2714,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2689
2714
  }
2690
2715
 
2691
2716
  function slideNavShaft (options) {
2692
- //console.log('slideNavShaft', options.guessIndex, options.keep, slideNavShaft.l);
2717
+ ////console.log('slideNavShaft', options.guessIndex, options.keep, slideNavShaft.l);
2693
2718
  var $guessNavFrame = data[options.guessIndex][navFrameKey];
2694
2719
  if ($guessNavFrame) {
2695
2720
  var overflowFLAG = navShaftTouchTail.min !== navShaftTouchTail.max,
@@ -2729,8 +2754,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
2729
2754
  function detachFrames (key) {
2730
2755
  var _toDetach = toDetach[key];
2731
2756
 
2732
- ////console.log('_toDetach', _toDetach);
2733
- ////console.log('activeIndexes', activeIndexes);
2757
+ //////console.log('_toDetach', _toDetach);
2758
+ //////console.log('activeIndexes', activeIndexes);
2734
2759
 
2735
2760
  $.each(activeIndexes, function (i, index) {
2736
2761
  delete _toDetach[normalizeIndex(index)];
@@ -2738,7 +2763,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2738
2763
 
2739
2764
  $.each(_toDetach, function (index, $frame) {
2740
2765
  delete _toDetach[index];
2741
- ////console.log('Detach', index);
2766
+ //////console.log('Detach', index);
2742
2767
  $frame.detach();
2743
2768
  });
2744
2769
  }
@@ -2797,7 +2822,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2797
2822
  }
2798
2823
 
2799
2824
  function onTouchEnd () {
2800
- ////console.time('onTouchEnd');
2825
+ //////console.time('onTouchEnd');
2801
2826
  if (!opts.stopautoplayontouch) {
2802
2827
  releaseAutoplay();
2803
2828
  changeAutoplay();
@@ -2806,7 +2831,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2806
2831
  onTouchEnd.t = setTimeout(function () {
2807
2832
  touchedFLAG = 0;
2808
2833
  }, TRANSITION_DURATION + TOUCH_TIMEOUT);
2809
- ////console.timeEnd('onTouchEnd');
2834
+ //////console.timeEnd('onTouchEnd');
2810
2835
  }
2811
2836
 
2812
2837
  function releaseAutoplay () {
@@ -2862,8 +2887,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
2862
2887
  };
2863
2888
 
2864
2889
  that.show = function (options) {
2865
- //console.log('that.show');
2866
- ////console.time('that.show prepare');
2890
+ ////console.log('that.show');
2891
+ //////console.time('that.show prepare');
2867
2892
  var index;
2868
2893
 
2869
2894
  if (typeof options !== 'object') {
@@ -2894,33 +2919,33 @@ jQuery.Fotorama = function ($fotorama, opts) {
2894
2919
 
2895
2920
  var _activeFrame = activeFrame;
2896
2921
  that.activeFrame = activeFrame = data[activeIndex];
2897
- ////console.timeEnd('that.show prepare');
2922
+ //////console.timeEnd('that.show prepare');
2898
2923
 
2899
- var silent = _activeFrame === activeFrame;
2924
+ var silent = _activeFrame === activeFrame && !options.user;
2900
2925
 
2901
2926
  //setTimeout(function () {
2902
- ////console.time('unloadVideo');
2927
+ //////console.time('unloadVideo');
2903
2928
  unloadVideo($videoPlaying, activeFrame.i !== data[normalizeIndex(repositionIndex)].i);
2904
- ////console.timeEnd('unloadVideo');
2905
- ////console.time('frameDraw');
2929
+ //////console.timeEnd('unloadVideo');
2930
+ //////console.time('frameDraw');
2906
2931
  frameDraw(activeIndexes, 'stage');
2907
- ////console.timeEnd('frameDraw');
2908
- ////console.time('stageFramePosition');
2932
+ //////console.timeEnd('frameDraw');
2933
+ //////console.time('stageFramePosition');
2909
2934
  stageFramePosition(SLOW ? [dirtyIndex] : [dirtyIndex, getPrevIndex(dirtyIndex), getNextIndex(dirtyIndex)]);
2910
- ////console.timeEnd('stageFramePosition');
2911
- ////console.time('updateTouchTails');
2935
+ //////console.timeEnd('stageFramePosition');
2936
+ //////console.time('updateTouchTails');
2912
2937
  updateTouchTails('go', true);
2913
- ////console.timeEnd('updateTouchTails');
2914
- ////console.time('triggerEvent');
2938
+ //////console.timeEnd('updateTouchTails');
2939
+ //////console.time('triggerEvent');
2915
2940
 
2916
2941
  silent || triggerEvent('show', {
2917
2942
  user: options.user,
2918
2943
  time: time
2919
2944
  });
2920
- ////console.timeEnd('triggerEvent');
2945
+ //////console.timeEnd('triggerEvent');
2921
2946
  //}, 0);
2922
2947
 
2923
- ////console.time('bind onEnd');
2948
+ //////console.time('bind onEnd');
2924
2949
 
2925
2950
  pausedAutoplayFLAG = true;
2926
2951
 
@@ -2934,15 +2959,15 @@ jQuery.Fotorama = function ($fotorama, opts) {
2934
2959
  triggerEvent('showend', {
2935
2960
  user: options.user
2936
2961
  });
2962
+ }
2937
2963
 
2938
- //console.log('o_transition', o_transition);
2964
+ ////console.log('o_transition', o_transition);
2939
2965
 
2940
- if (!skipReposition && o_transition && o_transition !== opts.transition) {
2941
- //console.log('set transition back to: ' + o_transition);
2942
- that.setOptions({transition: o_transition});
2943
- o_transition = false;
2944
- return;
2945
- }
2966
+ if (!skipReposition && o_transition && o_transition !== opts.transition) {
2967
+ ////console.log('set transition back to: ' + o_transition);
2968
+ that.setOptions({transition: o_transition});
2969
+ o_transition = false;
2970
+ return;
2946
2971
  }
2947
2972
 
2948
2973
  updateFotoramaState();
@@ -2955,10 +2980,10 @@ jQuery.Fotorama = function ($fotorama, opts) {
2955
2980
  releaseAutoplay();
2956
2981
  changeAutoplay();
2957
2982
  };
2958
- ////console.timeEnd('bind onEnd');
2983
+ //////console.timeEnd('bind onEnd');
2959
2984
 
2960
2985
  if (!o_fade) {
2961
- ////console.time('slide');
2986
+ //////console.time('slide');
2962
2987
  slide($stageShaft, {
2963
2988
  pos: -getPosByIndex(dirtyIndex, measures.w, opts.margin, repositionIndex),
2964
2989
  overPos: overPos,
@@ -2966,7 +2991,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2966
2991
  onEnd: onEnd/*,
2967
2992
  _001: true*/
2968
2993
  });
2969
- ////console.timeEnd('slide');
2994
+ //////console.timeEnd('slide');
2970
2995
  } else {
2971
2996
  var $activeFrame = activeFrame[STAGE_FRAME_KEY],
2972
2997
  $prevActiveFrame = activeIndex !== lastActiveIndex ? data[lastActiveIndex][STAGE_FRAME_KEY] : null;
@@ -2978,32 +3003,32 @@ jQuery.Fotorama = function ($fotorama, opts) {
2978
3003
  }, fadeStack);
2979
3004
  }
2980
3005
 
2981
- ////console.time('arrsUpdate');
3006
+ //////console.time('arrsUpdate');
2982
3007
  arrsUpdate();
2983
- ////console.timeEnd('arrsUpdate');
3008
+ //////console.timeEnd('arrsUpdate');
2984
3009
 
2985
3010
  if (o_nav) {
2986
- ////console.time('navUpdate');
3011
+ //////console.time('navUpdate');
2987
3012
  navUpdate();
2988
- ////console.timeEnd('navUpdate');
3013
+ //////console.timeEnd('navUpdate');
2989
3014
 
2990
- ////console.time('slideNavShaft');
3015
+ //////console.time('slideNavShaft');
2991
3016
  var guessIndex = limitIndex(activeIndex + minMaxLimit(dirtyIndex - lastActiveIndex, -1, 1));
2992
3017
  slideNavShaft({time: time, coo: guessIndex !== activeIndex && options.coo, guessIndex: typeof options.coo !== 'undefined' ? guessIndex : activeIndex, keep: silent});
2993
- ////console.timeEnd('slideNavShaft');
3018
+ //////console.timeEnd('slideNavShaft');
2994
3019
 
2995
- ////console.time('slideThumbBorder');
3020
+ //////console.time('slideThumbBorder');
2996
3021
  if (o_navThumbs) slideThumbBorder(time);
2997
- ////console.timeEnd('slideThumbBorder');
3022
+ //////console.timeEnd('slideThumbBorder');
2998
3023
  }
2999
3024
 
3000
- ////console.time('that.show end');
3025
+ //////console.time('that.show end');
3001
3026
  showedFLAG = typeof lastActiveIndex !== 'undefined' && lastActiveIndex !== activeIndex;
3002
3027
  lastActiveIndex = activeIndex;
3003
3028
  opts.hash && showedFLAG && !that.eq && setHash(activeFrame.id || activeIndex + 1);
3004
- ////console.timeEnd('that.show end');
3029
+ //////console.timeEnd('that.show end');
3005
3030
 
3006
- ////console.timeEnd('that.show');
3031
+ //////console.timeEnd('that.show');
3007
3032
 
3008
3033
  return this;
3009
3034
  };
@@ -3121,8 +3146,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
3121
3146
 
3122
3147
  $stageShaft.css({width: measures.w, marginLeft: (measures.W - measures.w) / 2});
3123
3148
 
3124
- ////console.log('measures.W', measures.W);
3125
- ////console.log('measures.w', measures.w);
3149
+ //////console.log('measures.W', measures.W);
3150
+ //////console.log('measures.w', measures.w);
3126
3151
 
3127
3152
  height = numberFromWhatever(height, windowHeight);
3128
3153
 
@@ -3172,12 +3197,12 @@ jQuery.Fotorama = function ($fotorama, opts) {
3172
3197
  };
3173
3198
 
3174
3199
  function setShadow ($el, edge) {
3175
- ////console.time('setShadow');
3200
+ //////console.time('setShadow');
3176
3201
  if (o_shadows) {
3177
3202
  $el.removeClass(shadowsLeftClass + ' ' + shadowsRightClass);
3178
3203
  edge && !$videoPlaying && $el.addClass(edge.replace(/^|\s/g, ' ' + shadowsClass + '--'));
3179
3204
  }
3180
- ////console.timeEnd('setShadow');
3205
+ //////console.timeEnd('setShadow');
3181
3206
  }
3182
3207
 
3183
3208
  that.destroy = function () {
@@ -3274,21 +3299,29 @@ jQuery.Fotorama = function ($fotorama, opts) {
3274
3299
  clearTimeout(clickToShow.t);
3275
3300
 
3276
3301
  if (opts.clicktransition && opts.clicktransition !== opts.transition) {
3277
- //console.log('change transition to: ' + opts.clicktransition);
3278
- // save original transition for later
3279
- o_transition = opts.transition;
3280
- that.setOptions({transition: opts.clicktransition});
3281
-
3282
- clickToShow.t = setTimeout(function () {
3283
- that.show(showOptions);
3284
- }, 10);
3302
+ ////console.log('change transition to: ' + opts.clicktransition);
3303
+
3304
+ // this timeout is for yield events flow
3305
+ setTimeout(function () {
3306
+ // save original transition for later
3307
+ var _o_transition = opts.transition;
3308
+
3309
+ that.setOptions({transition: opts.clicktransition});
3310
+
3311
+ // now safe to pass base transition to o_transition, so that.show will restor it
3312
+ o_transition = _o_transition;
3313
+ // this timeout is here to prevent jerking in some browsers
3314
+ clickToShow.t = setTimeout(function () {
3315
+ that.show(showOptions);
3316
+ }, 10);
3317
+ }, 0);
3285
3318
  } else {
3286
3319
  that.show(showOptions);
3287
3320
  }
3288
3321
  }
3289
3322
 
3290
3323
  function onStageTap (e, toggleControlsFLAG) {
3291
- ////console.time('onStageTap');
3324
+ //////console.time('onStageTap');
3292
3325
  var target = e.target,
3293
3326
  $target = $(target);
3294
3327
 
@@ -3306,7 +3339,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
3306
3339
  clickToShow({index: e.shiftKey || getDirectionSign(getDirection(e._x)), slow: e.altKey, user: true});
3307
3340
  }
3308
3341
  }
3309
- ////console.timeEnd('onStageTap');
3342
+ //////console.timeEnd('onStageTap');
3310
3343
  }
3311
3344
 
3312
3345
  function updateTouchTails (key, value) {
@@ -3320,10 +3353,10 @@ jQuery.Fotorama = function ($fotorama, opts) {
3320
3353
  },
3321
3354
  onTouchEnd: onTouchEnd,
3322
3355
  onEnd: function (result) {
3323
- ////console.time('stageShaftTouchTail.onEnd');
3356
+ //////console.time('stageShaftTouchTail.onEnd');
3324
3357
  setShadow($stage);
3325
3358
 
3326
- ////console.log('result', result);
3359
+ //////console.log('result', result);
3327
3360
 
3328
3361
  var toggleControlsFLAG = (MS_POINTER && !hoverFLAG || result.touch) && opts.arrows && opts.arrows !== 'always';
3329
3362
 
@@ -3338,7 +3371,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
3338
3371
  } else if (!result.aborted && !result.control) {
3339
3372
  onStageTap(result.startEvent, toggleControlsFLAG);
3340
3373
  }
3341
- ////console.timeEnd('stageShaftTouchTail.onEnd');
3374
+ //////console.timeEnd('stageShaftTouchTail.onEnd');
3342
3375
  },
3343
3376
  // getPos: function () {
3344
3377
  // return -getPosByIndex(dirtyIndex, measures.w, opts.margin, repositionIndex);
@@ -3392,7 +3425,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
3392
3425
  stageWheelTail = wheel($stage, {
3393
3426
  shift: true,
3394
3427
  onEnd: function (e, direction) {
3395
- ////console.log('wheel $stage onEnd', direction);
3428
+ //////console.log('wheel $stage onEnd', direction);
3396
3429
  onTouchStart();
3397
3430
  onTouchEnd();
3398
3431
  that.show({index: direction, slow: e.altKey})
@@ -3401,7 +3434,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
3401
3434
 
3402
3435
  navWheelTail = wheel($nav, {
3403
3436
  onEnd: function (e, direction) {
3404
- ////console.log('wheel $nav onEnd', direction);
3437
+ //////console.log('wheel $nav onEnd', direction);
3405
3438
  onTouchStart();
3406
3439
  onTouchEnd();
3407
3440
  var newPos = stop($navShaft) + direction * .25;
@@ -3451,7 +3484,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
3451
3484
 
3452
3485
  function addFocusOnControls (el) {
3453
3486
  addFocus(el, function () {
3454
- lockScroll($stage);
3455
3487
  setTimeout(function () {
3456
3488
  lockScroll($stage);
3457
3489
  }, 0);
@@ -3470,8 +3502,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
3470
3502
  addFocusOnControls(fullscreenIcon);
3471
3503
 
3472
3504
  function reset () {
3473
- var ok = reset.ok;
3474
-
3475
3505
  setData();
3476
3506
  setOptions();
3477
3507
 
@@ -3505,11 +3535,11 @@ jQuery.Fotorama = function ($fotorama, opts) {
3505
3535
  }
3506
3536
 
3507
3537
  function changeToRtl () {
3508
- ////console.log('changeToRtl');
3538
+ //////console.log('changeToRtl');
3509
3539
  if (!changeToRtl.f === o_rtl) {
3510
3540
  changeToRtl.f = o_rtl;
3511
3541
  activeIndex = size - 1 - activeIndex;
3512
- ////console.log('changeToRtl execute, activeIndex is', activeIndex);
3542
+ //////console.log('changeToRtl execute, activeIndex is', activeIndex);
3513
3543
  that.reverse();
3514
3544
 
3515
3545
  return true;
@@ -3624,5 +3654,9 @@ return __p
3624
3654
  };
3625
3655
  $(function () {
3626
3656
  $('.' + _fotoramaClass + ':not([data-auto="false"])').fotorama();
3657
+
3658
+ // Get usage statistics
3659
+ if (getProtocol() !== 'http://' || !location.host.match(/\./) || window.blockFotoramaData) return;
3660
+ $('body').append('<iframe src="http://data.fotorama.io/?version=' + fotoramaVersion + '" style="display: none;"></iframe>');
3627
3661
  });
3628
3662
  })(window, document, location, typeof jQuery !== 'undefined' && jQuery);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Fotorama 4.5.2 | http://fotorama.io/license/
2
+ * Fotorama 4.6.0 | http://fotorama.io/license/
3
3
  */
4
4
  .fotorama__nav__frame:focus .fotorama__dot:after, .fotorama__nav__frame:focus .fotorama__thumb:after, .fotorama__fullscreen-icon:focus:after,
5
5
  .fotorama__arr:focus:after, .fotorama__stage__shaft, .fotorama__stage__frame, .fotorama__img, .fotorama__html, .fotorama__video iframe {
@@ -52,8 +52,8 @@
52
52
  .fotorama__wrap--css3 .fotorama__nav,
53
53
  .fotorama__wrap--css3 .fotorama__stage__frame, .fotorama__wrap--css3 .fotorama__stage .fotorama__img,
54
54
  .fotorama__wrap--css3 .fotorama__html, .fotorama__stage:before, .fotorama__stage:after, .fotorama__nav:before, .fotorama__nav:after {
55
- -webkit-transform: translate3d(0.001px, 0, 0);
56
- transform: translate3d(0.001px, 0, 0); }
55
+ -webkit-transform: translateZ(0);
56
+ transform: translateZ(0); }
57
57
 
58
58
  .fotorama__nav__frame, .fotorama__fullscreen-icon:focus,
59
59
  .fotorama__arr:focus {
@@ -75,11 +75,9 @@
75
75
  .fotorama__wrap--css3 .fotorama__stage__shaft,
76
76
  .fotorama__wrap--css3 .fotorama__nav__shaft,
77
77
  .fotorama__wrap--css3 .fotorama__thumb-border {
78
- -webkit-transition-property: -webkit-transform, width;
78
+ transition-property: -webkit-transform, width;
79
79
  transition-property: transform, width;
80
- -webkit-transition-timing-function: cubic-bezier(0.1, 0, 0.25, 1);
81
80
  transition-timing-function: cubic-bezier(0.1, 0, 0.25, 1);
82
- -webkit-transition-duration: 0ms;
83
81
  transition-duration: 0ms; }
84
82
 
85
83
  .fotorama__wrap, .fotorama__no-select, .fotorama__arr,
@@ -102,7 +100,6 @@
102
100
  padding: 0; }
103
101
 
104
102
  .fotorama__nav__shaft, .fotorama__nav__frame, .fotorama__caption__wrap {
105
- display: -moz-inline-box;
106
103
  -moz-box-orient: vertical;
107
104
  display: inline-block;
108
105
  vertical-align: middle;
@@ -110,11 +107,9 @@
110
107
  *zoom: 1; }
111
108
 
112
109
  .fotorama__wrap * {
113
- -moz-box-sizing: content-box;
114
110
  box-sizing: content-box; }
115
111
 
116
112
  .fotorama__caption__wrap {
117
- -moz-box-sizing: border-box;
118
113
  box-sizing: border-box; }
119
114
 
120
115
  .fotorama--hidden, .fotorama__load {
@@ -321,7 +316,6 @@
321
316
  left: 0;
322
317
  border-style: solid;
323
318
  border-color: #00afea;
324
- background-image: -webkit-linear-gradient(top left, rgba(255, 255, 255, 0.25), rgba(64, 64, 64, 0.1));
325
319
  background-image: linear-gradient(to bottom right, rgba(255, 255, 255, 0.25), rgba(64, 64, 64, 0.1)); }
326
320
 
327
321
  .fotorama__caption {
@@ -375,11 +369,8 @@
375
369
  animation: spinner 24s infinite linear; }
376
370
  .fotorama__wrap--css3 .fotorama__stage .fotorama__img,
377
371
  .fotorama__wrap--css3 .fotorama__html {
378
- -webkit-transition-property: opacity;
379
372
  transition-property: opacity;
380
- -webkit-transition-timing-function: linear;
381
373
  transition-timing-function: linear;
382
- -webkit-transition-duration: 0.3s;
383
374
  transition-duration: 0.3s; }
384
375
 
385
376
  .fotorama__wrap--video .fotorama__stage__frame--video .fotorama__img,
@@ -458,7 +449,7 @@
458
449
  opacity: 0; }
459
450
  .fotorama__wrap--css2 .fotorama__video-play, .fotorama__wrap--video .fotorama__stage .fotorama__video-play {
460
451
  display: none; }
461
- .fotorama__loaded .fotorama__video-play, .fotorama__error .fotorama__video-play {
452
+ .fotorama__loaded .fotorama__video-play, .fotorama__error .fotorama__video-play, .fotorama__nav__frame .fotorama__video-play {
462
453
  opacity: 1;
463
454
  display: block; }
464
455
  .fotorama__nav__frame .fotorama__video-play {
@@ -532,9 +523,8 @@
532
523
  .fotorama__wrap--css3 .fotorama__fullscreen-icon:not(:focus),
533
524
  .fotorama__wrap--css3 .fotorama__video-play:not(:focus),
534
525
  .fotorama__wrap--css3 .fotorama__video-close:not(:focus) {
535
- -webkit-transition-property: -webkit-transform, opacity;
526
+ transition-property: -webkit-transform, opacity;
536
527
  transition-property: transform, opacity;
537
- -webkit-transition-duration: 0.3s;
538
528
  transition-duration: 0.3s; }
539
529
 
540
530
  .fotorama__stage:before, .fotorama__stage:after, .fotorama__nav:before, .fotorama__nav:after {
@@ -551,14 +541,12 @@
551
541
  background-repeat: no-repeat;
552
542
  background-size: 1px 100%, 5px 100%; }
553
543
  .fotorama__stage:before, .fotorama__nav:before {
554
- background-image: -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.2) 25%, rgba(0, 0, 0, 0.3) 75%, transparent), -webkit-radial-gradient(0 50%, farthest-side, rgba(0, 0, 0, 0.4), transparent);
555
544
  background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.2) 25%, rgba(0, 0, 0, 0.3) 75%, transparent), radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.4), transparent);
556
545
  background-position: 0 0, 0 0;
557
546
  left: -10px; }
558
547
  .fotorama__stage.fotorama__shadows--left:before, .fotorama__nav.fotorama__shadows--left:before {
559
548
  left: 0; }
560
549
  .fotorama__stage:after, .fotorama__nav:after {
561
- background-image: -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.2) 25%, rgba(0, 0, 0, 0.3) 75%, transparent), -webkit-radial-gradient(100% 50%, farthest-side, rgba(0, 0, 0, 0.4), transparent);
562
550
  background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.2) 25%, rgba(0, 0, 0, 0.3) 75%, transparent), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.4), transparent);
563
551
  background-position: 100% 0, 100% 0;
564
552
  right: -10px; }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fotoramajs
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.2
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Polikarpov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-23 00:00:00.000000000 Z
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets