Your IP : 216.73.216.123


Current Path : /home/smartbloks/.trash/bbp-core/includes/features/bbpc_attachments/js/
Upload File :
Current File : /home/smartbloks/.trash/bbp-core/includes/features/bbpc_attachments/js/front.js

;/*jslint regexp: true, confusion: true, undef: true, sloppy: true, eqeq: true, vars: true, white: true, plusplus: true, maxerr: 50, indent: 4 */
/*global bbpcAttachmentsInit*/(function($, window, document, undefined) {
	window.wp       = window.wp || {};
	window.wp.gdatt = window.wp.gdatt || {};

	window.wp.gdatt.attachments = {
		init: function() {
			$( "form#new-post" ).attr( "enctype", "multipart/form-data" );

			$( document ).on(
				"click",
				".d4p-bba-actions a",
				function(e){
					return confirm( bbpcAttachmentsInit.are_you_sure );
				}
			);

			$( document ).on(
				"click",
				".d4p-attachment-addfile",
				function(e){
					e.preventDefault();

					var now = $( ".bbp-attachments-form input[type=file]" ).length,
					max     = parseInt( bbpcAttachmentsInit.max_files );

					if (now < max) {
						$( this ).before( '<input type="file" size="40" name="bbpc_attachment[]"><br/>' );
					}

					if (now + 1 >= max) {
						$( this ).remove();
					}
				}
			);
		}
	};

	$( document ).ready(
		function() {
			wp.gdatt.attachments.init();
		}
	);
})( jQuery, window, document );