promethee 1.7.12 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/promethee/rails/version.rb +1 -1
  3. data/node_modules/@fancyapps/fancybox/README.md +1 -1
  4. data/node_modules/@fancyapps/fancybox/dist/jquery.fancybox.css +162 -161
  5. data/node_modules/@fancyapps/fancybox/dist/jquery.fancybox.js +1281 -790
  6. data/node_modules/@fancyapps/fancybox/dist/jquery.fancybox.min.css +1 -1
  7. data/node_modules/@fancyapps/fancybox/dist/jquery.fancybox.min.js +4 -3
  8. data/node_modules/@fancyapps/fancybox/docs/index.html +1398 -1321
  9. data/node_modules/@fancyapps/fancybox/package.json +52 -43
  10. data/node_modules/@fancyapps/fancybox/src/css/core.css +144 -142
  11. data/node_modules/@fancyapps/fancybox/src/css/thumbs.css +20 -23
  12. data/node_modules/@fancyapps/fancybox/src/js/core.js +883 -536
  13. data/node_modules/@fancyapps/fancybox/src/js/fullscreen.js +67 -64
  14. data/node_modules/@fancyapps/fancybox/src/js/guestures.js +114 -78
  15. data/node_modules/@fancyapps/fancybox/src/js/hash.js +13 -18
  16. data/node_modules/@fancyapps/fancybox/src/js/media.js +118 -29
  17. data/node_modules/@fancyapps/fancybox/src/js/share.js +8 -6
  18. data/node_modules/@fancyapps/fancybox/src/js/slideshow.js +55 -32
  19. data/node_modules/@fancyapps/fancybox/src/js/thumbs.js +22 -26
  20. data/node_modules/@fancyapps/fancybox/src/js/wheel.js +1 -1
  21. metadata +2 -46
  22. data/node_modules/fancybox/CHANGELOG.md +0 -125
  23. data/node_modules/fancybox/README.md +0 -249
  24. data/node_modules/fancybox/bower.json +0 -24
  25. data/node_modules/fancybox/demo/1_b.jpg +0 -0
  26. data/node_modules/fancybox/demo/1_s.jpg +0 -0
  27. data/node_modules/fancybox/demo/2_b.jpg +0 -0
  28. data/node_modules/fancybox/demo/2_s.jpg +0 -0
  29. data/node_modules/fancybox/demo/3_b.jpg +0 -0
  30. data/node_modules/fancybox/demo/3_s.jpg +0 -0
  31. data/node_modules/fancybox/demo/4_b.jpg +0 -0
  32. data/node_modules/fancybox/demo/4_s.jpg +0 -0
  33. data/node_modules/fancybox/demo/5_b.jpg +0 -0
  34. data/node_modules/fancybox/demo/5_s.jpg +0 -0
  35. data/node_modules/fancybox/demo/ajax.txt +0 -15
  36. data/node_modules/fancybox/demo/iframe.html +0 -26
  37. data/node_modules/fancybox/demo/index.html +0 -312
  38. data/node_modules/fancybox/dist/css/jquery.fancybox.css +0 -222
  39. data/node_modules/fancybox/dist/helpers/css/jquery.fancybox-buttons.css +0 -82
  40. data/node_modules/fancybox/dist/helpers/css/jquery.fancybox-thumbs.css +0 -46
  41. data/node_modules/fancybox/dist/helpers/img/fancybox_buttons.png +0 -0
  42. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-buttons.cjs.js +0 -121
  43. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-buttons.js +0 -122
  44. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-media.cjs.js +0 -199
  45. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-media.js +0 -199
  46. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-thumbs.cjs.js +0 -164
  47. data/node_modules/fancybox/dist/helpers/js/jquery.fancybox-thumbs.js +0 -165
  48. data/node_modules/fancybox/dist/helpers/scss/jquery.fancybox-buttons.scss +0 -100
  49. data/node_modules/fancybox/dist/helpers/scss/jquery.fancybox-thumbs.scss +0 -55
  50. data/node_modules/fancybox/dist/img/blank.gif +0 -0
  51. data/node_modules/fancybox/dist/img/fancybox_loading.gif +0 -0
  52. data/node_modules/fancybox/dist/img/fancybox_loading@2x.gif +0 -0
  53. data/node_modules/fancybox/dist/img/fancybox_overlay.png +0 -0
  54. data/node_modules/fancybox/dist/img/fancybox_sprite.png +0 -0
  55. data/node_modules/fancybox/dist/img/fancybox_sprite@2x.png +0 -0
  56. data/node_modules/fancybox/dist/js/jquery.fancybox.cjs.js +0 -2027
  57. data/node_modules/fancybox/dist/js/jquery.fancybox.js +0 -2018
  58. data/node_modules/fancybox/dist/js/jquery.fancybox.pack.js +0 -46
  59. data/node_modules/fancybox/dist/scss/jquery.fancybox.scss +0 -276
  60. data/node_modules/fancybox/fancybox.jquery.json +0 -31
  61. data/node_modules/fancybox/lib/jquery-1.10.2.min.js +0 -6
  62. data/node_modules/fancybox/lib/jquery.mousewheel.pack.js +0 -14
  63. data/node_modules/fancybox/package.json +0 -32
  64. data/node_modules/fancybox/sprite.psd +0 -0
  65. data/node_modules/fancybox/test.js +0 -10
@@ -57,59 +57,82 @@
57
57
  return false;
58
58
  })();
59
59
 
60
- // If browser does not have Full Screen API, then simply unset default button template and stop
61
- if (!fn) {
62
- if ($ && $.fancybox) {
63
- $.fancybox.defaults.btnTpl.fullScreen = false;
64
- }
60
+ if (fn) {
61
+ var FullScreen = {
62
+ request: function(elem) {
63
+ elem = elem || document.documentElement;
64
+
65
+ elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
66
+ },
67
+ exit: function() {
68
+ document[fn.exitFullscreen]();
69
+ },
70
+ toggle: function(elem) {
71
+ elem = elem || document.documentElement;
72
+
73
+ if (this.isFullscreen()) {
74
+ this.exit();
75
+ } else {
76
+ this.request(elem);
77
+ }
78
+ },
79
+ isFullscreen: function() {
80
+ return Boolean(document[fn.fullscreenElement]);
81
+ },
82
+ enabled: function() {
83
+ return Boolean(document[fn.fullscreenEnabled]);
84
+ }
85
+ };
86
+
87
+ $.extend(true, $.fancybox.defaults, {
88
+ btnTpl: {
89
+ fullScreen:
90
+ '<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}">' +
91
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>' +
92
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/></svg>' +
93
+ "</button>"
94
+ },
95
+ fullScreen: {
96
+ autoStart: false
97
+ }
98
+ });
65
99
 
66
- return;
67
- }
100
+ $(document).on(fn.fullscreenchange, function() {
101
+ var isFullscreen = FullScreen.isFullscreen(),
102
+ instance = $.fancybox.getInstance();
68
103
 
69
- var FullScreen = {
70
- request: function(elem) {
71
- elem = elem || document.documentElement;
104
+ if (instance) {
105
+ // If image is zooming, then force to stop and reposition properly
106
+ if (instance.current && instance.current.type === "image" && instance.isAnimating) {
107
+ instance.current.$content.css("transition", "none");
72
108
 
73
- elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
74
- },
75
- exit: function() {
76
- document[fn.exitFullscreen]();
77
- },
78
- toggle: function(elem) {
79
- elem = elem || document.documentElement;
109
+ instance.isAnimating = false;
80
110
 
81
- if (this.isFullscreen()) {
82
- this.exit();
83
- } else {
84
- this.request(elem);
111
+ instance.update(true, true, 0);
112
+ }
113
+
114
+ instance.trigger("onFullscreenChange", isFullscreen);
115
+
116
+ instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen);
117
+
118
+ instance.$refs.toolbar
119
+ .find("[data-fancybox-fullscreen]")
120
+ .toggleClass("fancybox-button--fsenter", !isFullscreen)
121
+ .toggleClass("fancybox-button--fsexit", isFullscreen);
85
122
  }
86
- },
87
- isFullscreen: function() {
88
- return Boolean(document[fn.fullscreenElement]);
89
- },
90
- enabled: function() {
91
- return Boolean(document[fn.fullscreenEnabled]);
92
- }
93
- };
94
-
95
- $.extend(true, $.fancybox.defaults, {
96
- btnTpl: {
97
- fullScreen:
98
- '<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fullscreen" title="{{FULL_SCREEN}}">' +
99
- '<svg viewBox="0 0 40 40">' +
100
- '<path d="M9,12 v16 h22 v-16 h-22 v8" />' +
101
- "</svg>" +
102
- "</button>"
103
- },
104
- fullScreen: {
105
- autoStart: false
106
- }
107
- });
123
+ });
124
+ }
108
125
 
109
126
  $(document).on({
110
127
  "onInit.fb": function(e, instance) {
111
128
  var $container;
112
129
 
130
+ if (!fn) {
131
+ instance.$refs.toolbar.find("[data-fancybox-fullscreen]").remove();
132
+
133
+ return;
134
+ }
135
+
113
136
  if (instance && instance.group[instance.currIndex].opts.fullScreen) {
114
137
  $container = instance.$refs.container;
115
138
 
@@ -146,24 +169,4 @@
146
169
  }
147
170
  }
148
171
  });
149
-
150
- $(document).on(fn.fullscreenchange, function() {
151
- var isFullscreen = FullScreen.isFullscreen(),
152
- instance = $.fancybox.getInstance();
153
-
154
- if (instance) {
155
- // If image is zooming, then force to stop and reposition properly
156
- if (instance.current && instance.current.type === "image" && instance.isAnimating) {
157
- instance.current.$content.css("transition", "none");
158
-
159
- instance.isAnimating = false;
160
-
161
- instance.update(true, true, 0);
162
- }
163
-
164
- instance.trigger("onFullscreenChange", isFullscreen);
165
-
166
- instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen);
167
- }
168
- });
169
- })(document, window.jQuery || jQuery);
172
+ })(document, jQuery);
@@ -71,7 +71,7 @@
71
71
 
72
72
  var isClickable = function($el) {
73
73
  if (
74
- $el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio') ||
74
+ $el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') ||
75
75
  $.isFunction($el.get(0).onclick) ||
76
76
  $el.data("selectable")
77
77
  ) {
@@ -132,7 +132,21 @@
132
132
  };
133
133
 
134
134
  Guestures.prototype.destroy = function() {
135
- this.$container.off(".fb.touch");
135
+ var self = this;
136
+
137
+ self.$container.off(".fb.touch");
138
+
139
+ $(document).off(".fb.touch");
140
+
141
+ if (self.requestId) {
142
+ cancelAFrame(self.requestId);
143
+ self.requestId = null;
144
+ }
145
+
146
+ if (self.tapped) {
147
+ clearTimeout(self.tapped);
148
+ self.tapped = null;
149
+ }
136
150
  };
137
151
 
138
152
  Guestures.prototype.ontouchstart = function(e) {
@@ -140,6 +154,7 @@
140
154
  $target = $(e.target),
141
155
  instance = self.instance,
142
156
  current = instance.current,
157
+ $slide = current.$slide,
143
158
  $content = current.$content,
144
159
  isTouchDevice = e.type == "touchstart";
145
160
 
@@ -154,17 +169,16 @@
154
169
  }
155
170
 
156
171
  // Ignore taping on links, buttons, input elements
157
- if (!$target.length || isClickable($target) || isClickable($target.parent())) {
172
+ if (!$slide.length || !$target.length || isClickable($target) || isClickable($target.parent())) {
158
173
  return;
159
174
  }
160
-
161
175
  // Ignore clicks on the scrollbar
162
176
  if (!$target.is("img") && e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left) {
163
177
  return;
164
178
  }
165
179
 
166
180
  // Ignore clicks while zooming or closing
167
- if (!current || instance.isAnimating || instance.isClosing) {
181
+ if (!current || instance.isAnimating || current.$slide.hasClass("fancybox-animated")) {
168
182
  e.stopPropagation();
169
183
  e.preventDefault();
170
184
 
@@ -177,7 +191,10 @@
177
191
  return;
178
192
  }
179
193
 
180
- e.stopPropagation();
194
+ // Allow other scripts to catch touch event if "touch" is set to false
195
+ if (current.touch) {
196
+ e.stopPropagation();
197
+ }
181
198
 
182
199
  self.startEvent = e;
183
200
 
@@ -190,16 +207,17 @@
190
207
  self.isSwiping = false;
191
208
  self.isZooming = false;
192
209
  self.isScrolling = false;
210
+ self.canPan = instance.canPan();
193
211
 
194
212
  self.startTime = new Date().getTime();
195
213
  self.distanceX = self.distanceY = self.distance = 0;
196
214
 
197
- self.canvasWidth = Math.round(current.$slide[0].clientWidth);
198
- self.canvasHeight = Math.round(current.$slide[0].clientHeight);
215
+ self.canvasWidth = Math.round($slide[0].clientWidth);
216
+ self.canvasHeight = Math.round($slide[0].clientHeight);
199
217
 
200
218
  self.contentLastPos = null;
201
219
  self.contentStartPos = $.fancybox.getTranslate(self.$content) || {top: 0, left: 0};
202
- self.sliderStartPos = self.sliderLastPos || $.fancybox.getTranslate(current.$slide);
220
+ self.sliderStartPos = $.fancybox.getTranslate($slide);
203
221
 
204
222
  // Since position will be absolute, but we need to make it relative to the stage
205
223
  self.stagePos = $.fancybox.getTranslate(instance.$refs.stage);
@@ -219,32 +237,38 @@
219
237
  document.addEventListener("scroll", self.onscroll, true);
220
238
  }
221
239
 
222
- if (!(self.opts || instance.canPan()) || !($target.is(self.$stage) || self.$stage.find($target).length)) {
240
+ // Skip if clicked outside the sliding area
241
+ if (!(self.opts || self.canPan) || !($target.is(self.$stage) || self.$stage.find($target).length)) {
223
242
  if ($target.is(".fancybox-image")) {
224
243
  e.preventDefault();
225
244
  }
226
245
 
227
- return;
246
+ if (!($.fancybox.isMobile && $target.hasClass("fancybox-caption"))) {
247
+ return;
248
+ }
228
249
  }
229
250
 
230
- if (!($.fancybox.isMobile && (isScrollable($target) || isScrollable($target.parent())))) {
251
+ self.isScrollable = isScrollable($target) || isScrollable($target.parent());
252
+
253
+ // Check if element is scrollable and try to prevent default behavior (scrolling)
254
+ if (!($.fancybox.isMobile && self.isScrollable)) {
231
255
  e.preventDefault();
232
256
  }
233
257
 
258
+ // One finger or mouse click - swipe or pan an image
234
259
  if (self.startPoints.length === 1 || current.hasError) {
235
- if (self.instance.canPan()) {
260
+ if (self.canPan) {
236
261
  $.fancybox.stop(self.$content);
237
262
 
238
- self.$content.css("transition-duration", "");
239
-
240
263
  self.isPanning = true;
241
264
  } else {
242
265
  self.isSwiping = true;
243
266
  }
244
267
 
245
- self.$container.addClass("fancybox-controls--isGrabbing");
268
+ self.$container.addClass("fancybox-is-grabbing");
246
269
  }
247
270
 
271
+ // Two fingers - zoom image
248
272
  if (self.startPoints.length === 2 && current.type === "image" && (current.isLoaded || current.$ghost)) {
249
273
  self.canTap = false;
250
274
  self.isSwiping = false;
@@ -254,8 +278,6 @@
254
278
 
255
279
  $.fancybox.stop(self.$content);
256
280
 
257
- self.$content.css("transition-duration", "");
258
-
259
281
  self.centerPointStartX = (self.startPoints[0].x + self.startPoints[1].x) * 0.5 - $(window).scrollLeft();
260
282
  self.centerPointStartY = (self.startPoints[0].y + self.startPoints[1].y) * 0.5 - $(window).scrollTop();
261
283
 
@@ -275,8 +297,7 @@
275
297
  };
276
298
 
277
299
  Guestures.prototype.ontouchmove = function(e) {
278
- var self = this,
279
- $target = $(e.target);
300
+ var self = this;
280
301
 
281
302
  // Make sure user has not released over iframe or disabled element
282
303
  if (e.originalEvent.buttons !== undefined && e.originalEvent.buttons === 0) {
@@ -284,15 +305,14 @@
284
305
  return;
285
306
  }
286
307
 
287
- if (self.isScrolling || !($target.is(self.$stage) || self.$stage.find($target).length)) {
308
+ if (self.isScrolling) {
288
309
  self.canTap = false;
289
-
290
310
  return;
291
311
  }
292
312
 
293
313
  self.newPoints = getPointerXY(e);
294
314
 
295
- if (!(self.opts || self.instance.canPan()) || !self.newPoints.length || !self.newPoints.length) {
315
+ if (!(self.opts || self.canPan) || !self.newPoints.length || !self.newPoints.length) {
296
316
  return;
297
317
  }
298
318
 
@@ -319,6 +339,7 @@
319
339
 
320
340
  Guestures.prototype.onSwipe = function(e) {
321
341
  var self = this,
342
+ instance = self.instance,
322
343
  swiping = self.isSwiping,
323
344
  left = self.sliderStartPos.left || 0,
324
345
  angle;
@@ -329,44 +350,60 @@
329
350
  if (Math.abs(self.distance) > 10) {
330
351
  self.canTap = false;
331
352
 
332
- if (self.instance.group.length < 2 && self.opts.vertical) {
353
+ if (instance.group.length < 2 && self.opts.vertical) {
333
354
  self.isSwiping = "y";
334
- } else if (self.instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) {
355
+ } else if (instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) {
335
356
  self.isSwiping = "x";
336
357
  } else {
337
- angle = Math.abs(Math.atan2(self.distanceY, self.distanceX) * 180 / Math.PI);
358
+ angle = Math.abs((Math.atan2(self.distanceY, self.distanceX) * 180) / Math.PI);
338
359
 
339
360
  self.isSwiping = angle > 45 && angle < 135 ? "y" : "x";
340
361
  }
341
362
 
342
- self.canTap = false;
343
-
344
- if (self.isSwiping === "y" && $.fancybox.isMobile && (isScrollable(self.$target) || isScrollable(self.$target.parent()))) {
363
+ if (self.isSwiping === "y" && $.fancybox.isMobile && self.isScrollable) {
345
364
  self.isScrolling = true;
346
365
 
347
366
  return;
348
367
  }
349
368
 
350
- self.instance.isDragging = self.isSwiping;
369
+ instance.isDragging = self.isSwiping;
351
370
 
352
371
  // Reset points to avoid jumping, because we dropped first swipes to calculate the angle
353
372
  self.startPoints = self.newPoints;
354
373
 
355
- $.each(self.instance.slides, function(index, slide) {
356
- $.fancybox.stop(slide.$slide);
357
-
358
- slide.$slide.css("transition-duration", "");
374
+ $.each(instance.slides, function(index, slide) {
375
+ var slidePos, stagePos;
359
376
 
360
- slide.inTransition = false;
377
+ $.fancybox.stop(slide.$slide);
361
378
 
362
- if (slide.pos === self.instance.current.pos) {
363
- self.sliderStartPos.left = $.fancybox.getTranslate(slide.$slide).left - $.fancybox.getTranslate(self.instance.$refs.stage).left;
379
+ slidePos = $.fancybox.getTranslate(slide.$slide);
380
+ stagePos = $.fancybox.getTranslate(instance.$refs.stage);
381
+
382
+ slide.$slide
383
+ .css({
384
+ transform: "",
385
+ opacity: "",
386
+ "transition-duration": ""
387
+ })
388
+ .removeClass("fancybox-animated")
389
+ .removeClass(function(index, className) {
390
+ return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
391
+ });
392
+
393
+ if (slide.pos === instance.current.pos) {
394
+ self.sliderStartPos.top = slidePos.top - stagePos.top;
395
+ self.sliderStartPos.left = slidePos.left - stagePos.left;
364
396
  }
397
+
398
+ $.fancybox.setTranslate(slide.$slide, {
399
+ top: slidePos.top - stagePos.top,
400
+ left: slidePos.left - stagePos.left
401
+ });
365
402
  });
366
403
 
367
404
  // Stop slideshow
368
- if (self.instance.SlideShow && self.instance.SlideShow.isActive) {
369
- self.instance.SlideShow.stop();
405
+ if (instance.SlideShow && instance.SlideShow.isActive) {
406
+ instance.SlideShow.stop();
370
407
  }
371
408
  }
372
409
 
@@ -433,8 +470,6 @@
433
470
 
434
471
  if (self.requestId) {
435
472
  cancelAFrame(self.requestId);
436
-
437
- self.requestId = null;
438
473
  }
439
474
 
440
475
  self.requestId = requestAFrame(function() {
@@ -583,8 +618,6 @@
583
618
 
584
619
  if (self.requestId) {
585
620
  cancelAFrame(self.requestId);
586
-
587
- self.requestId = null;
588
621
  }
589
622
 
590
623
  self.requestId = requestAFrame(function() {
@@ -594,7 +627,6 @@
594
627
 
595
628
  Guestures.prototype.ontouchend = function(e) {
596
629
  var self = this;
597
- var dMs = Math.max(new Date().getTime() - self.startTime, 1);
598
630
 
599
631
  var swiping = self.isSwiping;
600
632
  var panning = self.isPanning;
@@ -602,8 +634,9 @@
602
634
  var scrolling = self.isScrolling;
603
635
 
604
636
  self.endPoints = getPointerXY(e);
637
+ self.dMs = Math.max(new Date().getTime() - self.startTime, 1);
605
638
 
606
- self.$container.removeClass("fancybox-controls--isGrabbing");
639
+ self.$container.removeClass("fancybox-is-grabbing");
607
640
 
608
641
  $(document).off(".fb.touch");
609
642
 
@@ -626,13 +659,11 @@
626
659
  return self.onTap(e);
627
660
  }
628
661
 
629
- self.speed = 366;
662
+ self.speed = 100;
630
663
 
631
664
  // Speed in px/ms
632
- self.velocityX = self.distanceX / dMs * 0.5;
633
- self.velocityY = self.distanceY / dMs * 0.5;
634
-
635
- self.speedX = Math.max(self.speed * 0.5, Math.min(self.speed * 1.5, 1 / Math.abs(self.velocityX) * self.speed));
665
+ self.velocityX = (self.distanceX / self.dMs) * 0.5;
666
+ self.velocityY = (self.distanceY / self.dMs) * 0.5;
636
667
 
637
668
  if (panning) {
638
669
  self.endPanning();
@@ -648,7 +679,10 @@
648
679
  Guestures.prototype.endSwiping = function(swiping, scrolling) {
649
680
  var self = this,
650
681
  ret = false,
651
- len = self.instance.group.length;
682
+ len = self.instance.group.length,
683
+ distanceX = Math.abs(self.distanceX),
684
+ canAdvance = swiping == "x" && len > 1 && ((self.dMs > 130 && distanceX > 10) || distanceX > 50),
685
+ speedX = 300;
652
686
 
653
687
  self.sliderLastPos = null;
654
688
 
@@ -663,20 +697,15 @@
663
697
  },
664
698
  200
665
699
  );
666
-
667
- ret = self.instance.close(true, 200);
668
- } else if (swiping == "x" && self.distanceX > 50 && len > 1) {
669
- ret = self.instance.previous(self.speedX);
670
- } else if (swiping == "x" && self.distanceX < -50 && len > 1) {
671
- ret = self.instance.next(self.speedX);
700
+ ret = self.instance.close(true, 250);
701
+ } else if (canAdvance && self.distanceX > 0) {
702
+ ret = self.instance.previous(speedX);
703
+ } else if (canAdvance && self.distanceX < 0) {
704
+ ret = self.instance.next(speedX);
672
705
  }
673
706
 
674
707
  if (ret === false && (swiping == "x" || swiping == "y")) {
675
- if (scrolling || len < 2) {
676
- self.instance.centerSlide(self.instance.current, 150);
677
- } else {
678
- self.instance.jumpTo(self.instance.current.index);
679
- }
708
+ self.instance.centerSlide(200);
680
709
  }
681
710
 
682
711
  self.$container.removeClass("fancybox-is-sliding");
@@ -685,20 +714,22 @@
685
714
  // Limit panning from edges
686
715
  // ========================
687
716
  Guestures.prototype.endPanning = function() {
688
- var self = this;
689
- var newOffsetX, newOffsetY, newPos;
717
+ var self = this,
718
+ newOffsetX,
719
+ newOffsetY,
720
+ newPos;
690
721
 
691
722
  if (!self.contentLastPos) {
692
723
  return;
693
724
  }
694
725
 
695
- if (self.opts.momentum === false) {
726
+ if (self.opts.momentum === false || self.dMs > 350) {
696
727
  newOffsetX = self.contentLastPos.left;
697
728
  newOffsetY = self.contentLastPos.top;
698
729
  } else {
699
730
  // Continue movement
700
- newOffsetX = self.contentLastPos.left + self.velocityX * self.speed;
701
- newOffsetY = self.contentLastPos.top + self.velocityY * self.speed;
731
+ newOffsetX = self.contentLastPos.left + self.velocityX * 500;
732
+ newOffsetY = self.contentLastPos.top + self.velocityY * 500;
702
733
  }
703
734
 
704
735
  newPos = self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height);
@@ -745,9 +776,6 @@
745
776
  } else {
746
777
  newPos = self.limitPosition(newOffsetX, newOffsetY, newWidth, newHeight);
747
778
 
748
- // Switch from scale() to width/height or animation will not work correctly
749
- $.fancybox.setTranslate(self.$content, $.fancybox.getTranslate(self.$content));
750
-
751
779
  $.fancybox.animate(self.$content, newPos, 150);
752
780
  }
753
781
  };
@@ -784,7 +812,7 @@
784
812
  break;
785
813
 
786
814
  case "toggleControls":
787
- instance.toggleControls(true);
815
+ instance.toggleControls();
788
816
 
789
817
  break;
790
818
 
@@ -867,7 +895,9 @@
867
895
  self.tapped = setTimeout(function() {
868
896
  self.tapped = null;
869
897
 
870
- process("click" + where);
898
+ if (!instance.isAnimating) {
899
+ process("click" + where);
900
+ }
871
901
  }, 500);
872
902
  } else {
873
903
  process("click" + where);
@@ -877,9 +907,15 @@
877
907
  return this;
878
908
  };
879
909
 
880
- $(document).on("onActivate.fb", function(e, instance) {
881
- if (instance && !instance.Guestures) {
882
- instance.Guestures = new Guestures(instance);
883
- }
884
- });
885
- })(window, document, window.jQuery || jQuery);
910
+ $(document)
911
+ .on("onActivate.fb", function(e, instance) {
912
+ if (instance && !instance.Guestures) {
913
+ instance.Guestures = new Guestures(instance);
914
+ }
915
+ })
916
+ .on("beforeClose.fb", function(e, instance) {
917
+ if (instance && instance.Guestures) {
918
+ instance.Guestures.destroy();
919
+ }
920
+ });
921
+ })(window, document, jQuery);