Built files from Bizgaze WebServer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

jquerySwipeHandler.js 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. var jquerySwipeHandler = function(e) {
  2. var t = {};
  3. function n(o) {
  4. if (t[o]) return t[o].exports;
  5. var u = t[o] = {
  6. i: o,
  7. l: !1,
  8. exports: {}
  9. };
  10. return e[o].call(u.exports, u, u.exports, n), u.l = !0, u.exports
  11. }
  12. return n.m = e, n.c = t, n.d = function(e, t, o) {
  13. n.o(e, t) || Object.defineProperty(e, t, {
  14. enumerable: !0,
  15. get: o
  16. })
  17. }, n.r = function(e) {
  18. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
  19. value: "Module"
  20. }), Object.defineProperty(e, "__esModule", {
  21. value: !0
  22. })
  23. }, n.t = function(e, t) {
  24. if (1 & t && (e = n(e)), 8 & t) return e;
  25. if (4 & t && "object" == typeof e && e && e.__esModule) return e;
  26. var o = Object.create(null);
  27. if (n.r(o), Object.defineProperty(o, "default", {
  28. enumerable: !0,
  29. value: e
  30. }), 2 & t && "string" != typeof e)
  31. for (var u in e) n.d(o, u, function(t) {
  32. return e[t]
  33. }.bind(null, u));
  34. return o
  35. }, n.n = function(e) {
  36. var t = e && e.__esModule ? function() {
  37. return e.default
  38. } : function() {
  39. return e
  40. };
  41. return n.d(t, "a", t), t
  42. }, n.o = function(e, t) {
  43. return Object.prototype.hasOwnProperty.call(e, t)
  44. }, n.p = "", n(n.s = 0)
  45. }([function(e, t, n) {
  46. "use strict";
  47. n.r(t), n.d(t, "SWIPE_LEFT", function() {
  48. return o
  49. }), n.d(t, "SWIPE_RIGHT", function() {
  50. return u
  51. }), n.d(t, "SWIPE_UP", function() {
  52. return r
  53. }), n.d(t, "SWIPE_DOWN", function() {
  54. return c
  55. }), n.d(t, "CLICK", function() {
  56. return i
  57. }), n.d(t, "handleSwipe", function() {
  58. return l
  59. });
  60. const o = "SWIPE_LEFT",
  61. u = "SWIPE_RIGHT",
  62. r = "SWIPE_UP",
  63. c = "SWIPE_DOWN",
  64. i = "CLICK",
  65. f = 50, // x-direction
  66. fy= 50, // y-direction
  67. d = 700,
  68. a = 1;
  69. function l(e, t, n) {
  70. let l = void 0,
  71. s = void 0,
  72. p = !1;
  73. const h = () => {
  74. p = !0
  75. };
  76. function y(e) {
  77. return e.touches && e.touches[0] ? {
  78. x: e.touches[0].pageX,
  79. y: e.touches[0].pageY
  80. } : e.changedTouches && e.changedTouches[0] ? {
  81. x: e.changedTouches[0].pageX,
  82. y: e.changedTouches[0].pageY
  83. } : {
  84. x: e.pageX,
  85. y: e.pageY
  86. }
  87. }
  88. $(e).bind("mousedown touchstart", e => {
  89. l = Date.now(), s = y(e), "touchstart" === e.type && (t.includes(r) || t.includes(c)) && e.preventDefault(), p = !1, $(window).bind("scroll", h)
  90. }), $(e).bind("mouseup touchend", b => {
  91. if (("mouseup" !== b.type || b.which === a) && l && Date.now() - l < d) {
  92. const d = y(b),
  93. a = function(e, t) {
  94. const n = t.x - e.x,
  95. i = t.y - e.y,
  96. d = [];
  97. n > f ? d.push(u) : n < -f && d.push(o); // X - direction
  98. i > fy ? d.splice(0, d.length).push(c) : i < -fy && d.splice(0, d.length).push(r); // Y -direction
  99. return d
  100. }(s, d);
  101. let h = !1,
  102. g = !1;
  103. for (let e of a) t.includes(e) && (n(e), h = !0);
  104. a.length || p || (h || g) && (b.cancelable && "touchend" === b.type && b.preventDefault(), b.stopPropagation()), l = void 0
  105. }
  106. $(window).unbind("scroll", h)
  107. })
  108. }
  109. }]);