Edit File by line
/home/barbar84/www/wp-conte.../plugins/qbkjdbb/assets/js
File: dnd-upload-cf7.js
jQuery(document).ready(function($){
[0] Fix | Delete
[1] Fix | Delete
// Fires when an Ajax form submission has completed successfully, and mail has been sent.
[2] Fix | Delete
document.addEventListener( 'wpcf7mailsent', function( event ) {
[3] Fix | Delete
[4] Fix | Delete
// Get input type file element
[5] Fix | Delete
var inputFile = $('.wpcf7-drag-n-drop-file');
[6] Fix | Delete
var $form = inputFile.parents('form');
[7] Fix | Delete
[8] Fix | Delete
// Reset upload list for multiple fields
[9] Fix | Delete
if( inputFile.length > 0 ) {
[10] Fix | Delete
$.each( inputFile, function(){
[11] Fix | Delete
// Reset file counts
[12] Fix | Delete
localStorage.setItem( $(this).attr('data-name') + '_count_files', 1 );
[13] Fix | Delete
});
[14] Fix | Delete
}else {
[15] Fix | Delete
// Reset file counts
[16] Fix | Delete
localStorage.setItem( inputFile.attr('data-name') + '_count_files', 1 );
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
// Remove status / progress bar
[20] Fix | Delete
$('.dnd-upload-status', $form ).remove();
[21] Fix | Delete
$('.dnd-upload-counter span', $form ).text('0');
[22] Fix | Delete
$('span.has-error-msg', $form ).remove();
[23] Fix | Delete
[24] Fix | Delete
}, false );
[25] Fix | Delete
[26] Fix | Delete
window.initDragDrop = function () {
[27] Fix | Delete
[28] Fix | Delete
// Get text object options/settings from localize script
[29] Fix | Delete
var TextOJB = dnd_cf7_uploader.drag_n_drop_upload;
[30] Fix | Delete
[31] Fix | Delete
// Support Multiple Fileds
[32] Fix | Delete
$('.wpcf7-drag-n-drop-file').CodeDropz_Uploader({
[33] Fix | Delete
'color' : '#fff',
[34] Fix | Delete
'ajax_url' : dnd_cf7_uploader.ajax_url,
[35] Fix | Delete
'text' : TextOJB.text,
[36] Fix | Delete
'separator' : TextOJB.or_separator,
[37] Fix | Delete
'button_text' : TextOJB.browse,
[38] Fix | Delete
'server_max_error' : TextOJB.server_max_error,
[39] Fix | Delete
'on_success' : function( input, progressBar, response ){
[40] Fix | Delete
[41] Fix | Delete
// Progressbar Object
[42] Fix | Delete
var $progressDetails = $('#' + progressBar, input.parents('.codedropz-upload-wrapper') );
[43] Fix | Delete
var $form = input.parents('form');
[44] Fix | Delete
var $span = $('.wpcf7-acceptance', $form );
[45] Fix | Delete
var $input = $('input:checkbox', $span);
[46] Fix | Delete
[47] Fix | Delete
// If it's complete remove disabled attribute in button
[48] Fix | Delete
if( $span.hasClass( 'optional' ) || $input.is( ':checked' ) || $span.length == 0 || $form.hasClass('wpcf7-acceptance-as-validation') ) {
[49] Fix | Delete
setTimeout(function(){ $('input:submit', $form ).removeAttr('disabled'); }, 1);
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
// Append hidden input field
[53] Fix | Delete
$progressDetails
[54] Fix | Delete
.find('.dnd-upload-details')
[55] Fix | Delete
.append('<span><input type="hidden" name="'+ input.attr('data-name') +'[]" value="'+ response.data.path +'/'+ response.data.file +'"></span>');
[56] Fix | Delete
[57] Fix | Delete
// Update counter
[58] Fix | Delete
var $files_counter = ( Number( localStorage.getItem( input.data('name') + '_count_files' ) ) - 1 );
[59] Fix | Delete
$('.dnd-upload-counter span', input.parents('.codedropz-upload-wrapper')).text( $files_counter );
[60] Fix | Delete
}
[61] Fix | Delete
});
[62] Fix | Delete
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
window.initDragDrop();
[66] Fix | Delete
[67] Fix | Delete
});
[68] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function