Skip to content

Instantly share code, notes, and snippets.

@gpbmike
Created November 6, 2008 18:28
Show Gist options
  • Save gpbmike/22663 to your computer and use it in GitHub Desktop.
Save gpbmike/22663 to your computer and use it in GitHub Desktop.
// event handler for queuing a file
'fileQueued': function(file) {
// check if you queued a video
// get upload url
if (file.name.toLowerCase().match("(mov|avi|wmv|3gp|mkv|mpg|mpeg|mp4|m4v)$")) {
var input = {'get_fields[]': ['url','key'],'file': file.name };
$.getJSON('/media/get_video_upload_url',input,function(output){WU.sv_urls[file.id] = output;});
}
// switch to upoad view
fs_media.hide();
fs_upload.show();
actions_media.hide();
actions_upload.show();
// switch to the thisMoment tab in the background
wizard.find('fieldset.media ul.nav').tabs("select", 0);
// add row to table for file
var row = $('<tr id="' + file.id + '"/>').data('file', file).append($('<td class="name"/>').text(file.name)).append($('<td class="size"/>').text($.formatBytes(file.size))).appendTo(files);
var status = $('<td class="status"/>').appendTo(row);
$('<a href="#" class="remove">remove</a>').data('file_id', file.id).click(function(e) {
e.preventDefault();
WU.su.cancelUpload($(this).data('file_id'));
$(this).parents('tr:first').fadeOut();
}).appendTo(status);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment