Server IP : 85.193.89.191 / Your IP : 13.58.199.41 Web Server : Apache System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : bitrix ( 600) PHP Version : 8.1.27 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/bitrix/www/bitrix/js/mobileapp/ |
Upload File : |
(function(){ BX.namespace("BX.MobileApp"); BX.MobileApp.Gesture = { addLongTapListener:function (node, callback, customDuration) { var touchDuration = customDuration|| 500; var timerInterval; var preventTouchEnd = false; function timer(interval, targetNode) { timerInterval = setTimeout(function(){ tapHold(targetNode); }, interval); } var startPosition = {x: 0, y: 0}; function touchStart(e) { preventTouchEnd = false; if (e.target.tagName === "A") { return; } startPosition = {x: e.changedTouches[0].clientX, y: e.changedTouches[0].clientY}; timer(touchDuration, e.target); } function touchEnd(e) { startPosition = {x: 0, y: 0}; clearTimeout(timerInterval); if (preventTouchEnd) { e.preventDefault(); } } function touchMove(e) { var x = e.changedTouches[0].clientX; var y = e.changedTouches[0].clientY; if (Math.abs(startPosition.x - x) > 5 || Math.abs(startPosition.y - y) > 5) { startPosition = {x: 0, y: 0}; clearTimeout(timerInterval); } } function tapHold(targetNode) { clearTimeout(timerInterval); preventTouchEnd = true; if (callback) { callback(targetNode); } } BX.addClass(node, "long-tap-block"); node.addEventListener('touchstart', touchStart); node.addEventListener('touchend', touchEnd); node.addEventListener('touchmove', touchMove); BX.addCustomEvent("onNativeTouchEnd", function(){ clearTimeout(timerInterval); }) } }; })();