Created
September 7, 2012 16:51
-
-
Save optikalefx/3667718 to your computer and use it in GitHub Desktop.
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
// awesome special event | |
// this adds the method every time you drop, shouldn't there be a way to just | |
// add this once to core $.event.drop ? | |
$.event.special.drop = { | |
add: function( handleObj ) { | |
var old_handler = handleObj.handler; | |
handleObj.handler = function( event ) { | |
console.log("every time?"); | |
// Modify event object here! | |
event.getDropData = function() { | |
var transfer = event.originalEvent.dataTransfer; | |
return JSON.parse(transfer.getData('application/javascript')); | |
} | |
// Call the originally-bound event handler and return its result. | |
return old_handler.apply( this, arguments ); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment