jQuery( function() { jQuery( '.sale_file' ).on( 'click', function() { var safe_file = jQuery( this ).attr( 'id' ); var page_id = jQuery( this ).attr( 'name' ); var attach = parseInt( safe_file.replace( /\D+/g, '' ) ); var page = parseInt( page_id.replace( /\D+/g, '' ) ); var dataString = 'action=download_sale_file_recall&attach=' + attach + '&page=' + page; jQuery.ajax( { type: 'POST', data: dataString, dataType: 'json', url: Rcl.ajaxurl, success: function( data ) { if ( data['otvet'] == 100 ) { jQuery( '.usercount' ).html( data['count'] + ' рублей' ); jQuery( '#safe-file-' + data['attach'] ).slideUp(); jQuery( '#href-file-' + data['attach'] ).html( data['href'] ).delay( 1000 ).slideDown( 1000 ); } else { alert( data['recall'] ); } } } ); return false; } ); } ); jQuery( function( $ ) { if ( RclUploaders.isset( 'ufm_product_file' ) ) { RclUploaders.get( 'ufm_product_file' ).appendInGallery = function( upload ) { jQuery( '#rcl-upload-gallery-' + this.uploader_id ).append( upload.html ); jQuery( '#rcl-gallery-' + this.uploader_id ).append( upload.html ); jQuery( '#rcl-upload-gallery-' + this.uploader_id + ' .gallery-attachment' ).last().animateCss( 'flipInX' ); }; } });