Файл: contao-3.5.8/assets/mootools/core/1.5.1/mootools-mobile.js
Строк: 186
<?php
/* MooTools mobile, (c) Christoph Pojer, MIT-style license */
!function(){[Element,Window,Document].invoke("implement",{hasEvent:function(n){var e=this.retrieve("events"),t=e&&e[n]?e[n].values:null;if(t)for(var o=t.length;o--;)if(o in t)return!0;return!1}});var n=function(n,e,t){return e=n[e],t=n[t],function(n,o){t&&!this.hasEvent(o)&&t.call(this,n,o),e&&e.call(this,n,o)}},e=function(n,e,t){return function(o,i){e[t].call(this,o,i),n[t].call(this,o,i)}},t=Element.Events;Element.defineCustomEvent=function(o,i){var c=t[i.base];return i.onAdd=n(i,"onAdd","onSetup"),i.onRemove=n(i,"onRemove","onTeardown"),t[o]=c?Object.append({},i,{base:c.base,condition:function(n,e){return!(c.condition&&!c.condition.call(this,n,e)||i.condition&&!i.condition.call(this,n,e))},onAdd:e(i,c,"onAdd"),onRemove:e(i,c,"onRemove")}):i,this},Element.enableCustomEvents=function(){Object.each(t,function(n,e){n.onEnable&&n.onEnable.call(n,e)})},Element.disableCustomEvents=function(){Object.each(t,function(n,e){n.onDisable&&n.onDisable.call(n,e)})}}(),Browser.Features.Touch=function(){try{return document.createEvent("TouchEvent").initTouchEvent("touchstart"),!0}catch(n){}return!1}(),Browser.Features.iOSTouch=function(){var n="cantouch",e=document.html,t=!1;if(!e.addEventListener)return!1;var o=function(){e.removeEventListener(n,o,!0),t=!0};try{e.addEventListener(n,o,!0);var i=document.createEvent("TouchEvent");return i.initTouchEvent(n),e.dispatchEvent(i),t}catch(c){}return o(),!1}(),function(){var n,e,t="swipe",o=t+":distance",i=t+":cancelVertical",c=50,r={},u=function(){e=!1},a={touchstart:function(n){if(!(n.touches.length>1)){var t=n.touches[0];e=!0,r={x:t.pageX,y:t.pageY}}},touchmove:function(u){if(!n&&e){var a=u.changedTouches[0],s={x:a.pageX,y:a.pageY};if(this.retrieve(i)&&Math.abs(r.y-s.y)>10)return void(e=!1);var v=this.retrieve(o,c),h=s.x-r.x,l=-v>h,d=h>v;(d||l)&&(u.preventDefault(),e=!1,u.direction=l?"left":"right",u.start=r,u.end=s,this.fireEvent(t,u))}},touchend:u,touchcancel:u};Element.defineCustomEvent(t,{onSetup:function(){this.addEvents(a)},onTeardown:function(){this.removeEvents(a)},onEnable:function(){n=!1},onDisable:function(){n=!0,u()}})}();
?>