1// JavaScript Document 2function mail_no_spam(user,dominio) { 3 document.location.href = "mailto:" + user + "@" + dominio; 4} 5 6function mailCheck(email) { 7 var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; 8 9 if(email == '') { 10 return false; 11 } 12 else 13 if( !emailReg.test(email) ) { 14 return false; 15 } 16 else 17 return true; 18} 19 20function validateEmail(email) { 21 var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 22 return re.test(email); 23} 24 25function validaUrl(url) { 26 if(/^(http|https|ftp):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i.test(url)) { 27 return true 28 } 29 else { 30 return false; 31 } 32} 33 34function conferma(messaggio='Continuo con l\'elaborazione dei dati?') { 35 var scelta = confirm(messaggio); 36 37 return scelta; 38} 39 40function setCookie(nome,valore,durata) { 41 durata = 60*24*365*5; 42 var scadenza = new Date(); 43 var adesso = new Date(); 44 scadenza.setTime(adesso.getTime() + (parseInt(durata) * 60000)); 45 document.cookie = nome + '=' + escape(valore) + '; expires=' + scadenza.toGMTString() + '; path = /'; 46} 47 48function salvaCookie(nomeCookie, valoreCookie, giorniCookie=false) { 49 if( giorniCookie != false ) { 50 const d = new Date(); 51 d.setTime(d.getTime() + (giorniCookie*24*60*60*1000)); 52 let expires = "expires="+ d.toUTCString(); 53 document.cookie = nomeCookie + "=" + valoreCookie + ";" + expires + ";path=/"; 54 } 55 else 56 document.cookie = nomeCookie + "=" + valoreCookie + ";0;path=/"; 57} 58 59/* RECUPERO IL VALORE DI UN COOKIE. SE NON ESISTE RITORNO UNA STRINGA VUOTA */ 60function controllaCookie(nomeCookie) { 61 let name = nomeCookie + "="; 62 //let decodedCookie = decodeURIComponent(document.cookie); 63 let decodedCookie = decodeURIComponent(document.cookie.replace(/%(?![0-9][0-9a-fA-F]+)/g, '%25')); 64 65 let ca = decodedCookie.split(';'); 66 67 for(let i = 0; i <ca.length; i++) { 68 let c = ca[i]; 69 while (c.charAt(0) == ' ') { 70 c = c.substring(1); 71 } 72 if (c.indexOf(name) == 0) { 73 return c.substring(name.length, c.length); 74 } 75 } 76 return ""; 77} 78 79/* 80 CONTROLLO SE cosa ESISTE NELLA STRING dove 81 dove E' UN INSIEME DI STRINGHE SEPARATE DA separatore 82*/ 83function stringExistsInString(cosa, dove, separatore=",") { 84 var doveAsArray = dove.split(separatore); 85 86 for( var i=0; i<doveAsArray.length; i++) { 87 if( doveAsArray[i] == cosa) { 88 return true; 89 } 90 } 91 return false; 92} 93 94 95function anteprimaFoto(sorgente,destinazione) { 96 var countFiles = $("#"+sorgente)[0].files.length; 97 var imgPath = $("#"+sorgente)[0].value; 98 var extn = imgPath.substring(imgPath.lastIndexOf('.') + 1).toLowerCase(); 99 var image_holder = $("#"+destinazione); 100 image_holder.empty(); 101 102 if (extn == "gif" || extn == "png" || extn == "jpg" || extn == "jpeg") { 103 if (typeof (FileReader) != "undefined") { 104 //loop for each file selected for uploaded. 105 for (var i = 0; i < countFiles; i++) { 106 var reader = new FileReader(); 107 reader.onload = function (e) { 108 $("<img />", { 109 "src": e.target.result, 110 "class": "preview-foto" 111 }).appendTo(image_holder); 112 } 113 image_holder.show(); 114 reader.readAsDataURL($("#"+sorgente)[0].files[i]); 115 } 116 117 } else { 118 //alert("Questo browser non supporta il FileReader."); 119 } 120 } else { 121 //alert("Devi selezionare una foto"); 122 } 123} 124 125function condividiUrl(url) { 126 console.log(url); 127 window.open(url); 128} 129 130function mostraNotifica(tipo, titolo, testo, icona, animazione, chiusura) { 131 $.get("/ajax_query/notifica.render.php", 132 { 133 "tipo": tipo, 134 "titolo": titolo, 135 "testo": testo, 136 "icona": icona, 137 "animazione": animazione, 138 "chiusura": chiusura 139 }, 140 function(data) { 141 var data = eval('(' + data + ')'); 142 if( data.result ) { 143 //$("#notifiche-wrapper").prepend( data.message ); 144 $("#chiudiNotifiche").after( data.message ); 145 setTimeout( function() { 146 if( $("#notifiche-wrapper .notifiche").length > 1 ) 147 $("#chiudiNotifiche").css("display", "inline-block"); 148 }, 100); 149 /*$("#notifiche-wrapper").prepend( data.message ).delay(1000).queue(function() { 150 console.log( $(this) ); 151 $(this[0] + " .notifiche:last-child .close").trigger( "click" ); 152 $(this).dequeue(); 153 });*/ 154 } 155 else { 156 alert("Errore durante l'invio della notifica"); 157 } 158 } 159 ); 160} 161 162/* 163 calcolo se la seconda data è più grande della prima 164*/ 165function secondaMaggioreDiPrima( prima, seconda, conteggiaOrario=false ) { 166 data1 = prima ? new Date(prima) : new Date(); 167 data2 = seconda ? new Date(seconda) : new Date(); 168 169 if( !conteggiaOrario ) { 170 data1.setHours(0,0,0,0); 171 data2.setHours(0,0,0,0); 172 } 173 174 return data2.getTime() > data1.getTime() ? true : false; 175}
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.