Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/mobileapp/ |
Upload File : |
(function() { BX.namespace('BX.MobileApp'); BX.MobileApp.Gesture = { addLongTapListener(node, callback, customDuration) { var touchDuration = customDuration || 500; var timerInterval; var preventTouchEnd = false; function timer(interval, targetNode) { timerInterval = setTimeout(() => { 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', () => { clearTimeout(timerInterval); }); }, }; })();