1$(document).ready(function(){ 2 /* On ne fait rien si le navigateur de supporte pas l'API nécessaire */ 3 if (window.FileReader) { 4 5 function alertFileSize($inputFile) { 6 $inputFile.before('<p class="text-danger warning-file-is-too-big">Le fichier inséré est trop gros (' + $inputFile.attr('max-size') + ' Mo max)</p>'); 7 $inputFile.replaceWith($inputFile.val('').clone(true)); 8 } 9 10 $('body').on('change', 'input.check-size[type=file][max-size]', function(event){ 11 if (!$(this).prop('files')) { 12 /* Le navigateur n'est pas compatible */ 13 return false; 14 } 15 if(typeof $(this).prop('files')[0] !== 'undefined') { 16 /* On enlève le potentiel message précédent */ 17 $(this).prev('.warning-file-is-too-big').remove(); 18 19 var maxSize = parseInt($(this).attr('max-size'),10), 20 size = $(this).prop('files')[0].size; 21 if (size > maxSize * 1048576) { 22 alertFileSize($(this)); 23 event.stopImmediatePropagation(); 24 } 25 } 26 }); 27 28 } 29});
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.