//##################################################################### // AGGIORNATO AL 23/01/2020 //##################################################################### function secondi_to_hhmmss(secondi) { var ore = parseInt(secondi / 3600) if (ore == 0) {ore="00"} return ore + ":" + ("00" + parseInt((secondi - parseInt(secondi / 3600) * 3600) / 60)).slice(-2) + ":" + ("00" + parseInt(secondi - parseInt(secondi / 3600) * 3600 - parseInt((secondi - parseInt(secondi / 3600) * 3600) / 60) * 60)).slice(-2) } //---------------------------------------------------------------------------- function esecuzione_condizionata(entro_secondi,eseguo,id_bottone) { entro_secondi = parseInt(entro_secondi) //alert(entro_secondi) /*---------------------------------- esegue la funzione eseguo se non viene "cliccato" un bottone entro un determinato tempo fornire: entro_secondi: tempo superato il quale vie eseguita la funzione eseguo eseguo: funzione da eseguire allo scadere del tempo (non ha parametri, se occorrono rivedere) id_bottone: ID dell'oggetto da "cliccare" per non eseguire (di norma un bottone) -----------------------------------*/ var obj = document.getElementById(id_bottone) var descrizione = obj.innerHTML var orologio = setTimeout(function(){eseguo()},entro_secondi * 1000) obj.addEventListener("click", function evento() { clearTimeout(orologio) obj.style.display = "none" }) var adesso=new Date() var inizio = adesso.getTime() mostra(inizio,entro_secondi,descrizione,obj,adesso) function mostra(inizio,entro_secondi,descrizione,obj) { var adesso=new Date() var ora = adesso.getTime() var trascorsi = ora - inizio var rimane = parseInt((entro_secondi * 1000 - trascorsi)/1000) s = "" s= s + "\r\nentro_secondi * 1000 =" + entro_secondi * 1000 s= s + "\r\ninizio=" + inizio s= s + "\r\nora=" + ora s= s + "\r\ntrascorsi=" + trascorsi s= s + "\r\nrimane=" + rimane //alert(s) obj.innerHTML = descrizione + " " + secondi_to_hhmmss(rimane) setTimeout(function() { mostra(inizio,entro_secondi,descrizione,obj) },900) } } //---------------------------------------------------------------------------- function window_apri(nome_asp,formato,parametri) { var url = nome_asp + "?" + stringa_a_hex(parametri+ "&foo=" + casuale()) //alert(url) window.open(url,'',pop_stato_window(formato)) } //---------------------------------------------------------------------------- function template_lancio(template_asp,parametri) { rimpiazza(template_asp + "?" + stringa_a_hex(parametri+ "&foo=" + casuale())) } //---------------------------------------------------------------------------- function orologio(id_data) { try { var adesso = data_ora_attuale() var s = "" s = s + adesso.giorno + " " + adesso.gg + " " + adesso.mese + " " + adesso.aaaa + " " + adesso.hhmm //s = "mercoledì 12 settembre 2018 01:58" ; // per il test di larghezza document.getElementById(id_data).innerHTML = s setTimeout(function(){orologio(id_data)}, 1000) } catch(err){} } //---------------------------------------------------------------------------- function orologio_1() { y = "" try { var adesso = data_ora_attuale() var y = adesso.gg + "/" + adesso.mm + "/" + adesso.aaaa + " " + adesso.hhmmss } catch(err){} return y } //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| EMAIL //---------------------------------------------------------------------------- function iframe_standard(url,formato) { var parametri = formato + ",iframe=1,bottone_x=chiude_dentro_finestra()" var s = "" s = s + "\r\niframe_standard" s = s + "\r\nurl = " + url s = s + "\r\nparametri = " + parametri //alert(s) top.pop_inoltra_start() top.pop_apre(parametri) top.pop_obj.src = url } function iframe_email(vettore) { iframe_standard("email.asp?vettore=" + vettore,formato_email) } function email_iframe(url) { alert("email_iframe = " + url) top.pop_inoltra_start() var parametri = "x=-1,w=90,y=5,h=-1,bordo=0.4,padding=1,bordo_colore=#AE2337,bordo_raggio=1,blocca_scroll=0,iframe=1,bottone_x=top.pop_chiude_con_conferma(email_iframe_messaggio_01)" top.pop_apre(parametri) top.pop_obj.src = url } function ifra(url) { alert("ifra = " + url) top.pop_inoltra_start() //var parametri = "x=-1,w=70,y=10,h=-1,bordo=0.4,padding=1,bordo_colore=#AE2337,bordo_raggio=1,blocca_scroll=0,iframe=1,bottone_x=top.pop_chiude()" var parametri = "x=-1,w=70,y=10,h=-1,bordo=0.4,padding=1,bordo_colore=#AE2337,bordo_raggio=1,blocca_scroll=0,iframe=1,bottone_x=chiude_dentro_finestra()" top.pop_apre(parametri) top.pop_obj.src = url } //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| FILE function file_upload_ajax(form_id,abort_id,funzione_progresso) { /*----------------------------------- SPIEGAZIONI Serve a fare upload di un form via ajax. Fornire: ------------------------------------------------- - form_id = ID del form da caricare - abort_id = ID del bottone (o dell'area) che - se cliccata - interrompe il caricamento - funzione_progresso = funzione che deve avere in input due parametri (p,testo) p = percentuale di caricamento eseguito (se se negativo abort) testo = risposte da ajax ATTENZIONE! - se abort_id non esiste l'upload non è cancellabile - se funzione_progresso non esiste non vengono mostrati l'avanzamento e le risposte aiax ------------------------------------------------*/ var interruzione = false var progresso = false ajax_interrotto = false if(arguments.length >= 2 && abort_id!=""){interruzione=true} if(arguments.length >= 3){progresso=true} var campi_form = new FormData(document.getElementById(form_id)); var ajax = new XMLHttpRequest() //------------------------------------------ EVENTO FINE ajax.onreadystatechange = function() { if (ajax.readyState==4 && progresso) { //ajax = null //alert("ajax_interrotto 2 = " + ajax_interrotto) if (ajax_interrotto) { funzione_progresso(-100,"INOLTRO ANNULLATO") } else { funzione_progresso(100,ajax.responseText) } } } //------------------------------------------ EVENTO PROGRESSIONE CARICAMENTO ajax.upload.addEventListener('progress',function(e) { if (e.lengthComputable && progresso) { var p = 100 * e.loaded / e.total if (p <= 99){funzione_progresso(p,"")} } }, false) //------------------------------------------ ALTRI EVENTI ajax.addEventListener('load', function(e) { //CI PENSA ajax.readyState==4 }, false) ajax.addEventListener('error', function(e) { e.stopPropagation() e.preventDefault() if(progresso){funzione_progresso(-100,"ERRORE DI INOLTRO")} }, false) /*........................ ajax.addEventListener('abort', function(e) { e.stopPropagation() e.preventDefault() ajax_interrotto = true }, false) .......................*/ if(interruzione){document.getElementById(abort_id).addEventListener('click', function(e) { e.stopPropagation() e.preventDefault() ajax_interrotto = true //alert("ajax_interrotto 1 = " + ajax_interrotto) ajax.abort() }, false)} //------------------------------------------ SPEDIZIONE ajax.open('POST', document.getElementById(form_id).action ,true); ajax.send(campi_form); } //============================================================= function file_upload_set(file_id,drop_id,mostra_id,ritorno) { /*---------------------------------------- Serve ad inizializzare la gestione dei file. Deve essere chiamata una sola volta all'avvio fornendo per ciascun file: - file_id = ID dell'istruzione "INPUT" di tipo "file" (con display:none) - drop_id = ID dell'area "drag drop" (o di click) - mostra_id = ID dell'area di visulaizzazione dei dati del file - ritorno = funzione che viene chiamata per estrarre e mostrare i dati del file selezionato cui vengono cosegnati alla selezione del file (via "click" o via "drop") un solo oggetto file_obj chiamata tipica: visualizza(file_obj) ----------------------------------------*/ var drop_obj = document.getElementById(drop_id) var file_obj = document.getElementById(file_id) var mostra_obj = document.getElementById(mostra_id) drop_obj.addEventListener("dragenter",function(e){e.stopPropagation();e.preventDefault();},false); drop_obj.addEventListener("dragover",function(e){e.stopPropagation();e.preventDefault();},false); drop_obj.addEventListener("drop", function(e) { e.stopPropagation() e.preventDefault() var x = "input[id=" + file_id + "]" var y = new Array() document.querySelector(x).files = e.dataTransfer.files y = document.querySelector(x).files oggetto(y[0],drop_obj,mostra_obj,ritorno) },false) drop_obj.addEventListener("click", function() { file_obj.click() },false) file_obj.addEventListener("change", function() { oggetto(this.files[0],drop_obj,mostra_obj,ritorno) },false) function oggetto(file_obj,drop_obj,mostra_obj,ritorno) { var reader = new FileReader() reader.readAsDataURL(file_obj) reader.addEventListener("load", function () { var img = null try{img = reader.result}catch(err){} var oggetto_file = {} oggetto_file = { file_obj:file_obj, drop_obj:drop_obj, mostra_obj:mostra_obj, nome:file_obj.name, tipo:file_obj.type, bytes:file_obj.size, estensione:file_obj.name.split('.').pop(), url:window.URL.createObjectURL(file_obj), immagine:img } if(oggetto_file.tipo == undefined){oggetto_file.tipo = ""} if(oggetto_file.tipo.indexOf("image/") < 0){oggetto_file.immagine = ""} ritorno(oggetto_file) }, false); } } //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| AJAX //##################################################################### function form_submit_iframe(form_obj,form_action,timeout_secondi,ritorno) { /* -------------------------------------------------- form_obj = nome del form da postare form_action = action da settare nel form timeout_secondi = tempo massimo di spedizione in secondi ritorno = nome della funzione di "callback" che viene chiamata solo quando questa funzione ha terminato la funzione "ritorno" deve avere due parametri ritorno(a,b) a = true è andato in time-out (la spedizione potrebbe comunque essere avvenuta) a = false la spedizione è avvenuta senza andare in time-out b = contenuto della risposta del server che ovviamente dipende da come è costruita la pagina chiamata in "action" del form ATTENZIONE! il "cross-domain" cioè la pagina chiamata in "action" ha un dominio diverso dalla pagina che contiene il form non consente di ottenere il contenuto "b". In questi casi in "b" si trova la dicitura "ERRORE: Access denied" (o simili). Se non si è in cross-domain (form e action stesso dominio) "b" contiene la risposta di action solo se "a" è in "false". -------------------------------------------------- */ var concluso = false var iframe = casuale() var contenuto = "" document.body.appendChild(document.createElement("iframe")) document.body.lastChild.contentWindow.name = iframe document.body.lastChild.style.display="none" if (document.body.lastChild.addEventListener){document.body.lastChild.addEventListener("load", function(){try{caricato(ritorno,false,contenuto)}catch(err){}}, false)} else{if (document.body.lastChild.attachEvent){document.body.lastChild.attachEvent("onload", function(){caricato(ritorno,false,contenuto)})}} var istanza_timeout=setTimeout(function(){caricato(ritorno,true,contenuto)},timeout_secondi * 1000) form_obj.action = form_action form_obj.target = iframe form_obj.submit() function caricato(ritorno,x,contenuto) { try { clearTimeout(istanza_timeout) if (document.body.lastChild.removeEventListener){document.body.lastChild.removeEventListener("load", function(){try{caricato(ritorno,true)}catch(err){}}, false)} else{if (document.body.lastChild.detachEvent){document.body.lastChild.detachEvent("onload", function(){caricato(ritorno,true)})}} } catch(err){} if (!x) { try { var obj_contenuto = (document.body.lastChild.contentWindow || document.body.lastChild.contentDocument); if (obj_contenuto.document) {obj_contenuto = obj_contenuto.document}; contenuto = obj_contenuto.body.innerHTML } catch(err) {contenuto = "ERRORE: " + err.message} } try {document.body.removeChild(document.body.lastChild)} catch(err){} if(!concluso){ritorno(x,contenuto)} concluso = true } } //##################################################################### function form_submit_ajax(form_id,ritorno) { var campi_form = new FormData(document.getElementById(form_id)); var ajax = new XMLHttpRequest() ajax.onreadystatechange = function() { if (ajax.readyState==4) { ritorno(ajax.responseText) } } ajax.open('POST', document.getElementById(form_id).action ,true) ajax.send(campi_form) } //##################################################################### function form_submit_ajax_old(form_obj,form_action,timeout_secondi,ritorno) { /* -------------------------------------------------- form_obj = nome del form da postare form_action = action da settare nel form timeout_secondi = tempo massimo di spedizione in secondi ritorno = nome della funzione di "callback" che viene chiamata solo quando questa funzione ha terminato la funzione "ritorno" deve avere due parametri ritorno(a,b) a = true è andato in time-out (la spedizione potrebbe comunque essere avvenuta) a = false la spedizione è avvenuta senza andare in time-out b = contenuto della risposta del server che ovviamente dipende da come è costruita la pagina chiamata in "action" del form ATTENZIONE! il "cross-domain" cioè la pagina chiamata in "action" ha un dominio diverso dalla pagina che contiene il form non consente di ottenere il contenuto "b". In questi casi in "b" si trova la dicitura "ERRORE: Access denied" (o simili). Se non si è in cross-domain (form e action stesso dominio) "b" contiene la risposta di action solo se "a" è in "false". NOTA IMPORTANTE (in ASP ma simile in PHP) Se si è in cross-domain per consentire comunque l'accesso l'ASP chiamato in "action" deve avere: Response.AddHeader "Access-Control-Allow-Origin", "*" in tal modo si acconsente il cross-domain Naturalmente ciò implica un accordo con il corrispondente se l'ASP chiamato in action non è nostro -------------------------------------------------- */ //------------------------------------------ Estrazione dati dal form var elem = form_obj.elements; var params = ""; var value; for (var i = 0; i < elem.length; i++) { if (elem[i].tagName == "SELECT") { value = elem[i].options[elem[i].selectedIndex].value; } else { value = elem[i].value; } params += elem[i].name + "=" + encodeURIComponent(value) + "&"; } //alert("params = " + params) var abort = false //----------------------------------------- AJAX var ajax_istanza=null try{ajax_istanza=new ActiveXObject("Microsoft.XMLHTTP")}catch(err){ try{ajax_istanza=new ActiveXObject("Msxml2.XMLHTTP")}catch(err){ try{ajax_istanza=new XMLHttpRequest()}catch(err){}}} ajax_istanza.onreadystatechange = function() { if (ajax_istanza.readyState==4) { /* s = "" s = s + "\r\n abort = " + abort s = s + "\r\n ajax_istanza.readyState = " + ajax_istanza.readyState s = s + "\r\n ajax_istanza.status = " + ajax_istanza.status s = s + "\r\n ajax_istanza.statusText = " + ajax_istanza.statusText s = s + "\r\n ajax_istanza.responseText = " + ajax_istanza.responseText alert(s) */ clearTimeout(ajax_istanza_timeout) if (ajax_istanza.status==200) { ritorno(abort,ajax_istanza.responseText) } else { ritorno(abort,"ERRORE: " + ajax_istanza.status + " " + ajax_istanza.statusText) } } } ajax_istanza.open("POST",form_action,true) ajax_istanza.setRequestHeader("Content-type", "application/x-www-form-urlencoded") ajax_istanza.setRequestHeader("Content-length", params.length) ajax_istanza.setRequestHeader("Connection", "close") ajax_istanza.send(params) var ajax_istanza_timeout=setTimeout(function(){abort = true;ajax_istanza.abort()},timeout_secondi * 1000) } //##################################################################### function ajax_get(url,asinc_sinc,funzione_out) { /* ----------------------------- Funzione per le chiamate ajax I SISTEMI WEBKIT (non explorer) funzionano solo con chiamate sullo stesso server per il sistema POST (routine da fare) riferirsi alle istruzioni via Internet ----------------------------- url = url da chiamare asinc_sinc = true per asincrono false per sincrono funzione_out = funzione di ritorno che elabora i dati in arrivo ----------------------------- */ //alert("ajax entrata") var ajax_istanza=null try{ajax_istanza=new ActiveXObject("Microsoft.XMLHTTP")}catch(err){ try{ajax_istanza=new ActiveXObject("Msxml2.XMLHTTP")}catch(err){ try{ajax_istanza=new XMLHttpRequest()}catch(err){}}} ajax_istanza.onreadystatechange = function() { //alert("ajax_istanza.readyState = " + ajax_istanza.readyState) if (ajax_istanza.readyState == 4) { //alert("ajax_istanza.status = " + ajax_istanza.status) //alert("ajax_istanza.responseText = " + ajax_istanza.responseText) funzione_out(ajax_istanza.responseText) } } ajax_istanza.open("GET",url,asinc_sinc) ajax_istanza.send(null) } //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| DATE //####################################################################### function data_ora_attuale() { //new Date(anno, mese - 1, giorno, ore, minuti, secondi) //var data = new Date(2013,8,7,16,54,1) var data = new Date() var giorni_della_settimana = ["Domenica","Lunedi'","Martedi'","Mercoledi'","Giovedi'","Venerdi'","Sabato"] var mesi = ["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"] var giorno_del_mese = parseInt(data.getDate()) var giorno_della_settimana_numerico = parseInt(data.getDay()) + 1 var giorno_della_settimana = giorni_della_settimana[giorno_della_settimana_numerico - 1] var mese_numerico = parseInt(data.getMonth()) + 1 var mese = mesi[mese_numerico - 1] var anno = parseInt(data.getYear()) anno = (anno < 1000) ? anno + 1900 : anno var ore = parseInt(data.getHours()) var minuti = parseInt(data.getMinutes()) var secondi = parseInt(data.getSeconds()) //--------------------------------------- giorno_del_mese = giorno_del_mese + '' ; while (giorno_del_mese.length < 2){giorno_del_mese = '0' + giorno_del_mese} mese_numerico = mese_numerico + '' ; while (mese_numerico.length < 2){mese_numerico = '0' + mese_numerico} anno = anno + '' ; while (anno.length < 4){anno = '0' + anno} ore = ore + '' ; while (ore.length < 2){ore = '0' + ore} minuti = minuti + '' ; while (minuti.length < 2){minuti = '0' + minuti} secondi = secondi + '' ; while (secondi.length < 2){secondi = '0' + secondi} //--------------------------------------- var x = { gg:giorno_del_mese, giorno:giorno_della_settimana, mm:mese_numerico, mese:mese.toLowerCase(), aaaa:anno, hhmm:ore + ":" + minuti, hhmmss:ore + ":" + minuti + ":" + secondi, } return x } //##################################################################### function date_numerica(data) { //Fornire data in formato gg/mm/aaaa //Ritorna numero di millisecondi dal 01/01/1970 //Se data errata riporta null var t = null var y = data.substring(0, 10) var anno = parseInt(y.substr(6),10); var mese = parseInt(y.substr(3, 2),10); var giorno = parseInt(y.substr(0, 2),10); var d = new Date(anno,mese-1,giorno) if(d.getFullYear()==anno && d.getMonth()+1==mese && d.getDate()==giorno){t =d.getTime()} return t } //##################################################################### function date_differenza(data_1,data_2) { //Fornire date in formato gg/mm/aaaa //Ritorna data_2 MENO data_1 espressa in giorni //Se date errata riporta null var t = null var t_1 = date_numerica(data_1) var t_2 = date_numerica(data_2) if (t_1!=null && t_2!=null){t = (t_2 - t_1)/(1000 * 60 * 60 * 24)} return t } //##################################################################### function date_nuova(data,giorni) { //Fornire data in formato gg/mm/aaaa //Giorni = numero di giorni //Ritorna la data corripondente a data + giorni in formato gg/mm/aaaa //Se data errata riporta null var d = null var t1 = date_numerica(data) if (t1!=null) { var t2 = 1000 * 60 * 60 * 24 * giorni var d = new Date() d.setTime(t1+t2) var anno = d.getFullYear() var mese = d.getMonth() + 1 var giorno = d.getDate() giorno=giorno+'' while (giorno.length<2){giorno='0'+giorno} mese=mese+'' while (mese.length<2){mese='0'+mese} anno=anno+'' while (anno.length<4){anno='0'+anno} var d = giorno+"/"+mese+"/"+anno } return d } //##################################################################### function data_normalizzata(stringa,ritorno) { var giorno=0 var mese=0 var anno=0 var z=stringa_pulizia(stringa,'/0123456789') var x=z.indexOf('/') if (x>=0){giorno=z.substring(0,x)-0;z=z.substring(x+1,z.length)} x=z.indexOf('/') if (x>=0){mese=z.substring(0,x)-0;anno=z.substring(x+1,z.length)-0} var anno=y2k(anno) var d = new Date(anno,mese-1,giorno) var giorno1=d.getDate() var mese1=d.getMonth()+1 var anno1=d.getYear() anno1=y2k(anno1) if (giorno==giorno1 && mese==mese1 && anno==anno1) { giorno=giorno+'' while (giorno.length<2){giorno='0'+giorno} mese=mese+'' while (mese.length<2){mese='0'+mese} anno=anno+'' while (anno.length<4){anno='0'+anno} var data_numerica = new Date(anno-0,mese-1,giorno-0) var data_stringa=giorno+"/"+mese+"/"+anno if (ritorno>0) { return data_stringa } else { return data_numerica } } else { if (ritorno>0) { return "gg/mm/aaaa" } else { return 0 } } } function y2k(number) { return (number < 1000) ? number + 1900 : number; } //##################################################################### //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| BASE //##################################################################### //============================================================ function stringa_a_hex(stringa) { var y = "" for(var i=0;i lunghezza_massima) { uscita = testo.substring(0, lunghezza_massima - 3) + "..." } return uscita } //============================================================= function seleziona_opzione(obj_opzione,valore_da_settare) { for (var i=0; i 0) { dime = top.pop_dimensioni() var w_max = dime.x_largo_px var h_max = dime.y_alto_px //var w_max = screen.availWidth //var h_max = screen.availHeight var w = parseInt(percentuale * w_max / 100) var h = parseInt(percentuale * h_max / 100) var x = parseInt((w_max-w)/2) var y = parseInt((h_max-h)/3) stato = stato + ",top=" + y stato = stato + ",left=" + x stato = stato + ",width=" + w stato = stato + ",height=" + h } return stato } //============================================================= function campo_valore(stringa,campo_nome) { var tre = "" var uno = stringa.split("<" + campo_nome + ">") if(uno.length == 2) { var due = uno[1].split("") if(due.length == 2){tre = due[0]} } return tre } //============================================================= function oggetto_proprieta(obj) { var s = "" for (var x in obj) { s = s + "
" + x + " = " + obj[x] } return s } //============================================================= function rimpiazza(url) { top.pop_inoltra_start() top.location.replace(url) } function identifica_sistema() { var s="" s = s + "\r\n_________________________________\r\n\r\n" s = s + "BROWSER = " var a = "SCONOSCIUTO" if(document.all){a = "EXPLORER"} else { if (navigator.userAgent.toUpperCase().indexOf("FIREFOX") > -1){a = "FIREFOX"} else { if (navigator.userAgent.toUpperCase().indexOf("NETSCAPE") > -1){a = "NETSCAPE"} else { if (navigator.userAgent.toUpperCase().indexOf("CHROME") > -1){a = "CHROME"} else { if (navigator.userAgent.toUpperCase().indexOf("SAFARI") > -1){a = "SAFARI"} else { if (navigator.userAgent.toUpperCase().indexOf("OPERA") > -1){a = "OPERA"} else { if (navigator.userAgent.toUpperCase().indexOf("KONQUEROR") > -1) {a = "KONQUEROR"} } } } } } } s = s + a + "\r\n" s = s + "\r\nSCHERMO = " + screen.width + " x " + screen.height + "\r\n" s = s + "\r\nnavigator.platform = " + navigator.platform + "\r\n" s = s + "\r\nnavigator.appVersion = " + navigator.appVersion + "\r\n" s = s + "\r\nnavigator.userAgent = " + navigator.userAgent + "\r\n" s = s + "\r\n_________________________________\r\n" return s } //------------------------------------------------------------ function boole(x) { if (typeof x === "boolean") { //alert("boole") return x } else { if (x == null || x == undefined) { //alert("niente") return false } else { if (typeof x === "number") { //alert("numero") if(x==-1) { return true } else { return false } } else { if (typeof x === "string") { //alert("stringa") var z = x.toUpperCase() if(z == "VERO" || z == "TRUE" || z == "ON" || z == "-1") { return true } else { return false } } else { alert("bo") return false } } } } } //------------------------------------------------------------ function vuoto(dato) { var x = dato if (x == null || x == undefined){x = ""} return x } //------------------------------------------------------------ function zero(dato) { var x = dato if (x == null || x == undefined || isNaN(x) || trim(x)==""){x = 0} return x } //------------------------------------------------------------ function EstraeCampo(stringa,n) { var campo="" var prec=-1 for (var i =1; i <= n; i++) { var inizio=prec+1 var p=stringa.indexOf("\t",inizio) if (p>=inizio) { campo=stringa.substring(inizio,p) } else { campo="" i=n+1 } prec=p } return campo } //##################################################################### function parametro_estrae_n(nome,parametri) { var x = 0 try{x = parametri.split(nome)[1].split(",")[0]}catch(err){x = 0} if(isNaN(x) || x==null || x==undefined || x==""){x = 0} return eval(x) } //##################################################################### function parametro_estrae_a(nome,parametri) { var x="" try{x = parametri.split(nome)[1].split(",")[0]}catch(err){x=""} if(x==null || x==undefined || x==""){x = ""} return x } //##################################################################### function casuale() { var random = new Date() var random = stringa_pulizia(Math.random() + "" + random.getTime() , "0123456789") return random } //##################################################################### function stringa_pulizia(stringa,ammessi) { var s = stringa + "" var y = "" var a = "" for (var i = 0 ; i < s.length ; i++) { a = s.charAt(i) if (ammessi.indexOf(a)>=0){y += a} } return y } //##################################################################### function querystring(parametro) { var ind = window.location.search.substring(1).split("&") var x = "" for(var i=0 ; i < ind.length ; i++) { x = ind[i].split("=") if(x.length > 0) { if(x[0].toLowerCase() == parametro.toLowerCase()) { return x[1] } } } return "" } //####################################################################### function sistema_testo_linkato(testo,br,massima_lunghezza_url) { /*--------------------------------------------------------- utilizza: http://alexcorvi.github.io/anchorme.js/ testo (tipicamente da textarea) da sistemare 1) Converte link in finestre apribili, la visualizzazione del link è limitata "massima_lunghezza_url" (se manca non è limitata) 2) Le email aprono il client di posta elettronica impostato localmente 3) br se "true" trasforma i ritorni a capo in "
" 4) La funzione ritorna il testo sistemato NOTA: Per rendere al meglio il testo sistemato conviene riprodurlo in html attraverso un "div" a larghezza limitata: in tal modo interviene il word-wrap previsto nel "css" generale:
testo sistemato
---------------------------------------------------------*/ var y = testo if(br) { y = y.replace(/\n\r/g, "
") y = y.replace(/\r\n/g, "
") y = y.replace(/\r/g, "
") y = y.replace(/\n/g, "
") } var tronca = Infinity if(arguments.length >= 3) {tronca = parseInt(massima_lunghezza_url)} return anchorme(y,{attributes:[ function(urlObj) { if(urlObj.protocol !== "mailto:") { var obj = {name:"onclick",value:"javascript:window.open(this.href,'',pop_stato_window(70));return false"}; return obj } } ], truncate: tronca, }) } //####################################################################### function allinea_destra(stringa,larghezza) { var y = trim(stringa,' ') while (y.length < larghezza){y = ' ' + y} return y } //####################################################################### function allinea_centro(stringa,larghezza) { var largo=Math.round((larghezza+stringa.length)/2) var y = trim(stringa,' ') while (y.length < largo){y = ' ' + y} return y } //####################################################################### function stringa_da_intero(numero,dec) { var z=stringa_pulizia(numero,'-0123456789') var segno='' if (z.charAt(0)=='-'){segno="-";z=z.substring(1,z.length)} if (z==''){z='0'} //------------------------------------ //while (z.length0){z=z+','+decimale} return z } //####################################################################### function rstringa_numerica(stringa,dec) { //-------------- serve a mostrare stringa numerica (mette il separatore di migliaia e mette i decimali richiesti separandoli da , ) //-------------- nota: la stringa numerica va fornita nel formato xxxxxxxx,yyyyy var z=trim(stringa,' ') var segno='' if (z.charAt(0)=='-'){segno="-";z=z.substring(1,z.length)} z=z+',' var v=z.indexOf(',') var intero=z.substring(0,v) var decimale=z.substring(v+1,z.length) intero=stringa_pulizia(intero,'0123456789') intero=ltrim(intero,'0') if (intero==''){intero='0'} var y='' while (intero.length>3){y="."+intero.substring(intero.length-3,intero.length)+y;intero=intero.substring(0,intero.length-3)} intero=intero+y decimale=stringa_pulizia(decimale,'0123456789') decimale=decimale.substring(0,dec) while (decimale.length0){z=z+','+decimale} return z } //####################################################################### function ltrim(stringa,carattere) { if (arguments.length == 1){var carattere = ' '} var y='' var z=stringa+'' var flag=false var a='' for (var i=0;i 3) {y = y.replace(/\B(?=(?:\d{3})+(?!\d))/g, ".")} return y } //####################################################################### function disabilita_incolla(event) { var ctrl = (typeof event.modifiers == "undefined") ? event.ctrlKey : event.modifiers & event.CONTROL_MASK var charCode = (event.which) ? event.which : event.keyCode if(ctrl && charCode == 118 ) {return false} } //####################################################################### function tutte_checkbox_onoff(obj,campo,onoff) { for (var i=0;i -1)) { if (obj.elements[i].checked) { x=true } } } return x } //####################################################################### function oggetto_poprieta_valori(obj) { var s = "" var proprieta ="" for(proprieta in obj) { s = s + proprieta + " = " + obj[proprieta] + "
" } return s } //####################################################################### function da_oggetto_a_stringa(obj) { return JSON.stringify(obj) } //####################################################################### function da_stringa_a_oggetto(stringa) { return JSON.parse(stringa) } //###################################################################### function get_radio_value(obj) { var radio_value = null for (var i=0; i < obj.length; i++) { if (obj[i].checked) { var radio_value = obj[i].value; } } return radio_value } //###################################################################### function codifica_html_completa(s) { var z = "" for (var i = 0 ; i < s.length ; i++) { z = z + "&#" + s.charCodeAt(i) + ";" } return z } //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| AVANZATE //##################################################################### function bottone_old(largo,alto,titolo,lancio) { var w="\u0022" var crlf="\u000d\u000a" var colore_out = "#E6E6FF" var colore_in = "#6A6AD4" var bordo = "1px solid #BBBBBB" var s = "" s = s + "" + crlf s = s + "
" + titolo + "
" return s } //##################################################################### function bottone_old_1(parametri) { //parametri="w=23,h=0,bordo_px=2,bordo_colore=#CCCCCC,bordo_raggio_px=6,colore_out=#E6E6FF,colore_in=#6A6AD4,titolo=X,titolo_stile=padding:0px;font-size:15px;font-weight:bold;,lancio=chiudi()" var vv="\u0022" //var w = parametro_estrae_n("w=",parametri) //var h = parametro_estrae_n("h=",parametri) var w = parametro_estrae_a("w=",parametri) var h = parametro_estrae_a("h=",parametri) var bordo_px = parametro_estrae_n("bordo_px=",parametri) var bordo_colore = parametro_estrae_a("bordo_colore=",parametri) var bordo_raggio_px = parametro_estrae_n("bordo_raggio_px=",parametri) var colore_out = parametro_estrae_a("colore_out=",parametri) var colore_in = parametro_estrae_a("colore_in=",parametri) var titolo = parametro_estrae_a("titolo=",parametri) var titolo_stile = parametro_estrae_a("titolo_stile=",parametri) var lancio = parametro_estrae_a("lancio=",parametri) var bordo = bordo_px + "px solid " + bordo_colore + ";-webkit-border-radius:" + bordo_raggio_px + "px;-moz-border-radius:" + bordo_raggio_px + "px;border-radius:" + bordo_raggio_px + "px;" var s = "" s = s + " " s = s + "
" + titolo + "
" return s } //##################################################################### function bottone(parametri) { //parametri="w=23,h=0,bordo_px=2,bordo_colore=#CCCCCC,bordo_raggio_px=6,colore_out=#E6E6FF,colore_in=#6A6AD4,titolo=X,titolo_stile=padding:0px;font-size:15px;font-weight:bold;,lancio=chiudi()" var regex = new RegExp("\u0020", 'g'); var vv="\u0022" var w = parametro_estrae_n("w=",parametri) var h = parametro_estrae_n("h=",parametri) var bordo_px = parametro_estrae_n("bordo_px=",parametri) var bordo_colore = parametro_estrae_a("bordo_colore=",parametri) var bordo_raggio_px = parametro_estrae_n("bordo_raggio_px=",parametri) var colore_out = parametro_estrae_a("colore_out=",parametri) var colore_in = parametro_estrae_a("colore_in=",parametri) var titolo = parametro_estrae_a("titolo=",parametri) titolo = titolo.replace(regex, ' '); var titolo_stile = parametro_estrae_a("titolo_stile=",parametri) var lancio = parametro_estrae_a("lancio=",parametri) var bordo = bordo_px + "px solid " + bordo_colore + ";-webkit-border-radius:" + bordo_raggio_px + "px;-moz-border-radius:" + bordo_raggio_px + "px;border-radius:" + bordo_raggio_px + "px;" var s = "" s = s + " " s = s + "
" + titolo + "
" alert(s) return s } //##################################################################### //##################################################################### function link_style(obj,dentro) { obj.blur() if(dentro) { obj.style.color = "#FF0000" obj.style.textDecoration= "Underline" } else { obj.style.color = "#2222D4" obj.style.textDecoration = "None" } } //##################################################################### function campo_entra(obj,entra) { if (entra) { obj.style.backgroundColor='#F2F2F2' } else { obj.style.backgroundColor='#FFFFFF' } } //##################################################################### function dimensiona_iframe() { if (self!=top) { var m = 10 var h = document.body.scrollHeight setTimeout(function() {parent.document.getElementById(self.name).style.height = m}, 1) setTimeout(function() {parent.document.getElementById(self.name).style.height = h + m }, 100) setTimeout(function() {parent.dimensiona_iframe()}, 200) } } //##################################################################### function altezza_documento() { var D = document; return Math.max( Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), Math.max(D.body.clientHeight, D.documentElement.clientHeight) ); } //##################################################################### function beep(url) { document.body.appendChild(document.createElement("div")) document.body.lastChild.innerHTML = "" } //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| COOKIES //-------------------------------------------------------- function cookie_abilitati() { cookie_cancella("xyzrq") var s = false var obj = new Object() obj["xyzrq"] = "xyzrq" var x = cookie_registra_obj("xyzrq", obj,false) if(unescape(JSON.stringify(cookie_leggi_obj("xyzrq"))) == JSON.stringify(obj)){s = true} return s } //-------------------------------------------------------- function cookie_cancella(cookie_nome) { document.cookie = cookie_nome + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;" } //-------------------------------------------------------- function cookie_registra_obj(cookie_nome, cookie_obj, cookie_permanente) { //alert("scrive = " + cookie_nome) var cookieStr = cookie_nome + "="+ escape(JSON.stringify(cookie_obj)) if (cookie_permanente) { data_testo_fine="Wed, 23-Jan-2060 15:40:27 GMT" cookieStr += ";expires=" + data_testo_fine } document.cookie = cookieStr cookieStr += ";path=/;" //alert("scrive = " + cookieStr) return cookieStr } //-------------------------------------------------------- function cookie_leggi_obj(cookie_nome) { //alert("legge = " + cookie_nome) var obj = new Object() var searchName = cookie_nome + "=" var cookies = document.cookie var start = cookies.indexOf(cookie_nome) if (start != -1) { start += searchName.length var end = cookies.indexOf(";", start) if (end == -1){end = cookies.length} obj = JSON.parse(unescape(cookies.substring(start, end))) } return obj } //-------------------------------------------------------- VECCHI function cookie_leggi_old(cookie_nome){ var searchName = cookie_nome + "=" var cookies = document.cookie var start = cookies.indexOf(cookie_nome) if (start == -1){ // cookie not found return "" } start += searchName.length // start of cookie data var end = cookies.indexOf(";", start) if (end == -1){ end = cookies.length } return unescape(cookies.substring(start, end)) } //-------------------------------------------------------- function cookie_registra_old(cookie_nome, cookie_dati){ var cookieStr = cookie_nome + "="+ escape(cookie_dati) cookieStr += "; expires=Wed, 23-Jan-2030 15:40:27 GMT" cookieStr += "; path=/" document.cookie = cookieStr } //-------------------------------------------------------- function estrae_campo_old(stringa,n) { campo="" prec=-1 for (i =1; i <= n; i++) { inizio=prec+1 p=stringa.indexOf("\t",inizio) if (p>=inizio) { campo=stringa.substring(inizio,p) } else { campo="" i=n+1 } prec=p } return campo } //------------------------------------------------------------ function trim_old(stringa) { y='' z=stringa+'' flag=false for (i=0;i=0){return false} if(iniziale.indexOf("@.")>=0){return false} if(iniziale.indexOf("..")>=0){return false} //--------------------- CONTROLLO CHE 'DOPO' FINISCE CON .XX o .xxx var flag=true var kount=0 var l=0 for (var j=dopo.length-1;j>=0;j--) { l=l+1 if(flag && dopo.charAt(j)=="."){flag=false;kount=l} } if(kount<3 || kount>4){return false} //--------------------- OK return true } //------------------------------------------------------------ function estensione_file(file) { var x=file.substring(file.lastIndexOf('.') + 1,file.length); x=trim(x) x=x.toLowerCase() return x } //------------------------------------------------------------ function controllo_anagrafica_semplice(cognome,nome,email,telefoni) { var s = "" if(trim(vuoto(nome))==""){s = s + "
● Manca il nome"} if(trim(vuoto(cognome))==""){s = s + "
● Manca il cognome"} if(trim(vuoto(email))=="") { s = s + "
● Manca l'email" } else { if(!controllo_email(vuoto(email))){s = s + "
● Email errata"} } if(trim(vuoto(telefoni))==""){s = s + "
● Manca il telefono"} s = s + "" return s } //------------------------------------------------------------ function Controllo_Codice_Fiscale(codice) { var stringa = stringa_pulizia(codice.toUpperCase(),"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") if (stringa.length != 16){return false} var lung=null; var test=null; var lettere=new Array(); lettere[0]=["A","0","1"]; lettere[1]=["B","1","0"]; lettere[2]=["C","2","5"]; lettere[3]=["D","3","7"]; lettere[4]=["E","4","9"]; lettere[5]=["F","5","13"]; lettere[6]=["G","6","15"]; lettere[7]=["H","7","17"]; lettere[8]=["I","8","19"]; lettere[9]=["J","9","21"]; lettere[10]=["K","10","2"]; lettere[11]=["L","11","4"]; lettere[12]=["M","12","18"]; lettere[13]=["N","13","20"]; lettere[14]=["O","14","11"]; lettere[15]=["P","15","3"]; lettere[16]=["Q","16","6"]; lettere[17]=["R","17","8"]; lettere[18]=["S","18","12"]; lettere[19]=["T","19","14"]; lettere[20]=["U","20","16"]; lettere[21]=["V","21","10"]; lettere[22]=["W","22","22"]; lettere[23]=["X","23","25"]; lettere[24]=["Y","24","24"]; lettere[25]=["Z","25","23"]; lettere[26]=["0","0","1"]; lettere[27]=["1","1","0"]; lettere[28]=["2","2","5"]; lettere[29]=["3","3","7"]; lettere[30]=["4","4","9"]; lettere[31]=["5","5","13"]; lettere[32]=["6","6","15"]; lettere[33]=["7","7","17"]; lettere[34]=["8","8","19"]; lettere[35]=["9","9","21"]; var ConfrontoCarattereControllo=new Array(); ConfrontoCarattereControllo[0]=["A"]; ConfrontoCarattereControllo[1]=["B"]; ConfrontoCarattereControllo[2]=["C"]; ConfrontoCarattereControllo[3]=["D"]; ConfrontoCarattereControllo[4]=["E"]; ConfrontoCarattereControllo[5]=["F"]; ConfrontoCarattereControllo[6]=["G"]; ConfrontoCarattereControllo[7]=["H"]; ConfrontoCarattereControllo[8]=["I"]; ConfrontoCarattereControllo[9]=["J"]; ConfrontoCarattereControllo[10]=["K"]; ConfrontoCarattereControllo[11]=["L"]; ConfrontoCarattereControllo[12]=["M"]; ConfrontoCarattereControllo[13]=["N"]; ConfrontoCarattereControllo[14]=["O"]; ConfrontoCarattereControllo[15]=["P"]; ConfrontoCarattereControllo[16]=["Q"]; ConfrontoCarattereControllo[17]=["R"]; ConfrontoCarattereControllo[18]=["S"]; ConfrontoCarattereControllo[19]=["T"]; ConfrontoCarattereControllo[20]=["U"]; ConfrontoCarattereControllo[21]=["V"]; ConfrontoCarattereControllo[22]=["W"]; ConfrontoCarattereControllo[23]=["X"]; ConfrontoCarattereControllo[24]=["Y"]; ConfrontoCarattereControllo[25]=["Z"]; var Carattere=0; var ValorePari=1; var ValoreDispari=2; var SommaCaratteri=0; var PariDispari=null; var lung=stringa.length; var CarattereControllo=stringa.substr(lung-1,1); stringa=stringa.substring(lung-1,0); lung=stringa.length; for (var i=0; i<=lung-1; i++) { if ((i+1)%2==0) { var PariDispari='P' } else { var PariDispari='D' } var temp=stringa.charAt(i); for (var t=0; t<=35; t++) { test=lettere[t][Carattere]; if (temp==test){break} } if(PariDispari=='P') { SommaCaratteri=SommaCaratteri+parseInt(lettere[t][ValorePari]) } else { SommaCaratteri=SommaCaratteri+parseInt(lettere[t][ValoreDispari]) } } var Risultato=SommaCaratteri % 26; Risultato=ConfrontoCarattereControllo[Risultato][0]; if (Risultato==CarattereControllo) { return true } else { return false } } //------------------------------------------------------------ function Controllo_Partita_IVA(codice) { var pi = stringa_pulizia(codice.toUpperCase(),"0123456789") if (pi.length != 11){return false} var s = 0; for( i = 0; i <= 9; i += 2 ) s += pi.charCodeAt(i) - '0'.charCodeAt(0); for( i = 1; i <= 9; i += 2 ){ var c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) ); if( c > 9 ) c = c - 9; s += c; } if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) ) return false; return true; } //------------------------------------------------------------ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| JSON /* json2.js 2013-05-26 Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. See http://www.JSON.org/js.html This code should be minified before deployment. See http://javascript.crockford.com/jsmin.html USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO NOT CONTROL. This file creates a global JSON object containing two methods: stringify and parse. JSON.stringify(value, replacer, space) value any JavaScript value, usually an object or array. replacer an optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings. space an optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or ' '), it contains the characters used to indent at each level. This method produces a JSON text from a JavaScript value. When an object value is found, if the object contains a toJSON method, its toJSON method will be called and the result will be stringified. A toJSON method does not serialize: it returns the value represented by the name/value pair that should be serialized, or undefined if nothing should be serialized. The toJSON method will be passed the key associated with the value, and this will be bound to the value For example, this would serialize Dates as ISO strings. Date.prototype.toJSON = function (key) { function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; }; You can provide an optional replacer method. It will be passed the key and value of each member, with this bound to the containing object. The value that is returned from your method will be serialized. If your method returns undefined, then the member will be excluded from the serialization. If the replacer parameter is an array of strings, then it will be used to select the members to be serialized. It filters the results such that only members with keys listed in the replacer array are stringified. Values that do not have JSON representations, such as undefined or functions, will not be serialized. Such values in objects will be dropped; in arrays they will be replaced with null. You can use a replacer function to replace those with JSON values. JSON.stringify(undefined) returns undefined. The optional space parameter produces a stringification of the value that is filled with line breaks and indentation to make it easier to read. If the space parameter is a non-empty string, then that string will be used for indentation. If the space parameter is a number, then the indentation will be that many spaces. Example: text = JSON.stringify(['e', {pluribus: 'unum'}]); // text is '["e",{"pluribus":"unum"}]' text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' text = JSON.stringify([new Date()], function (key, value) { return this[key] instanceof Date ? 'Date(' + this[key] + ')' : value; }); // text is '["Date(---current time---)"]' JSON.parse(text, reviver) This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception. The optional reviver parameter is a function that can filter and transform the results. It receives each of the keys and values, and its return value is used instead of the original value. If it returns what it received, then the structure is not modified. If it returns undefined then the member is deleted. Example: // Parse the text. Values that look like ISO date strings will // be converted to Date objects. myData = JSON.parse(text, function (key, value) { var a; if (typeof value === 'string') { a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); if (a) { return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6])); } } return value; }); myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { var d; if (typeof value === 'string' && value.slice(0, 5) === 'Date(' && value.slice(-1) === ')') { d = new Date(value.slice(5, -1)); if (d) { return d; } } return value; }); This is a reference implementation. You are free to copy, modify, or redistribute. */ /*jslint evil: true, regexp: true */ /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf */ // Create a JSON object only if one does not already exist. We create the // methods in a closure to avoid creating global variables. if (typeof JSON !== 'object') { JSON = {}; } (function () { 'use strict'; function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function () { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null; }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function () { return this.valueOf(); }; } var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }, rep; function quote(string) { // If the string contains no control characters, no quote characters, and no // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; } function str(key, holder) { // Produce a string from holder[key]. var i, // The loop counter. k, // The member key. v, // The member value. length, mind = gap, partial, value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === 'function') { value = rep.call(holder, key, value); } // What happens next depends on the value's type. switch (typeof value) { case 'string': return quote(value); case 'number': // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce 'null'. The case is included here in // the remote chance that this gets fixed someday. return String(value); // If the type is 'object', we might be dealing with an object or an array or // null. case 'object': // Due to a specification blunder in ECMAScript, typeof null is 'object', // so watch out for that case. if (!value) { return 'null'; } // Make an array to hold the partial results of stringifying this object value. gap += indent; partial = []; // Is the value an array? if (Object.prototype.toString.apply(value) === '[object Array]') { // The value is an array. Stringify every element. Use null as a placeholder // for non-JSON values. length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } // Join all of the elements together, separated with commas, and wrap them in // brackets. v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; } // If the replacer is an array, use it to select the members to be stringified. if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === 'string') { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { // Otherwise, iterate through all of the keys in the object. for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } // Join all of the member texts together, separated with commas, // and wrap them in braces. v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; } } // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== 'function') { JSON.stringify = function (value, replacer, space) { // The stringify method takes a value and an optional replacer, and an optional // space parameter, and returns a JSON text. The replacer can be a function // that can replace values, or an array of strings that will select the keys. // A default replacer method can be provided. Use of the space parameter can // produce text that is more easily readable. var i; gap = ''; indent = ''; // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } // If the space parameter is a string, it will be used as the indent string. } else if (typeof space === 'string') { indent = space; } // If there is a replacer, it must be a function or an array. // Otherwise, throw an error. rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } // Make a fake root object containing our value under the key of ''. // Return the result of stringifying the value. return str('', {'': value}); }; } // If the JSON object does not yet have a parse method, give it one. if (typeof JSON.parse !== 'function') { JSON.parse = function (text, reviver) { // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); }; } }()); //------------------------------------------------------------ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ANCHORME /*--------------------------------------------------------- VEDI: http://alexcorvi.github.io/anchorme.js/ Utilizzato in: function sistema_testo_linkato(testo,br,massima_lunghezza_url) ---------------------------------------------------------*/ //##################################################################### !function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.anchorme=a()}(this,function(){"use strict";function e(e,a){return a={exports:{}},e(a,a.exports),a.exports}var a=e(function(e,a){function n(e){return e||(e={attributes:[],ips:!0,emails:!0,urls:!0,files:!0,truncate:1/0,defaultProtocol:"http://",list:!1}),"object"!=typeof e.attributes&&(e.attributes=[]),"boolean"!=typeof e.ips&&(e.ips=!0),"boolean"!=typeof e.emails&&(e.emails=!0),"boolean"!=typeof e.urls&&(e.urls=!0),"boolean"!=typeof e.files&&(e.files=!0),"boolean"!=typeof e.list&&(e.list=!1),"string"!=typeof e.defaultProtocol&&"function"!=typeof e.defaultProtocol&&(e.defaultProtocol="http://"),"number"==typeof e.truncate||"object"==typeof e.truncate&&null!==e.truncate||(e.truncate=1/0),e}function t(e){return!isNaN(Number(e))&&!(Number(e)>65535)}Object.defineProperty(a,"__esModule",{value:!0}),a.defaultOptions=n,a.isPort=t}),n=e(function(e,a){Object.defineProperty(a,"__esModule",{value:!0}),a.tlds=["com","org","net","uk","gov","edu","io","cc","co","aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","active","actor","ad","adac","ads","adult","ae","aeg","aero","aetna","af","afamilycompany","afl","africa","ag","agakhan","agency","ai","aig","aigo","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blanco","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnl","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","boots","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","budapest","bugatti","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","cancerresearch","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","cartier","casa","case","caseih","cash","casino","cat","catering","catholic","cba","cbn","cbre","cbs","cd","ceb","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","chase","chat","cheap","chintai","chloe","christmas","chrome","chrysler","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","coach","codes","coffee","college","cologne","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","csc","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dodge","dog","doha","domains","dot","download","drive","dtv","dubai","duck","dunlop","duns","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epost","epson","equipment","er","ericsson","erni","es","esq","estate","esurance","et","eu","eurovision","eus","events","everbank","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fujixerox","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glade","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodhands","goodyear","goog","google","gop","got","gp","gq","gr","grainger","graphics","gratis","green","gripe","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","honeywell","horse","hospital","host","hosting","hot","hoteles","hotmail","house","how","hr","hsbc","ht","htc","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","industries","infiniti","info","ing","ink","institute","insurance","insure","int","intel","international","intuit","investments","ipiranga","iq","ir","irish","is","iselect","ismaili","ist","istanbul","it","itau","itv","iveco","iwc","jaguar","java","jcb","jcp","je","jeep","jetzt","jewelry","jio","jlc","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","ladbrokes","lamborghini","lamer","lancaster","lancia","lancome","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","liaison","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","linde","link","lipsy","live","living","lixil","lk","loan","loans","locker","locus","loft","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","lupin","luxe","luxury","lv","ly","ma","macys","madrid","maif","maison","makeup","man","management","mango","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mcd","mcdonalds","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","meo","metlife","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","mobily","moda","moe","moi","mom","monash","money","monster","montblanc","mopar","mormon","mortgage","moscow","moto","motorcycles","mov","movie","movistar","mp","mq","mr","ms","msd","mt","mtn","mtpc","mtr","mu","museum","mutual","mv","mw","mx","my","mz","na","nab","nadex","nagoya","name","nationwide","natura","navy","nba","nc","ne","nec","netbank","netflix","network","neustar","new","newholland","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","off","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","onyourside","ooo","open","oracle","orange","organic","orientexpress","origins","osaka","otsuka","ott","ovh","pa","page","pamperedchef","panasonic","panerai","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","philips","phone","photo","photography","photos","physio","piaget","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","qvc","racing","radio","raid","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","rightathome","ril","rio","rip","rmit","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sapo","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scjohnson","scor","scot","sd","se","seat","secure","security","seek","select","sener","services","ses","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","shriram","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","space","spiegel","spot","spreadbetting","sr","srl","srt","st","stada","staples","star","starhub","statebank","statefarm","statoil","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiftcover","swiss","sx","sy","sydney","symantec","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","telecity","telefonica","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","uconnect","ug","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","vista","vistaprint","viva","vivo","vlaanderen","vn","vodka","volkswagen","volvo","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","warman","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","xn--11b4c3d","xn--1ck2e1b","xn--1qqw23a","xn--30rr7y","xn--3bst00m","xn--3ds443g","xn--3e0b707e","xn--3oq18vl8pn36a","xn--3pxu8k","xn--42c2d9a","xn--45brj9c","xn--45q11c","xn--4gbrim","xn--54b7fta0cc","xn--55qw42g","xn--55qx5d","xn--5su34j936bgsg","xn--5tzm5g","xn--6frz82g","xn--6qq986b3xl","xn--80adxhks","xn--80ao21a","xn--80aqecdr1a","xn--80asehdb","xn--80aswg","xn--8y0a063a","xn--90a3ac","xn--90ae","xn--90ais","xn--9dbq2a","xn--9et52u","xn--9krt00a","xn--b4w605ferd","xn--bck1b9a5dre4c","xn--c1avg","xn--c2br7g","xn--cck2b3b","xn--cg4bki","xn--clchc0ea0b2g2a9gcd","xn--czr694b","xn--czrs0t","xn--czru2d","xn--d1acj3b","xn--d1alf","xn--e1a4c","xn--eckvdtc9d","xn--efvy88h","xn--estv75g","xn--fct429k","xn--fhbei","xn--fiq228c5hs","xn--fiq64b","xn--fiqs8s","xn--fiqz9s","xn--fjq720a","xn--flw351e","xn--fpcrj9c3d","xn--fzc2c9e2c","xn--fzys8d69uvgm","xn--g2xx48c","xn--gckr3f0f","xn--gecrj9c","xn--gk3at1e","xn--h2brj9c","xn--hxt814e","xn--i1b6b1a6a2e","xn--imr513n","xn--io0a7i","xn--j1aef","xn--j1amh","xn--j6w193g","xn--jlq61u9w7b","xn--jvr189m","xn--kcrx77d1x4a","xn--kprw13d","xn--kpry57d","xn--kpu716f","xn--kput3i","xn--l1acc","xn--lgbbat1ad8j","xn--mgb9awbf","xn--mgba3a3ejt","xn--mgba3a4f16a","xn--mgba7c0bbn0a","xn--mgbaam7a8h","xn--mgbab2bd","xn--mgbai9azgqp6j","xn--mgbayh7gpa","xn--mgbb9fbpob","xn--mgbbh1a71e","xn--mgbc0a9azcg","xn--mgbca7dzdo","xn--mgberp4a5d4ar","xn--mgbi4ecexp","xn--mgbpl2fh","xn--mgbt3dhd","xn--mgbtx2b","xn--mgbx4cd0ab","xn--mix891f","xn--mk1bu44c","xn--mxtq1m","xn--ngbc5azd","xn--ngbe9e0a","xn--node","xn--nqv7f","xn--nqv7fs00ema","xn--nyqy26a","xn--o3cw4h","xn--ogbpf8fl","xn--p1acf","xn--p1ai","xn--pbt977c","xn--pgbs0dh","xn--pssy2u","xn--q9jyb4c","xn--qcka1pmc","xn--qxam","xn--rhqv96g","xn--rovu88b","xn--s9brj9c","xn--ses554g","xn--t60b56a","xn--tckwe","xn--tiq49xqyj","xn--unup4y","xn--vermgensberater-ctb","xn--vermgensberatung-pwb","xn--vhquv","xn--vuq861b","xn--w4r85el8fhu5dnra","xn--w4rs40l","xn--wgbh1c","xn--wgbl6a","xn--xhq521b","xn--xkc2al3hye2a","xn--xkc2dl3a5ee0h","xn--y9a3aq","xn--yfro4i67o","xn--ygbi2ammx","xn--zfr164b","xperia","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zippo","zm","zone","zuerich","zw"],a.htmlAttrs=["src=","data=","href=","cite=","formaction=","icon=","manifest=","poster=","codebase=","background=","profile=","usemap="]}),t=e(function(e,a){function t(e){var a=e.match(o);if(null===a)return!1;for(var t=r.length-1;t>=0;t--)if(r[t].test(e))return!1;var i=a[2];return!!i&&-1!==n.tlds.indexOf(i)}Object.defineProperty(a,"__esModule",{value:!0});var o=/^[a-z0-9!#$%&'*+\-\/=?^_`{|}~.]+@([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?$/i,r=[/^[!#$%&'*+\-\/=?^_`{|}~.]/,/[.]{2,}[a-z0-9!#$%&'*+\-\/=?^_`{|}~.]+@/i,/\.@/];a.default=t}),o=e(function(e,n){function t(e){if(!o.test(e))return!1;var n=e.split("."),t=Number(n[0]);if(isNaN(t)||t>255||t<0)return!1;var r=Number(n[1]);if(isNaN(r)||r>255||r<0)return!1;var i=Number(n[2]);if(isNaN(i)||i>255||i<0)return!1;var s=Number((n[3].match(/^\d+/)||[])[0]);if(isNaN(s)||s>255||s<0)return!1;var c=(n[3].match(/(^\d+)(:)(\d+)/)||[])[3];return!(c&&!a.isPort(c))}Object.defineProperty(n,"__esModule",{value:!0});var o=/^(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i;n.default=t}),r=e(function(e,t){function o(e){var t=e.match(r);return null!==t&&("string"==typeof t[3]&&(-1!==n.tlds.indexOf(t[3].toLowerCase())&&!(t[5]&&!a.isPort(t[5]))))}Object.defineProperty(t,"__esModule",{value:!0});var r=/^(https?:\/\/|ftps?:\/\/)?([a-z0-9%\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?$/i;t.default=o}),i=e(function(e,a){function n(e,a,t){return e.forEach(function(o,r){!(o.indexOf(".")>-1)||e[r-1]===a&&e[r+1]===t||e[r+1]!==a&&e[r+1]!==t||(e[r]=e[r]+e[r+1],"string"==typeof e[r+2]&&(e[r]=e[r]+e[r+2]),"string"==typeof e[r+3]&&(e[r]=e[r]+e[r+3]),"string"==typeof e[r+4]&&(e[r]=e[r]+e[r+4]),e.splice(r+1,4),n(e,a,t))}),e}function t(e){return e=n(e,"(",")"),e=n(e,"[","]"),e=n(e,'"','"'),e=n(e,"'","'")}Object.defineProperty(a,"__esModule",{value:!0}),a.fixSeparators=n,a.default=t}),s=e(function(e,a){function n(e){var a=e.replace(/([\s\(\)\[\]<>"'])/g,"\0$1\0").replace(/([?;:,.!]+)(?=(\0|$|\s))/g,"\0$1\0").split("\0");return i.default(a)}function t(e){return e.join("")}Object.defineProperty(a,"__esModule",{value:!0}),a.separate=n,a.deSeparate=t}),c=e(function(e,a){function n(e){return e=e.toLowerCase(),0===e.indexOf("http://")?"http://":0===e.indexOf("https://")?"https://":0===e.indexOf("ftp://")?"ftp://":0===e.indexOf("ftps://")?"ftps://":0===e.indexOf("file:///")?"file:///":0===e.indexOf("mailto:")&&"mailto:"}Object.defineProperty(a,"__esModule",{value:!0}),a.default=n}),l=e(function(e,a){function i(e,a){return e.map(function(i,s){var l=encodeURI(i);if(l.indexOf(".")<1&&!c.default(l))return i;var u=null,d=c.default(l)||"";return d&&(l=l.substr(d.length)),a.files&&"file:///"===d&&l.split(/\/|\\/).length-1&&(u={reason:"file",protocol:d,raw:i,encoded:l}),!u&&a.urls&&r.default(l)&&(u={reason:"url",protocol:d||("function"==typeof a.defaultProtocol?a.defaultProtocol(i):a.defaultProtocol),raw:i,encoded:l}),!u&&a.emails&&t.default(l)&&(u={reason:"email",protocol:"mailto:",raw:i,encoded:l}),!u&&a.ips&&o.default(l)&&(u={reason:"ip",protocol:d||("function"==typeof a.defaultProtocol?a.defaultProtocol(i):a.defaultProtocol),raw:i,encoded:l}),u&&("'"!==e[s-1]&&'"'!==e[s-1]||!~n.htmlAttrs.indexOf(e[s-2]))?u:i})}Object.defineProperty(a,"__esModule",{value:!0}),a.default=i}),u=e(function(e,a){function n(e,a){var n=o.separate(e),r=l.default(n,a);if(a.exclude)for(var i=0;ia.truncate&&(t=t.substring(0,a.truncate)+"..."),"object"==typeof a.truncate&&t.length>a.truncate[0]+a.truncate[1]&&(t=t.substr(0,a.truncate[0])+"..."+t.substr(t.length-a.truncate[1])),void 0===a.attributes&&(a.attributes=[]),'"+t+""}Object.defineProperty(a,"__esModule",{value:!0});var o=s;a.default=n}),d=e(function(e,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(e,n){return n=a.defaultOptions(n),u.default(e,n)};i.validate={ip:o.default,url:function(e){var a=c.default(e)||"";return e=e.substr(a.length),e=encodeURI(e),r.default(e)},email:t.default},n.default=i});return function(e){return e&&e.__esModule?e.default:e}(d)}); //#####################################################################