fotoramajs 4.6.0 → 4.6.2

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: 5b0207c19b7c301a3da409bb7c89feb4f8c6fdff
4
- data.tar.gz: 82d0f887b3963ebd1d757271b44303311e6a6124
3
+ metadata.gz: 51c6e27bd919bc52488eb9cbe1cc82d759379c3f
4
+ data.tar.gz: 7abf54e71c6f7f59cac21cc1f6ab5af0437d5145
5
5
  SHA512:
6
- metadata.gz: 39446b490a9a15d3708cd1c9647336918ab11057f2b56a7f3c63669792136e22a48caa6b797b95959a0a7bc3cb4bc80a0ad34b48688121af24023954ca491ddc
7
- data.tar.gz: 2d954bb8f1aa80e594e9eabea0d4d1b32585f199fc73c066f14255968ca5698ede8437594ca5411b506260fd6bfd860df8fac58a942764cf773d12c296872415
6
+ metadata.gz: fb07214cb1485ff0a0094c6502fdd6b967d5b92c2e9f3aa34a47eb00adc8ffd921790cdb536c367385ca2724e7ea39defec75ce30826b857b459b7ff10a6afba
7
+ data.tar.gz: b7d72866ffd1de13ec1b541a7423abacdebde6e24abd29c5be6d1320f63d861cdfc4f491d3bc850eeb3f6b061e33279c1e2961d8b7fc97778c8868c4a3115ea5
@@ -1,3 +1,3 @@
1
1
  module Fotoramajs
2
- VERSION = "4.6.0"
2
+ VERSION = "4.6.2"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * Fotorama 4.6.0 | http://fotorama.io/license/
2
+ * Fotorama 4.6.2 | http://fotorama.io/license/
3
3
  */
4
- fotoramaVersion = '4.6.0';
4
+ fotoramaVersion = '4.6.2';
5
5
  (function (window, document, location, $, undefined) {
6
6
  "use strict";
7
7
  var _fotoramaClass = 'fotorama',
@@ -929,6 +929,8 @@ var $WINDOW = $(window),
929
929
  swipe: true,
930
930
  trackpad: false,
931
931
 
932
+ enableifsingleframe: false,
933
+
932
934
  controlsonstart: true,
933
935
 
934
936
  shuffle: false,
@@ -980,9 +982,12 @@ function getDuration (time) {
980
982
  return {'transition-duration': time + 'ms'};
981
983
  }
982
984
 
985
+ function unlessNaN (value, alternative) {
986
+ return isNaN(value) ? alternative : value;
987
+ }
988
+
983
989
  function numberFromMeasure (value, measure) {
984
- value = +String(value).replace(measure || 'px', '');
985
- return isNaN(value) ? undefined : value;
990
+ return unlessNaN(+String(value).replace(measure || 'px', ''));
986
991
  }
987
992
 
988
993
  function numberFromPercent (value) {
@@ -990,7 +995,7 @@ function numberFromPercent (value) {
990
995
  }
991
996
 
992
997
  function numberFromWhatever (value, whole) {
993
- return numberFromPercent(value) / 100 * whole || numberFromMeasure(value);
998
+ return unlessNaN(numberFromPercent(value) / 100 * whole, numberFromMeasure(value));
994
999
  }
995
1000
 
996
1001
  function measureIsValid (value) {
@@ -1237,16 +1242,33 @@ function isDetached (el) {
1237
1242
  return !$.contains(document.documentElement, el);
1238
1243
  }
1239
1244
 
1240
- function waitFor (test, fn, timeout) {
1245
+ function waitFor (test, fn, timeout, i) {
1246
+ if (!waitFor.i) {
1247
+ waitFor.i = 1;
1248
+ waitFor.ii = [true];
1249
+ }
1250
+
1251
+ i = i || waitFor.i;
1252
+
1253
+ if (typeof waitFor.ii[i] === 'undefined') {
1254
+ waitFor.ii[i] = true;
1255
+ }
1256
+
1241
1257
  if (test()) {
1242
1258
  fn();
1243
1259
  } else {
1244
- setTimeout(function () {
1245
- waitFor(test, fn);
1260
+ waitFor.ii[i] && setTimeout(function () {
1261
+ waitFor.ii[i] && waitFor(test, fn, timeout, i);
1246
1262
  }, timeout || 100);
1247
1263
  }
1264
+
1265
+ return waitFor.i++;
1248
1266
  }
1249
1267
 
1268
+ waitFor.stop = function (i) {
1269
+ waitFor.ii[i] = false;
1270
+ };
1271
+
1250
1272
  function setHash (hash) {
1251
1273
  //////console.time('setHash ' + hash);
1252
1274
  location.replace(location.protocol
@@ -1270,6 +1292,9 @@ function fit ($el, measuresToFit, method, position) {
1270
1292
  elData.l.h !== measuresToFit.h ||
1271
1293
  elData.l.m !== method ||
1272
1294
  elData.l.p !== position)) {
1295
+
1296
+ //console.log('fit');
1297
+
1273
1298
  var width = measures.width,
1274
1299
  height = measures.height,
1275
1300
  ratio = measuresToFit.w / measuresToFit.h,
@@ -1966,6 +1991,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
1966
1991
  lastActiveIndex,
1967
1992
  prevIndex,
1968
1993
  nextIndex,
1994
+ nextAutoplayIndex,
1969
1995
  startIndex,
1970
1996
 
1971
1997
  o_loop,
@@ -2141,7 +2167,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2141
2167
  }
2142
2168
 
2143
2169
  function stageNoMove () {
2144
- var _noMove = size < 2 || $videoPlaying;
2170
+ var _noMove = (size < 2 && !opts.enableifsingleframe) || $videoPlaying;
2145
2171
  stageShaftTouchTail.noMove = _noMove || o_fade;
2146
2172
  stageShaftTouchTail.noSwipe = _noMove || !opts.swipe;
2147
2173
 
@@ -2176,16 +2202,16 @@ jQuery.Fotorama = function ($fotorama, opts) {
2176
2202
  classes[FLAG ? 'add' : 'remove'].push(value);
2177
2203
  }
2178
2204
 
2179
- //if (size > 1) { // TODO: need special option for that (disableIfSinglePhoto, типа)
2205
+ if (size > 1 || opts.enableifsingleframe) {
2180
2206
  o_nav = opts.nav;
2181
2207
  o_navTop = opts.navposition === 'top';
2182
2208
  classes.remove.push(selectClass);
2183
2209
 
2184
2210
  $arrs.toggle(!!opts.arrows);
2185
- // } else {
2186
- // o_nav = false;
2187
- // $arrs.hide();
2188
- // }
2211
+ } else {
2212
+ o_nav = false;
2213
+ $arrs.hide();
2214
+ }
2189
2215
 
2190
2216
  spinnerStop();
2191
2217
  spinner = new Spinner($.extend(spinnerDefaults, opts.spinner, spinnerOverride, {direction: o_rtl ? -1 : 1}));
@@ -2822,7 +2848,6 @@ jQuery.Fotorama = function ($fotorama, opts) {
2822
2848
  }
2823
2849
 
2824
2850
  function onTouchEnd () {
2825
- //////console.time('onTouchEnd');
2826
2851
  if (!opts.stopautoplayontouch) {
2827
2852
  releaseAutoplay();
2828
2853
  changeAutoplay();
@@ -2839,7 +2864,11 @@ jQuery.Fotorama = function ($fotorama, opts) {
2839
2864
  }
2840
2865
 
2841
2866
  function changeAutoplay () {
2867
+ ////console.log('changeAutoplay');
2868
+
2842
2869
  clearTimeout(changeAutoplay.t);
2870
+ waitFor.stop(changeAutoplay.w);
2871
+
2843
2872
  if (!opts.autoplay || pausedAutoplayFLAG) {
2844
2873
  if (that.autoplay) {
2845
2874
  that.autoplay = false;
@@ -2849,6 +2878,8 @@ jQuery.Fotorama = function ($fotorama, opts) {
2849
2878
  return;
2850
2879
  }
2851
2880
 
2881
+ ////console.log('changeAutoplay continue');
2882
+
2852
2883
  if (!that.autoplay) {
2853
2884
  that.autoplay = true;
2854
2885
  triggerEvent('startautoplay');
@@ -2858,12 +2889,25 @@ jQuery.Fotorama = function ($fotorama, opts) {
2858
2889
 
2859
2890
 
2860
2891
  var frameData = activeFrame[STAGE_FRAME_KEY].data();
2861
- waitFor(function () {
2892
+ changeAutoplay.w = waitFor(function () {
2893
+ ////console.log('wait for the state of the current frame');
2862
2894
  return frameData.state || _activeIndex !== activeIndex;
2863
2895
  }, function () {
2896
+ ////console.log('the current frame is ready');
2864
2897
  changeAutoplay.t = setTimeout(function () {
2898
+ ////console.log('changeAutoplay.t setTimeout', pausedAutoplayFLAG, _activeIndex !== activeIndex);
2865
2899
  if (pausedAutoplayFLAG || _activeIndex !== activeIndex) return;
2866
- that.show(o_loop ? getDirectionSign(!o_rtl) : normalizeIndex(activeIndex + (o_rtl ? -1 : 1)));
2900
+
2901
+ var _nextAutoplayIndex = nextAutoplayIndex,
2902
+ nextFrameData = data[_nextAutoplayIndex][STAGE_FRAME_KEY].data();
2903
+
2904
+ changeAutoplay.w = waitFor(function () {
2905
+ ////console.log('wait for the state of the next frame');
2906
+ return nextFrameData.state || _nextAutoplayIndex !== nextAutoplayIndex;
2907
+ }, function () {
2908
+ if (pausedAutoplayFLAG || _nextAutoplayIndex !== nextAutoplayIndex) return;
2909
+ that.show(o_loop ? getDirectionSign(!o_rtl) : nextAutoplayIndex);
2910
+ });
2867
2911
  }, opts.autoplay);
2868
2912
  });
2869
2913
 
@@ -2905,6 +2949,7 @@ jQuery.Fotorama = function ($fotorama, opts) {
2905
2949
  that.activeIndex = activeIndex = edgeIndex(index);
2906
2950
  prevIndex = getPrevIndex(activeIndex);
2907
2951
  nextIndex = getNextIndex(activeIndex);
2952
+ nextAutoplayIndex = normalizeIndex(activeIndex + (o_rtl ? -1 : 1));
2908
2953
  activeIndexes = [activeIndex, prevIndex, nextIndex];
2909
2954
 
2910
2955
  dirtyIndex = o_loop ? index : activeIndex;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Fotorama 4.6.0 | http://fotorama.io/license/
2
+ * Fotorama 4.6.2 | 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 {
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.6.0
4
+ version: 4.6.2
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-08-06 00:00:00.000000000 Z
11
+ date: 2014-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets