forked from YandolsZX/IcarusImeji
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							36 lines
						
					
					
						
							886 B
						
					
					
				
			
		
		
	
	
							36 lines
						
					
					
						
							886 B
						
					
					
				/*
 | 
						|
	By Osvaldas Valutis, www.osvaldas.info
 | 
						|
	Available for use under the MIT License
 | 
						|
*/
 | 
						|
 | 
						|
'use strict';
 | 
						|
 | 
						|
;( function( $, window, document, undefined )
 | 
						|
{
 | 
						|
	$( '.inputfile' ).each( function()
 | 
						|
	{
 | 
						|
		var $input	 = $( this ),
 | 
						|
			$label	 = $input.next( 'label' ),
 | 
						|
			labelVal = $label.html();
 | 
						|
 | 
						|
		$input.on( 'change', function( e )
 | 
						|
		{
 | 
						|
			var fileName = '';
 | 
						|
 | 
						|
			if( this.files && this.files.length > 1 )
 | 
						|
				fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
 | 
						|
			else if( e.target.value )
 | 
						|
				fileName = e.target.value.split( '\\' ).pop();
 | 
						|
 | 
						|
			if( fileName )
 | 
						|
				$label.find( 'span' ).html( fileName );
 | 
						|
			else
 | 
						|
				$label.html( labelVal );
 | 
						|
		});
 | 
						|
 | 
						|
		// Firefox bug fix
 | 
						|
		$input
 | 
						|
		.on( 'focus', function(){ $input.addClass( 'has-focus' ); })
 | 
						|
		.on( 'blur', function(){ $input.removeClass( 'has-focus' ); });
 | 
						|
	});
 | 
						|
})( jQuery, window, document ); |