static/flat-ui/js/flat-ui.js
function simulateMouseEvent (event, simulatedType) {

    // Ignore multi-touch events
    if (event.originalEvent.touches.length > 1) {
      return;
    }

    event.preventDefault();

    var touch = event.originalEvent.changedTouches[0],
        simulatedEvent = document.createEvent('MouseEvents');
    
    // Initialize the simulated mouse event using the touch event's coordinates
    simulatedEvent.initMouseEvent(
      simulatedType,    // type
      true,             // bubbles                    
      true,             // cancelable                 
      window,           // view                       
      1,                // detail                     
      touch.screenX,    // screenX                    
      touch.screenY,    // screenY                    
      touch.clientX,    // clientX                    
      touch.clientY,    // clientY                    
      false,            // ctrlKey                    
      false,            // altKey                     
      false,            // shiftKey                   
      false,            // metaKey                    
      0,                // button                     
      null              // relatedTarget              
    );

    // Dispatch the simulated event to the target element
    event.target.dispatchEvent(simulatedEvent);
  }
function simulateMouseEvent (event, simulatedType) {

    // Ignore multi-touch events
    if (event.originalEvent.touches.length > 1) {
      return;
    }

    event.preventDefault();

    var touch = event.originalEvent.changedTouches[0],
        simulatedEvent = document.createEvent('MouseEvents');
    
    // Initialize the simulated mouse event using the touch event's coordinates
    simulatedEvent.initMouseEvent(
      simulatedType,    // type
      true,             // bubbles                    
      true,             // cancelable                 
      window,           // view                       
      1,                // detail                     
      touch.screenX,    // screenX                    
      touch.screenY,    // screenY                    
      touch.clientX,    // clientX                    
      touch.clientY,    // clientY                    
      false,            // ctrlKey                    
      false,            // altKey                     
      false,            // shiftKey                   
      false,            // metaKey                    
      0,                // button                     
      null              // relatedTarget              
    );

    // Dispatch the simulated event to the target element
    event.target.dispatchEvent(simulatedEvent);
  }
function simulateMouseEvent ( event , simulatedType ) { // Ignore multi-touch events
 if ( event . originalEvent . touches . length > 1 ) { return ; } event . preventDefault ( ) ; var touch = event . originalEvent . changedTouches [ 0 ] , simulatedEvent = document . createEvent ( 'MouseEvents' ) ; // Initialize the simulated mouse event using the touch event's coordinates
 simulatedEvent . initMouseEvent ( simulatedType , // type
 true , // bubbles                    
 true , // cancelable                 
 window , // view                       
 1 , // detail                     
 touch . screenX , // screenX                    
 touch . screenY , // screenY                    
 touch . clientX , // clientX                    
 touch . clientY , // clientY                    
 false , // ctrlKey                    
 false , // altKey                     
 false , // shiftKey                   
 false , // metaKey                    
 0 , // button                     
 null // relatedTarget              
 ) ; // Dispatch the simulated event to the target element
 event . target . dispatchEvent ( simulatedEvent ) ; }
Simulate a mouse event based on a corresponding touch event
@param {Object} event A touch event
@param {String} simulatedType The corresponding mouse event
Simulate a mouse event based on a corresponding touch event