PageSourceSearch

https://villy.org/_scripts/jquery/jquery.mobile.custom.min.js

js villy.org collected 2026-10-03 18:55:04 UTC 2,967 bytes, 68 lines download raw bytes

1/*! TOWeb swipe shim (#1742) — remplace jQuery Mobile v1.3.0 (meme nom de fichier, donc aucun
2 *  changement cote Delphi/inclusion). jQuery Mobile 1.3.0 utilisait $.event.props et
3 *  $.event.mouseHooks, SUPPRIMES en jQuery 3.0 -> il plantait au chargement sous jQuery 3.
4 *
5 *  TOWeb n'utilise de jQuery Mobile QUE le swipe tactile (navigation articles/albums, changement
6 *  de mois du calendrier, slider des themes), via les raccourcis $.fn.swipeleft / $.fn.swiperight.
7 *  Ce shim ne fournit donc QUE ces deux methodes, en evenements touch natifs, sans aucune API jQuery
8 *  supprimee -> compatible aussi bien jQuery 1.10.2 (actuel) que jQuery >= 3.5 (cible #1742).
9 *
10 *  Seuils repris a l'identique de jQuery Mobile 1.3.0 :
11 *    - distance horizontale minimale : 30 px
12 *    - distance verticale maximale (au-dela = scroll) : 75 px
13 *    - duree maximale du geste : 1000 ms
14 */
15(function (a, b, c, factory) {
16  if (typeof define === "function" && define.amd) {
17    define(["jquery"], function (jq) { factory(jq); return jq.mobile; });
18  } else {
19    factory(a.jQuery, a, b);
20  }
21})(typeof window !== "undefined" ? window : this, document, void 0, function ($) {
22  if (!$ || !$.fn) { return; }
23
24  // Compat : certaines pages testent l'existence de $.mobile / $.mobile.support.
25  $.mobile = $.mobile || {};
26  $.mobile.support = $.mobile.support || { touch: ("ontouchend" in document) };
27
28  var H_MIN = 30;    // px horizontaux minimum
29  var V_MAX = 75;    // px verticaux maximum (sinon c'est un scroll)
30  var T_MAX = 1000;  // ms
31
32  function touchPoint(ev) {
33    var oe = ev.originalEvent || ev;
34    var list = oe.changedTouches || oe.touches;
35    return (list && list.length) ? list[0] : oe;
36  }
37
38  function bindSwipe($set, dir, handler) {
39    if (typeof handler !== "function") { return $set; }
40    return $set.each(function () {
41      var startX = 0, startY = 0, startT = 0, tracking = false;
42      $(this)
43        .on("touchstart.twswipe", function (e) {
44          var p = touchPoint(e);
45          startX = p.pageX; startY = p.pageY;
46          startT = new Date().getTime();
47          tracking = true;
48        })
49        .on("touchend.twswipe", function (e) {
50          if (!tracking) { return; }
51          tracking = false;
52          var p = touchPoint(e);
53          var dx = p.pageX - startX;
54          var dy = p.pageY - startY;
55          var dt = new Date().getTime() - startT;
56          if (dt <= T_MAX && Math.abs(dx) >= H_MIN && Math.abs(dy) <= V_MAX) {
57            if ((dir === "left" && dx < 0) || (dir === "right" && dx > 0)) {
58              handler.call(this, e);
59            }
60          }
61        });
62    });
63  }
64
65  // API publique consommee par TOWeb : $(sel).swipeleft(fn) / $(sel).swiperight(fn).
66  $.fn.swipeleft  = function (handler) { return bindSwipe(this, "left", handler); };
67  $.fn.swiperight = function (handler) { return bindSwipe(this, "right", handler); };
68});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.