Last active
September 10, 2018 21:29
-
-
Save pingyen/666f924c7c9272d5580fa6bd17546b47 to your computer and use it in GitHub Desktop.
Bookmarklet of Touch Events Logger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var a=document.createElement("div");a.style.cssText="position: fixed;bottom: 10px;right: 10px;padding: 10px;background: yellow;z-index: 2147483647";window.console={log:function(e){a.innerHTML+=e+"<br />\n"}};"loading"!==document.readyState?document.body.appendChild(a):document.addEventListener("DOMContentLoaded",function(){document.body.appendChild(a)},!1)})(); | |
"touchstart touchmove touchend touchcancel pointerdown pointermove pointerup pointercancel click dblclick mousedown mouseup mousemove".split(" ").forEach(function(a){document.addEventListener(a,function(a){var d=a.type,b,c;switch(d){case "touchstart":b=a.touches;break;case "touchmove":case "touchend":case "touchcancel":b=a.changedTouches}void 0===b?(c=1,b=a):(c=b.length,b=b[0]);console.log([d,b.button,b.buttons,c,a.target.nodeName,b.pageX,b.pageY,Date.now()].join(", "))},!0)}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment