1/* 2 By Osvaldas Valutis, www.osvaldas.info 3 Available for use under the MIT License 4*/ 5 6'use strict'; 7 8;( function ( document, window, index ) 9{ 10 var inputs = document.querySelectorAll( '.inputfile' ); 11 Array.prototype.forEach.call( inputs, function( input ) 12 { 13 var label = input.nextElementSibling, 14 labelVal = label.innerHTML; 15 16 input.addEventListener( 'change', function( e ) 17 { 18 var fileName = ''; 19 if( this.files && this.files.length > 1 ) 20 fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length ); 21 else 22 fileName = e.target.value.split( '\\' ).pop(); 23 24 if( fileName ) 25 label.querySelector( 'span' ).innerHTML = fileName; 26 else 27 label.innerHTML = labelVal; 28 }); 29 30 // Firefox bug fix 31 input.addEventListener( 'focus', function(){ input.classList.add( 'has-focus' ); }); 32 input.addEventListener( 'blur', function(){ input.classList.remove( 'has-focus' ); }); 33 }); 34}( document, window, 0 ));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.