From 38c6ef7a7c705b47c5dc4165973ab2bbda4b2934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 23 Oct 2022 14:38:36 +0200 Subject: [PATCH] DEBUG --- web-fixtures/js_test.html | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/web-fixtures/js_test.html b/web-fixtures/js_test.html index 35db3d0..35339a5 100644 --- a/web-fixtures/js_test.html +++ b/web-fixtures/js_test.html @@ -91,6 +91,27 @@ $('.text-event').text('key upped: ' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); }); + // https://stackoverflow.com/a/22306212/5153116 + var eventsList = ["mousedown", "mouseup", "click", "dblclick", "mousemove", + "mouseover", "mouseout", "mousewheel", "keydown", "keyup", "keypress", + "textInput", "touchstart", "touchmove", "touchend", "touchcancel", "resize", + "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]; + + var callbackFunction = function(element, eventName) { + $( this ).find( "p" ).html( $( this ).find( "p" ).html() + ", " + eventName ); + }; + + var elements = document.querySelectorAll('*'); + for (var i = 0; i < elements.length; i++) { + for (var j = 0; j < eventsList.length; j++) { + var element = elements[i]; + var event = eventsList[j]; + + element.addEventListener(event, + callbackFunction.bind(this, element, event), true); + } + } + $( "#draggable" ).draggable(); $( "#draggable2" ).draggable({ distance: 0, @@ -103,7 +124,7 @@ }); $( "#droppable" ).droppable({ drop: function( event, ui ) { - $( this ).find( "p" ).html( 'Dropped ' + ui.draggable.data('name') + '!' ); + $( this ).find( "p" ).html( $( this ).find( "p" ).html() + ", " + 'Dropped ' + ui.draggable.data('name') + '!' ); } });