Skip to content

Commit

Permalink
Monkey patches the jquery filedrop plugin to use url() as a function …
Browse files Browse the repository at this point in the history
…instead of a string

Signed-off-by: Akash Manohar J <akash@akash.im>
  • Loading branch information
HashNuke committed Apr 10, 2012
1 parent 3ef00e0 commit d8d0d5e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/assets/javascripts/lib/jquery.filedrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@
$.fn.filedrop = function(options) {
var opts = $.extend({}, default_opts, options);

this.bind('drop', drop).bind('dragenter', dragEnter).bind('dragover', dragOver).bind('dragleave', dragLeave);
$(document).bind('drop', docDrop).bind('dragenter', docEnter).bind('dragover', docOver).bind('dragleave', docLeave);
this.live('drop', drop)
.live('dragenter', dragEnter)
.live('dragover', dragOver)
.live('dragleave', dragLeave);

$(document)
.bind('drop', docDrop)
.bind('dragenter', docEnter)
.bind('dragover', docOver)
.bind('dragleave', docLeave);

$('#' + opts.fallback_id).change(function(e) {
opts.drop(e);
Expand Down Expand Up @@ -283,7 +291,7 @@
upload.startData = 0;
upload.addEventListener("progress", progress, false);

xhr.open("POST", opts.url, true);
xhr.open("POST", opts.url(), true);
xhr.setRequestHeader('content-type', 'multipart/form-data; boundary=' + boundary);

// Add headers
Expand Down

0 comments on commit d8d0d5e

Please sign in to comment.