/*! * TouchFaker - v1.1.0 - 2015-05-21 * https://github.com/Johann-S/TouchFaker * Copyright (c) 2015 Johann SERVOIRE; Licensed MIT */ !function(){"use strict";function a(a,b,c,d,e){d=d||0,e=e||0,this.identifier=b,this.target=a,this.clientX=c.clientX+d||0,this.clientY=c.clientY+e||0,this.screenX=c.screenX+d||0,this.screenY=c.screenY+e||0,this.pageX=c.pageX+d||0,this.pageY=c.pageY+e||0}function b(){var a=[];return a.item=function(a){return this[a]||null},a.identifiedTouch=function(a){return this[a+1]||null},a}function c(){for(var a=[window,document.documentElement],b=["ontouchstart","ontouchmove","ontouchcancel","ontouchend"],c=0;c2}function e(a,b,c){var d=document.createEvent("Event");d.initEvent(a,!0,!0);var e="undefined"!=typeof c?g(c):f(b);d.touches=i(e,a,b),d.targetTouches=i(e,a,b),d.changedTouches=j(e,a,b),b.dispatchEvent(d)}function f(a){var b=a.getBoundingClientRect();return{pageX:b.left,pageY:b.top}}function g(a){var b={};return b.clientX=a.hasOwnProperty("clientX")?a.clientX:0,b.clientY=a.hasOwnProperty("clientY")?a.clientY:0,b.pageX=a.hasOwnProperty("pageX")?a.pageX:0,b.pageY=a.hasOwnProperty("pageY")?a.pageY:0,b.screenX=a.hasOwnProperty("screenX")?a.screenX:0,b.screenY=a.hasOwnProperty("screenY")?a.screenY:0,b}function h(c,d){var e=new b;return e.push(new a(d,1,c,0,0)),e}function i(a,c,d){var e=new b;return"touchend"!==c&&(e=h(a,d)),e}function j(a,b,c){var d=h(a,c);return("touchstart"===b||"touchend"===b)&&d.splice(0,1),d}document.createTouch||(document.createTouch=function(b,c,d,e,f,g,h,i,j){return(void 0===i||void 0===j)&&(i=e-window.pageXOffset,j=f-window.pageYOffset),new a(c,d,{pageX:e,pageY:f,screenX:g,screenY:h,clientX:i,clientY:j})}),document.createTouchList||(document.createTouchList=function(){for(var a=new b,c=0;c