Well i was facing the same trouble and i thought over the same and came to this conclusion....
we can achieve the same functionality by over riding its base functionality ... or altering the themes js itslef.. whichever works the best for you. Here is the script that works out for me... can do the same for you
$(document).ready(function() {
//Now this is very important here - to give time out in case you are overriding it using yr seperate script
//Why? if not done, the second function will bind in later to this one ending up with double function call...
setTimeout(
function() {
//console.log("Unbinding the event");
$('#cancel-button').unbind("click"); ////----This is again important to unbind the GC's default functionality
//console.log("Binding it to the new event");
//Now we bind our own new functionality.
$('#cancel-button').click(function(event) {
event.preventDefault();
if (confirm(message_alert_add_form)) {
if ($(".delete-anchor").is(":visible")) {
//console.log('triggering the delete click');
delId = $(".delete-anchor").attr('id');
//console.log("Got the ID - " + delId);
contents = delId.split("_");
unique_id = contents[1];
//console.log("Got the Unique ID - " + unique_id);
var file_name = $('#delete_url_' + unique_id).attr('rel');
//console.log("Got the File Name 2 be deleted - " + file_name);
var delete_url = $('#delete_url_' + unique_id).attr('href');
//console.log("Delete url found - " + delete_url);
$.ajax({
url: delete_url + "/" + file_name,
cache: false,
success: function() {
//show_upload_button(unique_id, uploader_element);
console.log("the file was deleted")
},
beforeSend: function() {
//$('#upload-state-message-' + unique_id).html(string_delete_file);
$('#success_' + unique_id).hide();
$("#loading-" + unique_id).show();
$("#upload-button-" + unique_id).slideUp("fast");
}
});
} else {
//console.log("Nothing to delete");
}
window.location = list_url;
}
});
}, 2000);
});
Do it the way you like it... i didnt want to overwrite the functionality and henceforth i wrote it out as a seperate script. But technically speaking it should be the other way around - to update the script with the above functionality.
How it works - it dose the same stuff - confirms you first for your exit. If you selects yes - it will check if the delete button is visible or not. If so, it will trigger the delete call as it dose it on the delete link click after uploading the photo. Once done, it will take you to the list url of the app / method
MIND IT / WARNING do not try and use it for edit, use it only in case of add state .. else it will delete your image file while editing also.
Hope this helps you achieve your target...
Happy GCing :)