文件操作 - ilfas.js
返回文件管理
返回主菜单
删除本文件
文件: /root/.local/share/Trash/files/layout/scripts/ilfas.js
编辑文件内容
/** */ // Sito offline var OFFLINE = false; var PREVIEW = false; var PAGE = ""; var DATABASE = "ilfas.mdb"; var PATH = window.location.pathname; var MAIL_ADMINS = "seo@planetline.it"; var SITENAME = window.location.protocol +"//"+ window.location.host; var CARTELLATEST = ""; var CARTELLAIMAGES = "images/"; $(document).ready(function(){ //$(function(){ //window.load = function(){ console.log("Ready ilfas"); if ($("#wait")[0]){ var d= setTimeout(function(){ $("#wait").hide(); }, 460); var tt=setTimeout(function(){ if ($("#maindiv")[0] ) { $("#maindiv").fadeIn(600,showIt); }else{ if ($("#bd")[0]){ $("#bd").fadeIn(600,showIt); }else{ showIt(); } } },460); }else{ showIt(); } function showIt(){ $("#wait").hide(); //console.log("init"); PAGE = window.location.pathname; PREVIEW = window.location.queryString.preview; //console.log("page "+PAGE+", "+SITENAME); if (!PREVIEW) {PREVIEW='';} //console.log("preview "+PREVIEW); if ( PREVIEW > '' ) { //|| PAGE.indexOf( default.asp ) == -1 || PAGE=="/" // Se è preview va avanti normale var dummy=""; }else{ // se offline torna if ( OFFLINE===true ) { /* console.log("offline"); $('head').append('<style>'+ '.piep{font: normal 13px lucida sans; }'+ '.flags{ display: inline; cursor:pointer;}'+ '</style>' ); $("body").css({ backgroundcolor:"#fafafa"}); $("div").css({ font:"italic 18pt arial", color:'#222' }); $("#cesp, #cita, #ceng").css({ font: 'normal 13px lucida sans', margin: '0 0 60px 0' }); */ /* */ sel_lang('ita'); $(".flags").click(function(){ sel_lang(this.id.substr(1)); }); $("#offline").show(); sel_lang('ita'); return; } } //console.log("start") //$("#art-page-background-glare-image").css({padding: '0px', margin:'0px'}).show(); /* Codice del sito ONLINE */ // Aggiungo il preview ai link //addPreviewLinks(); // Inizializzo lo slider //showSlider(); // hover dei menu effetto //menu(); // Gestione preferiti //preferiti(); // Evito il submit del form da fonti esterne //contactsBlockFormSubmit(); // click per il send mail contatti //sendMailContacts(); // Carico la mappa //loadMap(); // Check del login checkLogin(); // Animazione dell'apertura //doAnimateOpen(); // Fancy Box all images //fancyBoxAllImages(); /* if ( PAGE.toLowerCase().indexOf("prodotti")>-1 || PAGE.toLowerCase().indexOf("preferiti")>-1){ $(".fancybox") .attr('rel', 'gallery') .fancybox({ beforeLoad: function() { var el, id = $(this.element).data('title-id'); if (id) { el = $('#' + id); if (el.length) { this.title = el.html(); } } } }); } */ // Pagamenti / paypal //doPayPal(); //ricevutaPaypal(); // Social toolbar a destra //setSocialBar(); // Back to top in basso a destra //setBackToTop(); // Nascondi eventuale indice delle pagine interne //hideShowIndexPage(); // Invia commento pop a destra //sendComment(); // Getione commenti degli articoli //articlesComments(); // Colora la riga in funzione della pagina //rowColourPage(); // Sitemo il width del footer e dell'header //adjustHeadFooter(); // contattaci contattaci(); // Barra float a destra //floatRight(); // Se c'e' un form o controllo checkbox aggiusta l'etichetta //adjustForm(); // Preventivi //formPreventivi(); //console.log("formPreventivi "+formPreventivi.tipo); // richiesta x eebattery e altri progetti //projectRequest(); // slider taxicab //sliderTaxicab(); } }); function preferiti(){ } function sliderTaxicab(){ if (!getEl("holderslider")){return} // Slider var currimg = 1; var nextimg = 0; var ts = setInterval( function(){ console.log("currimg "+currimg); $( "#slide"+currimg ).fadeOut(800, function(){ $( "#img"+currimg ).css({ fontWeight: "normal", color: "#666" }); if (currimg == 3 ) { nextimg = 1 }else{ nextimg=currimg+1 } console.log("nextimg "+nextimg); $( "#img"+nextimg ).css({ fontWeight: "bold", color: "#222" }); if (currimg==3){ currimg=1; }else{ currimg+=1; } if (currimg == 3 ) { nextimg = 1 }else{ nextimg=currimg+1 } $( "#slide"+currimg ).fadeIn("fast",function(){ $("#holderslider").css({ backgroundImage: "url(img/progetti/slider_"+nextimg+".jpg)" }); }) }); /* $("#slide1").fadeOut(1200); $("#img1").css({ fontWeight: "normal", color: "#666" }); $("#img2").css({ fontWeight: "bold", color: "#222" }); */ }, 6000); } function projectRequest(){ if (!getEl("projectSignup")){return} $("#cognome").focus(); // Righe alternate backgroundColor $("#tbregister tr").each( function(i, tr){ if (i % 2 == 0){ $(this).css({ backgroundColor: "#f7f7f7" }); }else{ } }); // Prendo l'immagine del captcha var res = ajaxJSON_ASYNC_ExecDB( {crea_captcha: "yes"} ); console.log("captcha creato "+res); var d=setTimeout(function(){ var ra=Math.floor(Math.random()*80000) $("#img_captcha") .show()[0].src=SITENAME + "/img/captcha/temp.jpg?"+ra; },1000); // Segno il progetto al quale interessato if ( getEl("global") ) { $("#tbregister tr")[0].cells[1].innerHTML = "Global Reviews"; } if ( getEl("taxicab42") ) { $("#tbregister tr")[0].cells[1].innerHTML = "TaxiCabForTwo"; } if ( getEl("eebattery") ) { $("#tbregister tr")[0].cells[1].innerHTML = "EEB Battery"; } $("#tbregister tr")[0].cells[1].style.fontWeight="bold"; $("#submit").click(function(){ // Controllo i campi if ( checkTxField("cognome","Manca il cognome.")==false ) {return} if ( checkTxField("nome","Manca il nome.")==false ) {return} if ( checkTxField("codice_fiscale","Manca il codice fiscale.", null, {checkCF:true, message2: "Codice Fiscale Errato." } )==false ) {return} if ( checkTxField("azienda_company","Manca l'azienda.")==false ) {return} if ( checkTxField("partita_iva","Manca la partita IVA.", null, {checkPIVA:true, message2: "Partita IVA Errata." } )==false ) {return} if ( checkTxField("indirizzo","Manca l'indirizzo.")==false ) {return} if ( checkTxField("cap_postal_code","Manca il cap.")==false ) {return} if ( checkTxField("city_citta","Manca la città")==false ) {return} if ( checkTxField("provincia","Manca la provincia")==false ) {return} if ( checkTxField("country_nazione","Manca la nazione")==false ) {return} if ( checkTxField("email","Manca la mail.")==false ) {return} if ( checkTxField("conferma","Manca la conferma mail.")==false ) {return} if ( checkTxField("richiesta","Manca la richiesta")==false ) {return} if ( checkCheckBox("accetta","Devi accettare i termini e la privacy")==false ) {return} /* if ( checkTxField("provincia","Manca la provincia")==false ) {return} if ( checkTxField("provincia","Manca la provincia")==false ) {return} var richiesta=$("#richiesta"); if (richiesta.val().length<30 ){ alert("Manca la richiesta di 30 caratteri min."); richiesta.focus(); return } var ck=$("#accetta"); if ( ck[0].checked==false ){ alert("Devi accettare i termini e la privacy."); ck.focus(); return } */ // Controllo il captcha var vCaptcha= $("#captchavalue").val().toUpperCase(); // Salvo il commento var tipo = isFormCollabora?"Collaborazione":"Contatto"; var param = "(['"+ escape( getEl("nome").value )+"','"+ escape( getEl("email").value )+"','"+ escape( getEl("richiesta").value )+"','"+ escape( getEl("telefono").value )+"','"+ tipo+"','"+ "'])"; console.log("param "+param); ajaxJSON_ASYNC_ExecDB( {n: 2, param: param, captcha: vCaptcha}, function(resp){ console.log("Invia "+unescape(resp)); q2=eval(resp); if ( q2.captcha=="Error"){ alert("Controllo antispam errato o mancante."); $("#captchavalue").focus(); return }else{ var dbresponse = q2.dbresponse; console.log("dbresponse.response "+dbresponse); if ( q2.qResponse == "not found" || dbresponse != 'ok' ) { $("#contatti").fadeOut("slow", function(){ $("#contatti_mail_error").show(); $("#tipodierrore").html( "Risposta del server: <br><br><span style='color:red'>"+ unescape(dbresponse)+ "</span>" ); }) }else{ console.log("resp "+resp); if (isFormCollabora==false){ document.body.scrollTop=0; } $("#contatti").fadeOut("slow", function(){ $("#contatti_mail_inviata").show(); if (isFormCollabora==true){ var e=setTimeout(function(){ window.location.hash = 'formcollabora'; }, 200); } }); } } }, function(hr,err){ console.log("err "+hr.responseText); } ); }); } function formPreventivi(){ if ( !getEl("planet_preventivi_conferma") ) {return} hideAllPrev(); // Prendo l'immagine del captcha var res = ajaxJSON_ASYNC_ExecDB( {crea_captcha: "yes"} ); console.log("captcha creato "+res); var d=setTimeout(function(){ var ra=Math.floor(Math.random()*80000) $("#img_captcha") .show()[0].src=SITENAME +"/img/captcha/temp.jpg?"+ra; },1000); var totalePreventivo=0; var nrLoop = 0; var tLoop =""; formPreventivi.ricalcola = ricalcola; formPreventivi.loopnumbers = loopnumbers; formPreventivi.azzera = azzera; formPreventivi.showform = showform; formPreventivi.tipo = "sito web"; $("input[type='checkbox']").each( function(i, ck){ $(ck).click( function(){ formPreventivi.loopnumbers(); }); }); $("input[type='radio']").each( function(i, ck){ $(ck).click( function(){ formPreventivi.loopnumbers(); }); }); function showform(obj){ console.log("showform "+obj.innerHTML); hideAllPrev(); var rt = getEl("tbpreventivi").rows[0].cells[0].getBoundingClientRect(); if( obj.innerHTML.toLowerCase()=="sito web" ){ formPreventivi.tipo = "sito web"; getEl("#planet_preventivi_siti").style.display="block"; $("h3").html( 'Preventivo per un sito web'); } if( obj.innerHTML.toLowerCase().indexOf("contabilità")>-1 ){ formPreventivi.tipo = "contabilità"; getEl("#planet_preventivi_budget").style.display="block"; //rt = getEl("tbpreventivi_budget").rows[0].cells[0].getBoundingClientRect(); $("h3").html( 'Preventivo per programma di contabilità Budget'); } if( obj.innerHTML.toLowerCase().indexOf("hosting")>-1 ){ formPreventivi.tipo = "hosting"; $(getEl("#planet_preventivi_hosting")).show(); //rt = getEl("tbpreventivi_hosting").rows[0].cells[0].getBoundingClientRect(); $("h3").html( 'Preventivo per web hosting'); } if( obj.innerHTML.toLowerCase().indexOf("seo")>-1 ){ formPreventivi.tipo = "seo"; $(getEl("#planet_preventivi_seo")).show(); //rt = getEl("tbpreventivi_seo").rows[0].cells[0].getBoundingClientRect(); $("h3").html( 'Preventivo per posizionamento Google'); } var v = setTimeout(function(){ window.location.hash="#preventivo"; },600); $("#planet_preventivi_intesta").show(); $("#planet_preventivi_conferma").show(); $("#tbpreventivifooter tr td:nth-child(1)").css({ width: rt.right-rt.left+"px" }); ricalcola(); } function ricalcola(){ totalePreventivo=0; console.log("formPreventivi.tipo "+formPreventivi.tipo); if ( formPreventivi.tipo == "sito web"){ /* Calcola sito web */ console.log("sitobase check "+$("#sitobase").is(':checked')); if($("#dominio").is(':checked') == true) totalePreventivo+=22; if($("#spazioweb").is(':checked') == true) totalePreventivo+=30; if($("#database").is(':checked') == true) totalePreventivo+=25; if($("#sitobase").is(':checked') == true) totalePreventivo+=260; if ($("#ecommerce").is(':checked') == true) { $("#virtuemart").attr("disabled",false); $("#shopcustom").attr("disabled",false); if ($("#virtuemart").is(':checked') == true) { totalePreventivo+=700; }else{ totalePreventivo+=1200; } }else{ $("#virtuemart").attr("disabled",true); $("#shopcustom").attr("disabled",true); } if ($("#grafica").is(':checked') == true) { $("#studiograficocustom").attr("disabled",false); $("#templatemonster").attr("disabled",false); if ($("#studiograficocustom").is(':checked') == true) { totalePreventivo+=260; }else{ totalePreventivo+=80; } }else{ $("#studiograficocustom").attr("disabled",true); $("#templatemonster").attr("disabled",true); } if($("#schedeprodotti").is(':checked') == true) totalePreventivo+=420; if($("#directory").is(':checked') == true) totalePreventivo+=680; if($("#blog").is(':checked') == true) totalePreventivo+=120; if($("#ssl").is(':checked') == true) totalePreventivo+=140; }else if ( formPreventivi.tipo == "contabilità" ) { /* Calcola Budget */ if($("#cont_base").is(':checked') == true) totalePreventivo+=1; if($("#cont_soc_unlimited").is(':checked') == true) totalePreventivo+=80; if($("#cont_multimaga").is(':checked') == true) totalePreventivo+=180; if($("#cont_ricevute").is(':checked') == true) totalePreventivo+=120; if($("#cont_anticipi").is(':checked') == true) totalePreventivo+=460; if($("#cont_lotti").is(':checked') == true) totalePreventivo+=380; if($("#cont_installazione_web").is(':checked') == true) totalePreventivo+=140; if($("#cont_installazione_onsite").is(':checked') == true) totalePreventivo+=380; if($("#cont_assistenza_primo_anno").is(':checked') == true) totalePreventivo+=220; if($("#cont_grafica_stampe_custom").is(':checked') == true) totalePreventivo+=180; }else if ( formPreventivi.tipo == "hosting" ) { /* Calcola hosting */ if($("#rinnovonic").is(':checked') == true) totalePreventivo+=20; if($("#spaziowebhosting").is(':checked') == true) totalePreventivo+=35; if($("#databasehosting").is(':checked') == true) totalePreventivo+=20; if($("#mailill").is(':checked') == true) totalePreventivo+=25; if($("#sslhosting").is(':checked') == true) totalePreventivo+=60; if($("#assistenzaweb").is(':checked') == true) totalePreventivo+=40; if($("#backupdb").is(':checked') == true) totalePreventivo+=12; if($("#backupsito").is(':checked') == true) totalePreventivo+=8; } $("#totalepreventivo").html( totalePreventivo+",00" ); if (totalePreventivo<0 ) totalePreventivo=0; if (totalePreventivo>0){ $("#floatright").animate({ height: "158px" }, 400, "swing", function(){ console.log("show btn"); $(".totaliButtons").show(); }); }else{ $("#floatright").animate({ height: "114px" }, 400, "swing", function(){ $(".totaliButtons").hide(); }); } return totalePreventivo; } function loopnumbers(){ tLoop = setInterval(function(){ nrLoop+=1; if (nrLoop == 5 ){ clearInterval(tLoop); tLoop = ""; nrLoop = 0; formPreventivi.ricalcola(); return; } var nx=Math.ceil( Math.random()*80 )+10; var nx2=Math.ceil( Math.random()*80 )+10; $("#totalepreventivo").html( nx+","+nx2 ); }, 50) } function azzera(){ $("#dominio").attr("checked",false); $("#spazioweb").attr("checked",false); $("#database").attr("checked",false); $("#sitobase").attr("checked",false); $("#ecommerce").attr("checked",false); $("#grafica").attr("checked",false); $("#schedeprodotti").attr("checked",false); $("#directory").attr("checked",false); $("#blog").attr("checked",false); $("#ssl").attr("checked",false); $("#rinnovonic").attr("checked",false); $("#spaziowebhosting").attr("checked",false); $("#databasehosting").attr("checked",false); $("#mailill").attr("checked",false); $("#sslhosting").attr("checked",false); $("#assistenzaweb").attr("checked",false); $("#backupdb").attr("checked",false); $("#backupsito").attr("checked",false); formPreventivi.ricalcola(); } /* submit */ $("#submit").click(function(){ if ( checkTxField("nome_name","Manca il nome.")==false ) {return} if ( checkTxField("azienda_company","Manca l'azienda.")==false ) {return} if ( checkTxField("email","Manca la mail o il formato è errato.", null, { checkMail: true })==false ) {return} if ( checkTxField("confemail","Manca la conferma mail o il formato è errato..", null, { checkMail: true, objCompareValue: $("#email"), compareValueMessage: "Le mail non combaciano" })==false ) {return} if ( checkTxField("address_indirizzo","Manca l'indirizzo.")==false ) {return} if ( checkTxField("cap_citta_city","Manca la città.")==false ) {return} if ( checkTxField("richiesta","Manca la richiesta di 30 caratteri min.")==false ) {return} if ( checkCheckBox("accetta","Devi accettare i termini e la privacy")==false ) {return} if ( formPreventivi.ricalcola() == 0 ){ alert("Devi scegliere una delle funzionalità."); return; } // Controllo il captcha var vCaptcha= $("#captchavalue").val().toUpperCase(); // Salvo il preventivo var caratteristiche = getCaratteristiche(); var tipo = formPreventivi.tipo; var page = "Preventivi-online.asp"; var param = "(['"+ escape( getEl("nome_name").value )+"','"+ escape( getEl("azienda_company").value )+"','"+ escape( getEl("email").value )+"','"+ escape( getEl("address_indirizzo").value )+"','"+ escape( getEl("cap_citta_city").value )+"','"+ escape( getEl("telefono_tel").value )+"','"+ escape( caratteristiche )+"','"+ escape( getEl("richiesta").value )+"','"+ tipo+"','"+ page+ "'])"; console.log("param "+param); ajaxJSON_ASYNC_ExecDB( {n: 3, param: param, captcha: vCaptcha}, function(resp){ console.log("Invia "+unescape(resp)); q2=eval(resp); if ( q2.captcha=="Error"){ alert("Controllo antispam errato o mancante."); $("#captchavalue").focus(); return }else{ var dbresponse = q2.dbresponse; console.log("dbresponse.response "+dbresponse); if ( q2.qResponse == "not found" || dbresponse != 'ok' ) { hideAllPrev(); $("#contatti_mail_error").show(); $("#tipodierrore").html( "Risposta del server: <br><br><span style='color:red'>"+ unescape(dbresponse)+ "</span>" ); }else{ console.log("resp "+resp); hideAllPrev(); getEl("#planet_preventivo_inviato").style.display="block"; var v = setTimeout(function(){ window.location.hash="#prevsend"; },600); } } }, function(hr,err){ console.log("err "+hr.responseText); } ); }); function getCaratteristiche(){ var car=""; switch( formPreventivi.tipo ){ default: case "sito web": car = "{" + "aperturasito:" + getEl("dominio").checked.toString()+","+ "spazioweb:" + getEl("spazioweb").checked.toString()+","+ "database:" + getEl("database").checked.toString()+","+ "Sitobase:" + getEl("sitobase").checked.toString()+","+ "ecommerce:" + getEl("ecommerce").checked.toString()+","+ "virtuemart:" + getEl("virtuemart").checked.toString()+","+ "shopcustom:" + getEl("shopcustom").checked.toString()+","+ "grafica:" + getEl("grafica").checked.toString()+","+ "studiograficocustom:" + getEl("studiograficocustom").checked.toString()+","+ "templatemonster:" + getEl("templatemonster").checked.toString()+","+ "schedeprodotti:" + getEl("schedeprodotti").checked.toString()+","+ "directory:" + getEl("directory").checked.toString()+","+ "blog:" + getEl("blog").checked.toString()+","+ "ssl:" + getEl("ssl").checked.toString()+","+ // CMS "cmsnone:" + getEl("cmsnone").checked.toString()+","+ "cmsjoomla:" + getEl("cmsjoomla").checked.toString()+","+ "cmswordpress:" + getEl("cmswordpress").checked.toString()+","+ "cmscustom:" + getEl("cmscustom").checked.toString()+ "}"; break; case "contabilità": car = "{" + "cont_base:" + getEl("cont_base").checked.toString()+","+ "cont_soc_unlimited:" + getEl("cont_soc_unlimited").checked.toString()+","+ "cont_multimaga:" + getEl("cont_multimaga").checked.toString()+","+ "cont_ricevute:" + getEl("cont_ricevute").checked.toString()+","+ "cont_anticipi:" + getEl("cont_anticipi").checked.toString()+","+ "cont_lotti:" + getEl("cont_lotti").checked.toString()+","+ "cont_installazione_user:" + getEl("cont_installazione_user").checked.toString()+","+ "cont_installazione_web:" + getEl("cont_installazione_web").checked.toString()+","+ "cont_installazione_onsite:" + getEl("cont_installazione_onsite").checked.toString()+","+ "cont_assistenza_primo_anno:" + getEl("cont_assistenza_primo_anno").checked.toString()+","+ "cont_grafica_stampe_custom:" + getEl("cont_grafica_stampe_custom").checked.toString()+ "}"; break; case "hosting": car = "{" + "rinnovonic:" + getEl("rinnovonic").checked.toString()+","+ "spaziowebhosting:" + getEl("spaziowebhosting").checked.toString()+","+ "databasehosting:" + getEl("databasehosting").checked.toString()+","+ "mailill:" + getEl("mailill").checked.toString()+","+ "sslhosting:" + getEl("sslhosting").checked.toString()+","+ "assistenzaweb:" + getEl("assistenzaweb").checked.toString()+","+ "backupdb:" + getEl("backupdb").checked.toString()+","+ "backupsito:" + getEl("backupsito").checked.toString()+ "}"; break; } return car; } function hideAllPrev(){ getEl("#planet_preventivi_siti").style.display="none"; getEl("#planet_preventivi_budget").style.display="none"; //getEl("#planet_preventivi_siti").style.display="none"; getEl("#planet_preventivi_hosting").style.display="none"; getEl("#planet_preventivi_seo").style.display="none"; getEl("#planet_preventivo_inviato").style.display="none"; getEl("planet_preventivi_conferma").style.display="none"; getEl("planet_preventivi_intesta").style.display="none"; } } function adjustForm(){ return console.log("ck nr "+$("input[type='checkbox']").length); $("input[type='checkbox']").each( function(i, ck){ var next = $(ck).next(); if (next[0]){ console.log("next "+next[0]); } }); } function floatRight(){ if ( !getEl("floatright") ) {return} //console.log("float right"); floatRight.fosusform = fosusform; floatRight.resizeFloatRight = resizeFloatRight; floatRight.showFloatRight = showFloatRight; //this.resize(); showFloatRight(); $(window).resize( function(){ floatRight.resizeFloatRight() }).scroll( function() { floatRight.showFloatRight(); }) function resizeFloatRight(){ var lf = $(document).width() - $("#floatright").width(); //console.log("float right left "+lf); $("#floatright").css({ left: $(document).width() - $("#floatright").width() - 10 +'px' }); } function showFloatRight(){ console.log("show float right"); if ( document.body.scrollTop>600 ){ console.log("flostr vis "+$("#floatright").is(":visible")); if ($("#floatright").is(":visible") == false){ floatRight.resizeFloatRight(); $("#floatright") .css({ left: $(document).width()+10+'px' }) .show() .animate( { left: $(document).width() - $("#floatright").width() - 10 +'px'}, 400 ); } //$("#floatright").show(); }else{ $("#floatright").hide(); } } function fosusform(){ $("#nome").focus(); } } /* Gestione form contatti / richiesta collaborazione */ function contattaci(){ if(!getEl("tbcontatti")){return} /* var isFormCollabora = false; if ( $("h2")[0].innerHTML.indexOf( "Collaborazioni" )>-1 ){ isFormCollabora = true; } */ //console.log("is form collaborazione "+isFormCollabora); // Fuoco sul primo tx var d=setTimeout(function(){ $("#nome").focus(); },600); // Righe alternate backgroundColor + placeholder immagine OK (visto) $("#contatti tr").each( function(i, tr){ if (i % 2 == 0){ $(this).css({ backgroundColor: "#f7f7f7" }); }else{ } $(this).find("img").css({ display: 'none' }); }); // Faccio il controllo del LostFocus var param = [ "nome","nome troppo corto.",4, false, null, "", "email", "Mail formato errato", 4, true, null, "", "confemail", "Mail formato errato", 4, true, $("#email") , "Le mail non combaciano.", "richiesta", "Campo richiesta vuoto", 1, false, null, "" ]; var row=1; for ( var i=0; i<param.length; i+=6){ //console.log("idx "+param[i]+", img "+$("#"+param[i]).parent().next() checkTxField( param[i], null, null, { message: param[i+1], objMessage: $("#"+param[i]).parent().find("div"), minLenght: param[i+2], checkMail: param[i+3], checkLostFocus: true, objImgToCheck: $("#"+param[i]).parent().next().find("img"), srcCheckOk: "img/check/check.png", srcCheckFail: "img/check/icon_uncheck.gif", srcCheckAlert: "img/check/icon_uncheck.gif", objCompareValue: param[i+4], compareValueMessage:param[i+5], messagesClass: "messageWrong" }); row+=1; } // Prendo l'immagine del captcha var res = ajaxJSON_ASYNC_ExecDB( {crea_captcha: "yes"}, function(resp){ //console.log("captcha creato "+resp); }, function(hr,err){ //console.log("err "+hr); } ); var d=setTimeout(function(){ var ra=Math.floor(Math.random()*80000) $("#img_captcha") .show()[0].src=SITENAME+"/"+CARTELLATEST+"/images/captcha/temp.jpg?"+ra; },1000); $("#submit").click(function(){ // Controllo i campi var nome=$("#nome"); if (nome.val().length<1 ){ alert("Manca il nome."); nome.focus(); return } var mail=$("#email"); if (mail.val().length<1 || checkEmail_format(mail.val())==false ){ alert("Manca la mail o il formato è errato."); mail.focus(); return } var cmail=$("#confemail"); if (cmail.val().length<1 || checkEmail_format(cmail.val())==false ){ alert("Manca la conferma mail o il formato è errato."); cmail.focus(); return } if ( cmail.val() != mail.val() ){ alert("Le mail non combaciano."); mail.focus(); return } var richiesta=$("#richiesta"); if (richiesta.val().length<30 ){ alert("Manca la richiesta di 30 caratteri min."); richiesta.focus(); return } var ck=$("#accetta"); if ( ck[0].checked==false ){ alert("Devi accettare i termini e la privacy."); ck.focus(); return } // Controllo il captcha var vCaptcha= $("#captchavalue").val().toUpperCase(); // Salvo il commento //var tipo = isFormCollabora?"Collaborazione":"Contatto"; var param = "['"+ escape( getEl("nome").value )+"','"+ escape( getEl("email").value )+"','"+ escape( getEl("richiesta").value )+"','"+ escape( getEl("telefono").value )+"','"+ "Contatto','"+ escape( getPreferiti() )+ "']"; console.info("param ",param); function getPreferiti(){ var pref=""; // Attenzione: qui vanno solo le virgolette così // se no bisogna fare l'escape delle virgolette $('img[src*="images/upload/small"]').each( function(n, img){ var names = img.src.split("/"); pref += '<img src="'+img.src+'" width="260" height="180" style="display: block;" />'; pref += '<a href="'+img.src+'" >'+names[ names.length-1 ]+'</a><br />'; pref += 'Titolo: '+$( this ).parent().find(".title1").html()+'<br />'; pref += 'Descrizione: '+$( this ).parent().find(".title2").html()+'<br /><br />'; }); return pref; } ajaxJSON_ASYNC_ExecDB( {n: 2, param: param, captcha: vCaptcha}, function(resp){ console.log("Invia "+unescape(resp)); q2=eval(resp); if ( q2.captcha=="Error"){ alert("Controllo antispam errato o mancante."); $("#captchavalue").focus(); return }else{ var dbresponse = q2.dbresponse; //console.log("dbresponse.response "+dbresponse); if ( q2.qResponse == "not found" || dbresponse != 'ok' ) { $("#contatti").fadeOut("slow", function(){ $("#contatti_mail_error").show(); $("#tipodierrore").html( "Risposta del server: <br><br><span style='color:red'>"+ unescape(dbresponse)+ "</span>" ); }) }else{ //console.log("resp "+resp); $("#content").fadeOut("slow", function(){ $("#contatti_mail_inviata").show(); window.scroll(0,0); /* if (isFormCollabora==true){ var e=setTimeout(function(){ window.location.hash = 'formcollabora'; }, 200); } */ }); } } }, function(hr,err){ console.log("err "+hr.responseText); } ); }); } /* Gestione commenti degli articoli */ function articlesComments(){ if(!getEl("commenti")){return} // Fuoco rimuovo la scritta $("#commenti").focus(function(){ console.log("focus comm"); //this.value=""; }).focusout(function(){ console.log("focus comm out"); if (this.value==""){ //this.value="Scrivi qui il commento" } }); // Prendo l'immagine del captcha var res = ajaxJSON_ASYNC_ExecDB( {crea_captcha: "yes"} ); console.log("captcha creato "+res); var d=setTimeout(function(){ var ra=Math.floor(Math.random()*80000) $("#img_captcha") .show()[0].src=SITENAME+"/img/captcha/temp.jpg?"+ra; },1000); // Invio del commento $("#sendcomment").click(function(){ // Controllo i campi var nome=$("#nome"); if (nome.val().length<1 ){ alert("Manca il nome."); nome.focus(); return } var mail=$("#email"); if (mail.val().length<1 || checkEmail_format(mail.val())==false ){ alert("Manca la mail o il formato è errato."); mail.focus(); return } var commenti=$("#commenti"); if (commenti.val().length<30 ){ alert("Manca il commento."); commenti.focus(); return } // Controllo il captcha var vCaptcha= $("#captchavalue").val().toUpperCase(); // Salvo il commento var param = "(['"+ getEl("nome").value+"','"+ escape( getEl("email").value )+"','"+ escape( getEl("commenti").value )+"','"+ PAGE.replace("\/","")+ "'])"; console.log("param "+param); ajaxJSON_ASYNC_ExecDB( {n: 1, param: param, captcha: vCaptcha}, function(resp){ console.log("Invia "+unescape(resp)); q2=eval(resp); if ( q2.captcha=="Error"){ alert("Controllo antispam errato o mancante."); $("#captchavalue").focus(); return }else{ if ( q2.dbresponse != "ok" ){ $("#insertcommento").fadeOut("slow", function(){ $("#nomeusercomm").hide(); $("#commentoinviato") .html( "<br><br>"+ "Si è verificato un errore in fase di memorizzazione. "+ "<br>Riprova più tardi") .fadeIn("slow"); }) }else{ console.log("resp "+resp); $("#insertcommento").fadeOut("slow", function(){ var htmlcomm = $("#commenti_mail_inviata")[0].innerHTML; $("#commenti_mail_inviata")[0].innerHTML=htmlcomm.replace(/\[nome\]/ig,$("#nome").val()); $("#commenti_mail_inviata") .fadeIn("slow"); }) } } }, function(hr,err){ } ); }); } /* Sistemo il width del footer */ function adjustHeadFooter(){ return //console.log("setFooter "+PAGE); if ( PAGE == "/" || PAGE.indexOf("default")>-1 ){ $(".footer").css({ width: "980px" }); $("#header").css({ width: "980px", left: '-6px' }); console.log("adjustHeadFooter default"); }else{ $(".footer").css({ width: "100%" }); console.log("setFooter"); } } /* Viene colorata la linea dell'header in funzione della pagina PER ORA RIMOSSO! */ function rowColourPage(){ return; if ( PAGE == "/" || PAGE.indexOf("default")>-1 ){ $("#linex").hide(); } //if(!$(".head_altrepag")[0]){return} // Prendo le prime 3 lettere var sumasc=1; for (var i=0; i<PATH.length-1; i++){ sumasc = sumasc * PATH.charCodeAt(i) } var rimane = sumasc.toString(16).substr(0,6); $("#linex")[0].style.borderBottom="solid 2px #"+rimane; console.log("rimane "+rimane) return var vasc = PATH.substr(0,3); var path2= PATH.toUpperCase(); var xcol = path2.charCodeAt(1).toString(16) + path2.charCodeAt(2).toString(16) + path2.charCodeAt(3).toString(16) console.log("colx "+xcol) $("#linex")[0].style.borderBottom="solid 2px #"+xcol; return if(!$("#linex")[0]){return} console.log("color line "+PATH); var col = "gray" if (PATH.indexOf("contabili")>-1){ col="blue"; } else if( PATH.indexOf("servizi")>-1){ col="orange" } if ( PATH=="/" ) { }else{ $("#linex")[0].style.borderBottom="solid 2px "+col; } } /* Invia commento pop a destra */ function sendComment(){ this.pappa = 4; this.resizecomm = resizecomm(); var t=setTimeout(function(){ /* $("#comment") .fadeIn("slow") */ },3000); function resizecomm(){ var w = $(window).width(); var w2 = $(document).width(); var h = $(window).height(); var h2 = $(document).height(); //console.log("w2 "+w2) //var h = document.body.scrollHeight; var t = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; // tutto questo per IE merda! } } /* BackTo Top in basso a destra */ function setBackToTop(){ setBackToTop.resize = resize; setBackToTop.showme = showme; showme(); resize(); $(window).resize( function(){ //console.log("resize") setBackToTop.resize() }).scroll( function() { setBackToTop.showme() }) $("#backToTop").click(function(){ document.documentElement.scrollTop=0; document.body.scrollTop=0; }) function resize(){ var w = $(window).width(); var w2 = $(document).width(); var h = $(window).height(); var h2 = $(document).height(); //console.log("w2 "+w2) //var h = document.body.scrollHeight; var t = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; // tutto questo per IE merda! //console.log("backto top "+h+", t "+t); //console.log("document.body.scrollTop "+document.body.scrollTop) //console.log("backtotop w "+w+", ht "+(h+t-38).toString() ); $("#backToTop").css({ left: (w-108)+'px', top: (h-38)+'px' }); } function showme(){ var t = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; // tutto questo per IE merda! var h =window.innerHeight //$(document).height(); //console.log("t "+t+", h "+h); if (t>0) { $("#backToTop").show(); }else{ $("#backToTop").hide(); } } } /* social bar */ function setSocialBar(){ // Frame di Facebook /* fb_source = 'http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.planetline.it&width=67&height=80&colorscheme=light&layout=box_count&action=like&show_faces=false&send=true" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:67px; height:80px'; var i = document.getElementById("framefacebook"); i.src = "path/to/file"; i.scrolling = "auto"; i.frameborder = "0"; i.width = "200px"; i.height = "100px"; document.getElementById("div-that-holds-the-iframe").appendChild(i); */ setSocialBar.resizeBar = resizeBar; resizeBar(); $(window).resize( function(){ //console.log("resize") setSocialBar.resizeBar() }).scroll( function() { //setSocialBar.resizeBar() }) // Social bar2 //console.log("document.getElementById('slider') "+document.getElementById("slider") ); if ( document.getElementById("slider") == null ) { $("#social2")[0].style.visibility="visible"; $("#social2").css({ left: ($("#header").offset().left+$("#header").width()-$("#social2").width()-22)+"px", top: ($("h2").offset().top+22)+"px", // ($("#header").offset().top+18 )+"px", display: 'block' }).show(); } //console.log("$(document.body).width(); "+ $(document.body).width() ) if ( $(document.body).width()<1300 ){ $("#social")[0].style.visibility="hidden"; $("#social").hide(); $("#plusone").hide(); return; } $("#social").css({left: "10px", visibility: "visible"}).show(); function resizeBar(){ //console.log("$(document.body).width() qui "+$(document.body).width()); if ( parseInt( $(document.body).width() )>1300 ){ $("#social").css({left: "10px", visibility:"visible"}).show(); var w = $(window).width(); //console.log("wxx "+document.clientWidth) var w2 = $(document.body).width(); w= w2/2 - $("#header").width()/2- 26; //console.log("w "+w) var h = document.body.scrollHeight; var t = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; // tutto questo per IE merda! //console.log("w "+w+", t "+t); var pLeftBar = w - 108; pLeftBar = 10; var pTopBar = t + 126; //console.log("pTopBar "+pTopBar); $("#social").css({ left: pLeftBar + 'px', //top: pTopBar + 'px'//, //zIndex: 20 }).show(); // resize della barra per i commenti var pLeftBar = w - 48; var pTopBar = t + 300; }else{ $("#social").hide(); } if ( document.getElementById("slider") == null ) { try{ $("#social2").css({ left: ($("#header").offset().left+$("#header").width()-$("#social2").width()-22)+"px", top: ($("h2").offset().top+22)+"px", // ($("#header").offset().top+18 )+"px", }); }catch(e){} } //console.log("t "+t); /* $("#comment").css({ left: pLeftBar + 'px', top: pTopBar + 'px', zIndex: 20 }); */ } } /* nascondi indice (tipo wikipedia) delle pagine */ function hideShowIndexPage(){ //console.log("click hide "); if ( getEl("hideindex") ){ $("#hideindex").click(function(){ console.log("click hide "+$("#indice").css("display")); /* if ( $("#indice").css("display") == "block"|| $("#indice").css("display") == "table" ) { */ if ( $(this).html().toLowerCase()=="nascondi"){ $("#indice").hide(); $(this).html("mostra"); }else{ $("#indice").show(); $(this).html("nascondi"); console.log("show index "); } }); // nasconde l'indice in automatico dopo 3 secondi /* var d=setTimeout( function(){ $("#indice").fadeOut("slow", function(){ $(this).hide(); }); }, 3000); */ $("#hideindex").html( "Nascondi" ); } } /* paypal */ function doPayPal(){ if ( PATH.indexOf("buy_online")==-1 ) {return;} var t=setTimeout(function(){ $("#email").focus(); },1000); // Il lost focus del campo mail va a prendere il record se c'e' $("#email").focusout( function(){ var re=ajaxJSON_SYNC({query:"select * from users where mail='"+this.value+"'"}); if ( eval(re).length>0 ){ var rec=eval(re)[0]; $("#confermamail").val( $("#email").val() ); $("#telefono").val( rec.telefono ); $("#nome").val( unescape( rec.nome ) ); }else{ $("#confermamail").val( "" ); $("#telefono").val( "" ); $("#nome").val( "" ); } }); var frame_moped = new frame({ title: '<i>Acquista Ariella Moped</i>', container: "#buy_moped", left: '0px', top: '0px', width: '890px', height: '290px' }); frame_moped.objtitle.css({ color: "#9B282D", backgroundColor: $("#main-sheet").css("backgroundColor") }); frame_moped.obj.css({ position: 'relative', padding: '22px' }); frame_moped.frame.css({ padding: '22px', width: '883px'}); $( $("#tb_moped") ).appendTo( frame_moped.frame ); //$( $("#foto_ariella_moped") ).appendTo( frame_sport.frame ); var frame_sport = new frame({ title: '<i>Acquista Ariella Sport</i>', container: "#buy_sport", left: '0px', top: '0px', width: '890px', height: '330px' }); frame_sport.objtitle.css({ color: "#9B282D", backgroundColor: $("#main-sheet").css("backgroundColor") }); frame_sport.obj.css({ position: 'relative', padding: '22px' }); frame_sport.frame.css({ padding: '22px', width: '883px'}); $( $("#tb_sport") ).appendTo( frame_sport.frame ); $("#annulla_paypal").click(function(){ window.open( "default.asp","_self" ); }); /* $("#form_paypal_moped")[0].onsubmit = function(){ console.log("submit"); return false; } */ // id dell'user /* // metto i prezzi in base al DB var q="select * from prodotti where id=1"; var re = eval( ajaxJSON_SYNC({ query: q }) ); var record,pv,pt,ptf,pvf; if (re.length>0){ console.log("rel "+re.length); record= re[0]; console.log( "pvendita "+record["prezzo vendita"] ); pv = parseFloat( re[0]["prezzo vendita"] ); pt = parseFloat( re[0]["prezzo trasporto"] ); pvf = $.formatNumber( re[0]["prezzo vendita"], 2); ptf = $.formatNumber( re[0]["prezzo trasporto"], 2); $("#prezzomoped").html( "Euro "+pvf ); $("#prezzotraspmoped").html( "Euro "+ptf ); $("#disponibili_moped").html( record.giacenza ); $("#consegna_moped").html( unescape( record.consegna ) ); $("#form_paypal_moped")[0].amount.value = (pv + pt).toFixed(2); console.log("amount "+$("#form_paypal_moped")[0].amount.value); } q="select * from prodotti where id=2"; re = eval( ajaxJSON_SYNC({ query: q }) ); if (re.length>0){ console.log("rel "+re.length); record= re[0]; console.log( "pvendita "+record["prezzo vendita"] ); pv = parseFloat( re[0]["prezzo vendita"] ); pt = parseFloat( re[0]["prezzo trasporto"] ); pvf = $.formatNumber( re[0]["prezzo vendita"], 2); ptf = $.formatNumber( re[0]["prezzo trasporto"], 2); $("#prezzosport").html( "Euro "+pvf ); $("#prezzotraspsport").html( "Euro "+ptf ); $("#disponibili_sport").html( record.giacenza ); $("#consegna_sport").html( unescape( record.consegna ) ); $("#form_paypal_sport")[0].amount.value = (pv + pt).toFixed(2); console.log("amount "+$("#form_paypal_sport")[0].amount.value); } */ function checkSubmit(){ if ( $("#email").val().length < 4 ){ alert("Manca la mail"); $("#email").focus(); return false; } if ( checkEmail_format($("#email").val())==false ){ alert("Il formato della mail è errato"); $("#email").focus(); return false; } if ( $("#confermamail").val().length < 4 ){ alert("Manca la conferma della mail"); $("#confermamail").focus(); return false; } if ( $("#email").val() != $("#confermamail").val() ){ alert("Le mail non combaciano"); $("#email").focus(); return false; } if ( $("#nome").val().length < 4 ){ alert("Manca il nome"); $("#nome").focus(); return false; } if ( $("#telefono").val().length < 4 ){ alert("Manca il telefono"); $("#telefono").focus(); return false; } if ( $("#accetto").prop("checked") == false ){ alert("Manca l'accettazione della privacy"); return false; } return true; } doPayPal.checkSubmit = checkSubmit; function submitmoped(){ console.log("submit moped"); var validate = doPayPal.checkSubmit(); if (validate == true ) { validate = saveUser() }; return validate } function submitsport(){ console.log("submit moped"); var validate = doPayPal.checkSubmit(); if (validate == true ) { validate = saveUser() }; return validate } doPayPal.submitmoped = submitmoped; doPayPal.submitsport = submitsport; // Viene salvato l'user function saveUser(){ try{ // controllo prima se nn è già inserito var q="select * from users where mail='"+$("#email").val()+"'"; var re = ajaxJSON_SYNC({query:q}); console.log("resp "+re); if ( eval(re).length==0 ) { // memorizzo var q="INSERT INTO users "+ "( nome,mail,data_registrazione,telefono,tipo,note ) "+ "VALUES "+ "("+ "'"+$("#nome").val()+"',"+ "'"+$("#email").val()+"',"+ "NOW(),"+ "'"+$("#telefono").val()+"',"+ "'user',"+ "'"+$("#note").val()+"'"+ ")" console.log("q memo "+q) var re = ajaxJSON_SYNC({query:q}); console.log("resp memo "+re); var iduser = eval(re).id; }else{ var iduser = eval(re)[0].id; } // Aggiorno il camnpo dell'ID user console.log("iduser "+iduser); $("#paypal_userid").val( iduser ); // campo custom di paypal; return true }catch(e){ return false } } } /* Ricevuta dopo paypal */ function ricevutaPaypal(){ if ( PATH.indexOf("ricevuta")==-1 ) {return;} var tx=window.location.queryString.tx; // tx = token di ritorno var amt=window.location.queryString.amt; // amt amount prezzo var st=window.location.queryString.st; // status deve essere completed var cc=window.location.queryString.cc; // cc == valuta var custom=window.location.queryString.custom; // custom == dati custom che vengono mandati var idUser,mailUser,userName,mailUser,subject,tel,note; // prendo la mail e gli altri campi dell'user getUserFields(); // mando la mail all'user sendMailUser(); // mando la mail all'admin sendMailAdmin(); function getUserFields(){ // l'id dell'user lo trovo nel campo custom // di ritorno da paypal idUser = unescape( $("#custom").html() ); console.log("iduser "+idUser); var q = "select * from users where id="+idUser; var re = ajaxJSON_SYNC({query:q}); console.log("resp "+re); if ( eval(re).length==0 ) { // Errore non è stato trovato l'ID dell'user return } var rec = eval(re)[0]; mailUser = rec.mail; userName = rec.nome; tel = rec.telefono; note =rec.note; console.log("mail user "+mailUser); } // Mando la mail all'user function sendMailUser(){ subject = "Ricevuta pagamento e acquisto pedelectric.it"; $("#ricevuta_mail_to_user").html( $("#ricevuta_mail_to_user").html().replace(/\[user\]/ig,userName)); var htmlbody = $("#ricevuta_mail_to_user").show().html(); $("#ricevuta_mail_to_user").hide(); send_mail( mailUser,subject,htmlbody,"","", function(){ // callbackOK }, function(){ // callbackError }, "send_mail_ex.asp" ); } // Mando la mail all'admin function sendMailAdmin(){ subject = "Pagamento e acquisto pedelectric.it"; $("#ricevuta_mail_admin_nome").html( userName ); $("#ricevuta_mail_admin_mail").html( mailUser ); $("#ricevuta_mail_admin_telefono").html( tel ); $("#ricevuta_mail_admin_note").html( note ); $("#ricevuta_mail_admin_importo").html( amt + " Euro" ); $("#ricevuta_mail_admin_tx").html( tx ); var htmlbody = $("#ricevuta_mail_to_admin").show().html(); $("#ricevuta_mail_to_admin").hide(); send_mail( MAIL_ADMINS,subject,htmlbody,"","", function(){ // callbackOK }, function(){ // callbackError }, "send_mail_ex.asp" ); } } // Fine ricevuta /* Fancy Box All Images */ function fancyBoxAllImages(){ var pgx = window.location.href; var page = pgx.substr( pgx.lastIndexOf("/")+1 ).replace(/.asp/,""); var i = setTimeout(function(){ $("img").each( function( n, img ){ var displayIt = true; try{ var p; for ( p=0; p<7; p++){ displayIt = ( $(this).parents()[p].style.display=='none')?false:true; if (displayIt===false){ break; } } }catch(e){ } if ( $(img).width() < 120 ) { displayIt = false; } if ( displayIt === true && this.src.indexOf('foto_aerea')==-1 ) { //console.log("img width "+img.width) var srcx; if ( PAGE.indexOf("foto.asp")>-1 || PAGE.indexOf("foto_ingombro.asp")>-1 ){ var ptLast = this.src.lastIndexOf("/")+1; srcx = this.src.substr(0, ptLast) + "big/"+ this.src.substr(ptLast) ; console.log("new foto big "+srcx); this.style.borderRadius = "4px"; this.style.borderColor="#bbb"; }else{ srcx = this.src; } var titx; if ( PATH.indexOf("foto")>-1 || PATH.indexOf("sostituzione_gomma")>-1 ){ titx = decodeURI( $(this).next().html() ).replace(/<br\/>/ig, ""); //titx = titx.replace(/ /,"") titx = titx.replace(/<br \/>/,""); titx = titx.replace(/<br>/,""); titx = titx.replace(/'/,"`"); console.log("tit "+titx); /* if ( titx.indexOf(">")>-1 || titx.length>60 ){ titx = "Foto" } */ }else{ titx="Foto"; } $(this).wrap( "<a class='fancybox' href='"+ srcx + "' title='"+titx+"' />" ); } }); $("a.fancybox").attr('rel', 'gallery').fancybox(); var d = setTimeout( function(){ $(".fancybox").fancybox({ openEffect : 'elastic', openSpeed : 150, closeEffect : 'elastic', closeSpeed : 150, closeClick : true, helpers : { media : {}, buttons : {} } }); }, 600); }, 2000); } /* share buttons submit */ function submit_fb(){ var url = "https://www.facebook.com/login.php?skip_api_login=1&display=popup&social_plugin=like&next=http%3A%2F%2Fwww.facebook.com%2Fdialog%2Fplugin.optin%3F_path%3Dplugin.optin%26app_id%3D127760087237610%26client_id%3D127760087237610%26display%3Dpopup%26secure%3Dfalse%26social_plugin%3Dlike%26return_params%3D%257B%2522api_key%2522%253A%2522%2522%252C%2522locale%2522%253A%2522it_IT%2522%252C%2522sdk%2522%253A%2522joey%2522%252C%2522channel_url%2522%253A%2522http%253A%252F%252Fstatic.ak.facebook.com%252Fconnect%252Fxd_arbiter.php%253Fversion%253D18%2523cb%253Df105bafeec%2526origin%253Dhttp%25253A%25252F%25252Fwww.pedelectric.it%25252Ff382b4573c%2526domain%253Dwww.pedelectric.it%2526relation%253Dparent.parent%2522%252C%2522href%2522%253A%2522http%253A%252F%252Fwww.pedelectric.it%2522%252C%2522node_type%2522%253A%2522link%2522%252C%2522width%2522%253A%2522450%2522%252C%2522layout%2522%253A%2522standard%2522%252C%2522colorscheme%2522%253A%2522light%2522%252C%2522show_faces%2522%253A%2522true%2522%252C%2522send%2522%253A%2522true%2522%252C%2522extended_social_context%2522%253A%2522false%2522%252C%2522ret%2522%253A%2522optin%2522%252C%2522act%2522%253A%2522connect%2522%257D%26login_params%3D%257B%257D%26from_login%3D1&rcount=1"; window.open( url, null, "height=580,width=635,toolbar=no,left=300,top=300" ); } function submit_tweet(){ var url = "https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.pedelectric.it%2Fdefault.asp&text=Dosatori%20PMR&tw_p=tweetbutton&url=http%3A%2F%2Fwww.pedelectric.it%2Fdefault.asp&via=hello_rox"; window.open( url, null, "height=580,width=800,toolbar=no,left=300,top=300" ); } function submit_one(){ var url = "https://accounts.google.com/ServiceLogin?service=oz&continue=https://plusone.google.com/%2B1/profile/?type%3Dpo%26client%3D1%26gpsrc%3Dwidget%26parent%3Dhttps://plusone.google.com%26proxy%3DI2_1361976892587%26rsz%3D1%26hl%3Dit%26gpsrc%3Dwidget&hl=it#935737988"; window.open( url, null, "height=580,width=900,toolbar=no,left=300,top=300" ); } // Animazione dell'apertura var TM_ANIMAZIONE=""; var ANIMAZIONE_CUR_IMG=0; var ANIMAZIONE_NIMAGES = 11; var ANIMAZIONE_TIMER = 200; var ANIMAZIONE_INIT_LOOP_FIRST_IMAGE = 20; var ANIMAZIONE_INIT_LOOP_FIRST_IMAGE_COUNTER = 0; var ANIMAZIONE_COLOR_SEL_TOOLBAR = "#BF3111"; var ANIMAZIONE_TIMER_OPEN = ""; var ANIMAZIONE_SEC_APERTURA; function doAnimateOpen(){ console.log("path "+PATH+", pg "+PAGE); if ( PATH == "/" || PATH.indexOf("default")>-1 ) { // creo il timer in alto a sinistra var timerx = "<div id='timerapertura' />"; $("#apertura").html( '' ); var lf = $("#apertura").offset().left+ 8; var tp = $("#apertura").offset().top + 28; console.log("lf "+lf); $( timerx ).appendTo( 'body' ).css({ position: 'absolute', border: 'solid 0px gray', left: lf+'px', top: tp+'px', display: 'none', color: 'red' }).html( '1 sec' ); // prendo le immagini for (i=0; i<ANIMAZIONE_NIMAGES; i++){ var ix = "<img id='imanima-"+i+"' src='img/animazione_apertura/p"+(i+1).toString()+ ".png' />"; var b = (i===0)?'solid 1px red':'solid 1px #bbb'; $(ix).appendTo( $("#apertura")[0] ).css({ width: '200px', height: '150px', padding: '4px 4px 8px 4px', //border: '1px solid rgb(187,187,187)', margin: '24px 0 0 0', display: 'none', border: 'solid 1px #bbb' }); } // pulsantiera sotto var toolbar= "<table border='0' "+ "style='cursor:pointer; width:210px; border:solid 1px #bbb'><tr>"+ "<td id='anima_close'>Chiudi</td>"+ "<td id='anima_apri'>Apri</td>"+ "<td id='anima_start'>Start</td>"+ "</table>"; $(toolbar).appendTo("#apertura"); // timer TM_ANIMAZIONE = setInterval( function(){ changePhoto(); },ANIMAZIONE_TIMER); $("#anima_close").css({ textAlign: 'center' }).click( function(){ clearInterval( TM_ANIMAZIONE ); TM_ANIMAZIONE=""; clearTimeout( ANIMAZIONE_TIMER_OPEN ); ANIMAZIONE_TIMER_OPEN=""; ANIMAZIONE_CUR_IMG=0; ANIMAZIONE_INIT_LOOP_FIRST_IMAGE_COUNTER=0; ANIMAZIONE_TIMER_OPEN=""; setAnimatioTimer(); }); $("#anima_apri").css({ textAlign: 'center' }).click( function(){ clearInterval( TM_ANIMAZIONE ); TM_ANIMAZIONE=""; ANIMAZIONE_TIMER_OPEN=""; ANIMAZIONE_CUR_IMG=ANIMAZIONE_NIMAGES-1; ANIMAZIONE_INIT_LOOP_FIRST_IMAGE_COUNTER=ANIMAZIONE_INIT_LOOP_FIRST_IMAGE; setAnimatioTimer(); }); $("#anima_start").css({ textAlign: 'center' }).click( function(){ clearInterval( TM_ANIMAZIONE ); TM_ANIMAZIONE=""; ANIMAZIONE_TIMER_OPEN=""; ANIMAZIONE_CUR_IMG=1; ANIMAZIONE_INIT_LOOP_FIRST_IMAGE_COUNTER=ANIMAZIONE_INIT_LOOP_FIRST_IMAGE; setAnimatioTimer(); }); } } function setAnimatioTimer(){ TM_ANIMAZIONE = setInterval( function(){ changePhoto(); },ANIMAZIONE_TIMER); } function changePhoto(){ $("img[id^='imanima']").hide(); //console.log("img anim "+$("#imanima-"+ANIMAZIONE_CUR_IMG)[0]) $("#imanima-"+ANIMAZIONE_CUR_IMG).show(); // Questo dà il ritardo iniziale più lungo if ( ANIMAZIONE_CUR_IMG === 0 ){ $("#anima_close").css({ backgroundColor:ANIMAZIONE_COLOR_SEL_TOOLBAR }); $("#anima_apri,#anima_start").css({ backgroundColor:'' }); $("#timerapertura").hide(); ANIMAZIONE_INIT_LOOP_FIRST_IMAGE_COUNTER += 1; if (ANIMAZIONE_INIT_LOOP_FIRST_IMAGE_COUNTER < ANIMAZIONE_INIT_LOOP_FIRST_IMAGE){ return; } } $("#anima_start").css({ backgroundColor:ANIMAZIONE_COLOR_SEL_TOOLBAR }); $("#anima_close, #anima_apri").css({ backgroundColor:'' }); ANIMAZIONE_CUR_IMG +=1; $("#timerapertura").show(); $("#timerapertura").html( (ANIMAZIONE_CUR_IMG*3) + ' secondo/i' ); if (ANIMAZIONE_CUR_IMG==ANIMAZIONE_NIMAGES){ clearInterval( TM_ANIMAZIONE ); TM_ANIMAZIONE=""; ANIMAZIONE_CUR_IMG=0; $("#anima_apri").css({ backgroundColor:ANIMAZIONE_COLOR_SEL_TOOLBAR }); $("#anima_start,#anima_close").css({ backgroundColor: '' }); $("#timerapertura").html( 'Apertura 30 secondi totale' ); ANIMAZIONE_TIMER_OPEN = setTimeout( function(){ ANIMAZIONE_INIT_LOOP_FIRST_IMAGE_COUNTER = 0; clearTimeout( ANIMAZIONE_TIMER_OPEN ); ANIMAZIONE_TIMER_OPEN=""; setAnimatioTimer(); },4600); } } // Mette la lingua per offline function sel_lang(lang){ return $(".flags").css({border:'none', 'boxShadow':''}); $("#i"+lang).css({ /*border: 'solid 3px #B6DCF8'*/ 'boxShadow': '0px 0px 8px rgba(100,100,100,0.6)' }); $("#ita, #eng, #esp").css({display:'none'}); var sf=$("#sfondo"); var dv=$("#"+lang); $("#"+lang).css({ //color :'white', //position :'absolute', left :(sf.position().left+300)-(dv.width()/2)+"px", top :(sf.position().top+200)-(dv.height()/2)+"px" /*display :'block'*/ }).fadeIn('slow'); $("#sfondo").css({opacity:0.9, 'boxShadow':'0px 0px 18px rgba(100,100,100,0.8)'}); $("#cita, #ceng, #cesp").css({display:'none'}); $("#c"+lang).css({ display :'block', left :(sf.offset().left+300)-($("#c"+lang).width()/2)+"px", top :((sf.position().top+sf.height()) + 40 )+'px', //-(this.height()/2)+"px", color :'black' //position :'absolute' /*border :'solid 1px red'*/ }); } /* nivo slider */ function showSlider(){ if (! document.getElementById("slider") ) {return} //console.log("nivo start"); $('#slider').nivoSlider({ effect:'fade', animSpeed: 500, // Slide transition speed pauseTime: 3500, // How long each slide will show startSlide: 0, // Set starting Slide (0 index) directionNav: false, // Next & Prev navigation directionNavHide: true, // Only show on hover controlNav: true, // 1,2,3... navigation controlNavThumbs: false, // Use thumbnails for Control Nav pauseOnHover: true // Stop animation while hovering }); } // Effetti del menu function menu(){ //console.log("menu"); $('#nav li').hover( function () { //mostra sottomenu $('ul', this).stop(true, true).delay(50).slideDown(100); }, function () { //nascondi sottomenu $('ul', this).stop(true, true).slideUp(200); } ); } function addPreviewLinks(){ console.log("prev "+PREVIEW); if (PREVIEW > "") { $("a").each( function( idx,el ){ var hr = this.href; if ( hr.indexOf("planetline")>-1) { if ( hr.indexOf("preview")==-1) { if ( hr.indexOf("?")>-1 ){ this.href += "&preview=true"; }else{ this.href += "?preview=true"; } //console.log("t "+this) } } }); } } // blocco il submit del form function contactsBlockFormSubmit(){ if ( PATH.indexOf("contatti")==-1 ) {return;} console.log("check submit"); $("#frmcontatti").submit( function(){ console.log("onsubmit"); return checkFieldsForm(); }); } // Invia mail contatti var COK = false; function sendMailContacts(){ if ( PATH.indexOf("contatti")==-1 ) {return;} if ( $("#captcha")[0] ) { /* Drag&Drop CAPTCHA */ // creo num casuale da 1 a 5 var nx=Math.ceil( Math.random()*5 )-1; crea_layout_captcha(nx, "../img/captcha/"); var start_left=$("#divcont")[0].style.left; var start_top=$("#divcont")[0].style.top; $("#divcont").draggable({ start: function(e,ui){ }, stop: function(e,ui){ if(COK==false){ $("#divcont").css({ left: start_left, top: start_top }) } } }); $("#cerchio").droppable({ accept: "#divcont", drop: function(event,ui){ COK=true; //check_captcha(); } }); } $("#inviacontatto").click(function(){ var prodotto = $("#prodotto option:selected").text(); console.log("prodotto "+prodotto); // Mail all'amministratore var mailto = MAIL_ADMINS; var subject = "Richiesta informazioni di un utente dal sito."; var nome = $("#nome").val(); if ( nome === "" ) { alert( "Manca il nome." ); $("#nome").focus(); return; } var mailuser = $("#email").val(); if ( mailuser==="" || checkEmail_format( mailuser ) === false ) { alert( "Manca la mail o il formato è errato." ); $("#email").focus(); return; } var telefono = $("#telefono").val(); if ( telefono==="" ) { alert( "Manca il telefono." ); $("#telefono").focus(); return; } var richiesta = $("#richiesta").val(); if ( richiesta==="" ) { alert( "Manca la richiesta." ); $("#richiesta").focus(); return; } var accetta = $("#accetta")[0].checked; if ( accetta===false ) { alert( "Devi accettare il trattamento dei dati personali." ); $("#accetta").focus(); return; } if (COK == false){ alert( "Manca il controllo antihacker." ); return; } $("#contattaci_mail_admin_nome").html( nome ); $("#contattaci_mail_admin_telefono").html( telefono ); $("#contattaci_mail_admin_mail").html( mailuser ); $("#contattaci_mail_admin_richiesta").html( richiesta ); var htmlbody = $("#contatti_mail_to_admin").show().html(); $("#contatti_mail_to_admin").hide(); send_mail( mailto,subject,htmlbody,"","", function(){ // callbackOK $("#contatti").fadeOut("slow", function(){ $("#contatti_mail_inviata").show(); }); }, function(){ // callbackError $("#contatti").hide(); $("#contatti_mail_error").show(); }, "send_mail_ex.asp" ); // mail all'utente mailto = mailuser; subject = "Confema di invio richiesta informazioni dal sito pedelectric.it"; htmlbody = $("#contatti_mail_to_user").show().html(); $("#contatti_mail_to_user").hide(); send_mail( mailto,subject,htmlbody,"","" /* attachment*/, function(){ // callbackOK /* il callback lo gestisco solo per l'admin*/ console.log("Mail user spedita "+mailto+ "body "+htmlbody); }, function(){ // callbackError }, "send_mail_ex.asp" ); }); } function checkFieldsForm(){ var nome = $("#nome").val(); if ( nome === "" ) { alert( "Manca il nome." ); $("#nome").focus(); return false; } var mailuser = $("#mail").val(); if ( mailuser==="" || checkEmail_format( mailuser ) === false ) { alert( "Manca la mail o il formato è errato." ); $("#mail").focus(); return false; } var telefono = $("#telefono").val(); if ( telefono==="" ) { alert( "Manca il telefono." ); $("#telefono").focus(); return false; } var richiesta = $("#richiesta").val(); if ( richiesta==="" ) { alert( "Manca la richiesta." ); $("#richiesta").focus(); return false; } var accetta = $("#accetta")[0].checked; if ( accetta===false ) { alert( "Devi accettare il trattamento dei dati personali." ); $("#accetta").focus(); return false; } return true; } // mappa // da: https://developers.google.com/maps/documentation/javascript/tutorial#api_key var MAP_ADDRESS = 'via cascina california 30, 22036 erba, como'; var MAP_ZOOMLEVEL = 11; var LAT = "45.800726"; var LON = "9.239891"; function loadMap(){ if ( PATH.indexOf("dove_siamo")>-1) { // info window var infowindow = new google.maps.InfoWindow({ content: "<strong>L'Albero di Simon Wolfsgruber</strong><br />Via Cascina California, 30<br>22036 Erba (Como)" }); // Oggetto direzioni var directionsService = new google.maps.DirectionsService(); var directionsDisplay = new google.maps.DirectionsRenderer(); // Faccio prima il geocode dell'indirizzo var geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': MAP_ADDRESS }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { /* map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); */ console.log("geocode "+results[0].geometry.location.lat()); if (LAT && LON ){ var positionCalculated = new google.maps.LatLng( LAT,LON ) }else{ var positionCalculated = new google.maps.LatLng( results[0].geometry.location.lat(), results[0].geometry.location.lng() ); } console.log( "poscalc "+positionCalculated.lat()); var mapOptions = { center: positionCalculated, zoom: MAP_ZOOMLEVEL, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map( document.getElementById("map_canvas"), mapOptions ); var marker = new google.maps.Marker({ position: positionCalculated, map: map, title: "<b>L'Albero di Simon Wolfsgruber</b>" }); google.maps.event.addListener(marker, 'click', function() { infowindow.open(map,marker); }); directionsDisplay = new google.maps.DirectionsRenderer(); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById('directions-panel')); $("#showroute").click(function(){ var start = MAP_ADDRESS; var end = document.getElementById('partenza').value; console.log("dir "+MAP_ADDRESS+", end "+end); var request = { origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); }); var tt=setTimeout(function(){ var mc = document.getElementById("map_canvas"); console.log("mc "+$("#map_canvas").parent()[0]); },1000); } else { alert('Geocode was not successful for the following reason: ' + status); } } ); console.log("Map"); } } // check del login var LOGIN_TIMER = ""; // timer per il log-off var LOGIN_IDUSER = 0; var LOGGED = false; var TM_LOGIN=""; var TM_LOGOUT = ""; function checkLogin(){ console.log("cklogin"); if ( PATH.indexOf("area-privata")==-1 ) {return;} var t = setTimeout( function() { var rt=$("#frame_ref")[0].getBoundingClientRect(); console.log("rt.top "+rt.top); $("#iframe_login").appendTo("body").css({ left: rt.left+'px', top: rt.top+'px', width: rt.right-rt.left+'px', height: rt.bottom-rt.top+'px', position: "absolute", display: "block", zIndex: 2000 }); }, 1200); //$("iframe").attr("src", "_asp_common/backend/login.asp?db=planetline" ); TM_LOGIN=setInterval( function(){ //console.log("frame src "+$("#iframe_login").contents().find(".backend").length ); var zoomit = $("#iframe_login").contents().find(".backend").length; if ( zoomit>0 ){ $("body").css({ overflow: 'hidden' }); $("header").hide(); $("footer").hide(); $("#main_container").hide(); //$("#iframe_login").appendTo("body"); $("#main").hide(); console.log("resize frame h"+document.body.clientHeight); $("#iframe_login").css({ left: "0px", top: "0px", width: $(document).width()+"px", height: $(window).height()+"px" //$(window).height() }); LOGGED=true; //TM_LOGIN_INTERVAL= 4000; clearInterval( TM_LOGIN ); TM_LOGIN = ""; } }, 100); TM_LOGOUT = setInterval( function(){ //console.log("frame src 2 "+$("#iframe_login").contents().find(".backend").length ); var zoomit = $("#iframe_login").contents().find(".backend").length; if ( zoomit>0 ){ }else{ if (LOGGED==true){ if (PREVIEW>""){ window.open("area-privata.asp?preview=true","_self") ; }else{ window.open("area-privata.asp","_self") ; } } } }, 4000) return //console.log("cklogin"); if ( PATH.indexOf("area-privata")==-1 ) {return;} $("#nome, #pw").keypress(function(e){ //console.log("keypress pw "+e.which) if ( e.which == 13 ) { //console.log("evt13"); document.getElementById("conferma_login").click(); } }); var dd=setTimeout(function(){ $("#user").focus(); }, 500); $("#conferma_login").click(function(){ //console.log("conferma"); var nome = escape_char( $("#user").val() ); var pw = escape_char( $("#pw").val() ); if (nome.trim().length<2){ alert("Manca il nome."); $("#user").focus(); return; } if (pw.trim().length<2){ alert("Manca la password."); $("#pw").focus(); return; } // controllo gli user var q="select * from users where nome = '"+nome+ "' and password='"+pw+ "' and tipo='admin'"; //console.log("q "+q); ajaxJSON_b( {query: q},function(re){ //console.log(re); if (eval(re).length>0) { //console.log("loggato"); // lo loggo con la data e ora LOGIN_IDUSER=eval(re)[0].id; var q="update users set logged = now() where id="+LOGIN_IDUSER; //console.log("q logme "+q); var relog = ajaxJSON_SYNC({query:q}); // becco l'url dal db q="select * from systemvar where codice='url_backend'"; ajaxJSON_b({query:q},function(re){ //console.log("re "+re); $("#main").hide(); // Cancello gli eventiali altri frames $("iframe").each( function( n, oframe ){ if (oframe.id != "frame1"){ $(oframe).hide(); console.log("hide frame "+oframe.id); } }); // rielaboro l'id dell'user var magic = ajaxJSON_SYNC({ query:"select * from systemvar where codice='magic_value'"}); //console.log("magic "+magic); var nid = parseInt( eval(magic)[0].descrizione, 10 ) * parseInt( LOGIN_IDUSER, 10 ); var fs = eval(re)[0].descrizione+"&nid="+nid+ "&showOnlyTheseTables="+SHOW_ONLY_THIS_TABLES+ "&customfields="+CUSTOMFIELDS; console.log("frame source "+fs); document.getElementById("frame1").src= unescape( fs ); $("#frame").show(); $("body").css({ margin: "0 0 0 0", overflow: 'hidden' }); resize(); //dumpProps_b( document.getElementById("frame1").contentWindow ) LOGIN_TIMER=setInterval(function(){ //var logged = ajaxJSON_SYNC(" var q="select logged from users where id="+LOGIN_IDUSER; ajaxJSON_b({query:q},function(re){ //console.log("re is logged "+re); if ( eval(re)[0].logged === "" ){ console.log("hide"); $("#frame").hide(); $("#main").show(); clearInterval( LOGIN_TIMER ); LOGIN_TIMER= ""; LOGIN_IDUSER = 0; } }); }, 3800); }); }else{ alert("Password o nome utente errati."); } }, "backend_calls.asp" ); }); $("#annulla").click(function(){ console.log("annulla"); window.open(SITENAME,"_self"); }); } $(window).resize(function(){ resize(); //$(WIN.obj)[0].style.left = $(window).width() /2 - $(WIN.obj).width()/2+'px'; //+ $('#sfondo').position().left + 10 +'px' //$(WIN.obj)[0].style.top = $('#sfondo').position().top + 4 +'px' $("#scritta").css({ left: $(window).width() /2 - $("#scritta").width() / 2 + 'px'}); }); function resize(){ //console.log("resize"); if ( PATH.indexOf("area-privata")==-1 ) {return;} $("#frame1").css({ width: $(window).width() +'px', height: $(window).height() + 'px' }); } /* chiamata ajax JSON-- secure */ function ajaxJSON_b(data, success, callbackerror, index){ var urlx = '_asp_common/backend/backend_calls.asp'; data.database = DATABASE; $.ajax({ type: 'POST', //dataType: 'text', crossDomain: false, url: urlx, async: true, data: data, success: success, error: function(xhr, err){ console.log("Error ajaxJSON_b "+err+" q "+data.query); if (callbackerror){ callbackerror(xhr, err); } } }); } /* chiamata ajax JSON */ function ajaxJSON_b(data, success, callbackerror, index){ data.database = DATABASE; data = validate_html(data); //console.log("html da validate "+decodeURI( eval(data.validate).body.toString()) ); //console.log("db first call "+data); var urlx="_asp_common/backend/backend_calls.asp"; $.ajax({ type: 'POST', //dataType: 'text', crossDomain: false, url: urlx, async: true, data: data, success: success, error: function(xhr, err){ console.log("Error ajaxJSON_b "+err+" q "+data.query+", response "+xhr.responseText); if (callbackerror){ callbackerror(xhr, err); } } }); } /* chiamata ajax JSON NOT ASYNC */ function ajaxJSON_SYNC(data,urlx,callbackerror){ if (!urlx){ urlx="_asp_common/backend/backend_calls.asp"; } data.database = DATABASE; var r = $.ajax({ type: 'POST', //dataType: 'text', crossDomain: false, url: urlx, async: false, data: data, error: function(xhr, err){ console.log("Error ajaxJSON_b "+xhr.responseText); //alert("Si è verificato un errore in fase di modifica / inserimento dati (ajaxJSON_SYNC 1732) \n" + //"\nRiprovare."); $("#info").html("JSON - Si è verificato un errore in fase di modifica / inserimento dati."); if (callbackerror){ callbackerror(xhr, err); } } }); return r.responseText; } /* chiamata ajax JSON NOT ASYNC */ function ajaxJSON_ASYNC_ExecDB(data, success, callbackerror){ urlx="_asp_common/utility/get_query.asp"; data.database = DATABASE; data.cartellatest = CARTELLATEST; data.cartellaimages= CARTELLAIMAGES; // cerco il cookie della ASP page for (var k=0; k<document.cookie.split(";").length-1; k++){ if (document.cookie.split(";")[k].toLowerCase().indexOf("asp")>-1){ data.session = document.cookie.split(';')[k].split("=")[1]; break; } } var r = $.ajax({ type: 'POST', //dataType: 'text', crossDomain: false, url: urlx, async: true, data: data, error: function(xhr, err){ console.log("Error ajaxJSON_b "+xhr.responseText); if (callbackerror){ callbackerror(xhr, err); } }, success: function(resp){ if (success){ success(resp); } }, error: function(xhr, err){ if (callbackerror){ callbackerror(xhr, err); } }, }); } /* chiamata ajax JSON NOT ASYNC */ function ajaxJSON_SYNC_ExecDB(data, callbackerror){ urlx="_asp_common/utility/get_query.asp"; data.database = DATABASE; // cerco il cookie della ASP page for (var k=0; k<document.cookie.split(";").length-1; k++){ if (document.cookie.split(";")[k].toLowerCase().indexOf("asp")>-1){ data.session = document.cookie.split(';')[k].split("=")[1]; break; } } var r = $.ajax({ type: 'GET', //dataType: 'text', crossDomain: false, url: urlx, async: false, data: data, error: function(xhr, err){ console.log("Error ajaxJSON_b "+xhr.responseText); if (callbackerror){ callbackerror(xhr, err); } } }); return r.responseText; } /* chiamata ajax JSON NOT ASYNC */ function ajaxJSON_ExecDB(data,callback, callbackerror){ urlx="_asp_common/utility/get_query.asp"; data.database = DATABASE; // cerco il cookie della ASP page for (var k=0; k<document.cookie.split(";").length-1; k++){ if (document.cookie.split(";")[k].toLowerCase().indexOf("asp")>-1){ data.session = document.cookie.split(';')[k].split("=")[1]; break; } } var r = $.ajax({ type: 'GET', //dataType: 'text', crossDomain: false, url: urlx, async: true, data: data, success: function(resp){ if (callback){ callback(resp); } }, error: function(xhr, err){ console.log("Error ajaxJSON_b "+xhr.responseText); if (callbackerror){ callbackerror(xhr, err); } } }); return r.responseText; } function validate_html(data){ var body_content = encodeURIComponent( $("body").html() .replace(/'/ig,"§") .replace(/"/ig,"ç") //.replace(/\/s/ig,"") //.replace(/\\/ig,"°") ); //data.validate='({"file": "'+escape(PAGE)+'",body: "'+body_content+'" })'; data.validate='({"file": "'+escape(PAGE)+'",body: "pappapippoplutoaaaaaaaaa" })'; //data.file=escape( PAGE ); //data.body_content= body_content; return data; }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件