1jQuery.fn.extend({ 2 check : function() { 3 return this.each(function() { 4 this.checked = true; 5 }); 6 }, 7 uncheck : function() { 8 return this.each(function() { 9 this.checked = false; 10 }); 11 }, 12 isChecked : function() { 13 return this.attr('checked') == true; 14 } 15}); 16 17 18window.SoUtile = (function SoUtile () { 19 20 var _SoUtile = { 21 22 /** 23 * Extraire la chaine correspondant à la langue courante depuis un tableau de langue passé en paramètre. 24 * @param {String} chaine tableau des chaines de caractères 25 */ 26 strLangue: function (chaine) 27 { 28 if (typeof langue==='undefined') 29 { 30 return chaine['en']; 31 } 32 return chaine[langue]; 33 }, 34 35 /** 36 * Prend une taille en octet et la converti dans l'unité qui va bien 37 */ 38 convertSize: function (aSize) { 39 let sign = Math.sign(aSize); 40 aSize = Math.abs(aSize); 41 let def = [ 42 [1, "octets"], 43 [1024, "kio"], 44 [1024 * 1024, "Mio"], 45 [1024 * 1024 * 1024, "Gio"], 46 [1024 * 1024 * 1024 * 1024, "Tio"], 47 [1024 * 1024 * 1024 * 1024 * 1024, "Pio"], 48 [1024 * 1024 * 1024 * 1024 * 1024 * 1024, "Eio"], 49 [1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "Zio"], 50 [1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "Yio"], 51 [1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "kYio"] 52 ]; 53 for (let i = 0; i < def.length; i++) { 54 if (aSize < def[i][0]) 55 return (sign * (aSize / def[i - 1][0])).toFixed(2) + " " + def[i - 1][1]; 56 } 57 return (sign * (aSize / def[def.length - 1][0])).toFixed(2) + " " + def[def.length - 1][1]; 58 }, 59 60 /** 61 * Retourne un objet deferred qui sera appelé une fois tous les promises résolu 62 * @param Array array tableau de Promise (JQuery.Deffered object) 63 */ 64 _all: function(array){ 65 var deferred = $.Deferred(); 66 var fulfilled = 0, length = array.length; 67 var results = []; 68 69 if (length === 0) { 70 deferred.resolve(results); 71 } else { 72 array.forEach(function(promise, i) { 73 $.when(promise).then(function(value) { 74 results[i] = value; 75 fulfilled++; 76 if(fulfilled === length) { 77 deferred.resolve(results); 78 } 79 }); 80 }); 81 } 82 83 return deferred.promise(); 84 } 85 }; 86 87 return _SoUtile; 88})();
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.