Skip to content

Commit

Permalink
DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 23, 2022
1 parent 658ec41 commit 38c6ef7
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion web-fixtures/js_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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') + '!' );
}
});

Expand Down

0 comments on commit 38c6ef7

Please sign in to comment.