1/* global ok */ 2var partner = ""; 3var tduid = ""; 4var bks_id = ""; 5url = window.location.pathname; 6url = url.split("/"); 7typePage = url[1]; 8if (url[2] == null) 9 var page = 'hp'; 10else 11 var page = url[2]; 12$(document).ready(function () { 13 $("#num_tel").focus(function () { 14 $('#invia-sitofono,#invia-sitofono_desktop').removeAttr('disabled'); 15 $('#invia-sitofono,#invia-sitofono_desktop').removeClass('disabled'); 16 $('#box-err,#box-errModal').css({'display': 'none'}); 17 18 }); 19 $("#nome_anagr,#cognome_anagr,#email_anagr").focus(function () { 20 //$('#invia-sitofono').removeAttr('disabled'); 21 $('#box-err').css({'display': 'none'}); 22 $('#box-errModal').css({'display': 'none'}); 23// $("#nome_anagr").css({'border': '1px solid #ccc'}); 24// $("#cognome_anagr").css({'border': '1px solid #ccc'}); 25// $("#email_anagr").css({'border': '1px solid #ccc'}); 26 }); 27 $("#invia-sitofono,#invia-sitofono-vd,#invia-sitofono_desktop").click(function () { 28 29 //verifico se siamo in un include desktop o meno 30 myId = $(this).attr('id'); 31 if (myId == 'invia-sitofono_desktop') suffix = '_desktop'; 32 else suffix = ''; 33 34 35 sitPage = $(this).attr('data-sit'); 36 try { 37 if (sitPage == 'voucher') { 38 wt.sendinfo({linkId: "Ti Chiamiamo Noi - Voucher"}); 39 } else if (sitPage == 'vendita-cb'){ 40 wt.sendinfo({linkId: "Ti Chiamiamo Noi - Layer Vendita Callback"}); 41 } else { 42 wt.sendinfo({linkId: "Ti Chiamiamo Noi"}); 43 } 44 } catch (err) { 45 } 46 sendData(suffix); 47 }); 48 $("#view-sitofono").click(function () { 49 $('#modal-cliente').modal('hide'); 50 $('#modal-sitofono').modal('show'); 51 }); 52 53 $('#modal-sitofono').on('hidden.bs.modal', function () { 54 $('#dataApp').val(''); 55 $('#ora_app').prop('selectedIndex', 0); 56 }); 57}); 58function sendData(suffix) { 59 num_tel = $("#num_tel"+suffix).val(); 60 anagrafica = $("#anagrafica").val(); 61 nome_anagr = $("#nome_anagr").val(); 62 cognome_anagr = $("#cognome_anagr").val(); 63 cop_anagr = $("#cop_anagr").val(); 64 65 expr1 = /^00/; 66 expr2 = /^39/; 67 expr3 = /^0/; 68 str = num_tel.toString(), 69 len = str.length; 70 if (num_tel == "") { 71 displayErr(0); 72 return false; 73 } else if (num_tel.search(/^[0-9]+$/) < 0) { 74 displayErr(2); 75 return false; 76 } else if (expr1.test(num_tel)) { 77 displayErr(3); 78 return false; 79 }else if (expr3.test(num_tel)) { 80 displayErr(5); 81 return false; 82 } else if (expr2.test(num_tel) && len > 10) { 83 displayErr(3); 84 return false; 85 } else if (!getValidNumber(num_tel)) { 86 displayErr(1); 87 return false; 88 } 89 data_app = $("#data_app").val(); 90 ora_app = $("#ora_app").val(); 91 prod = $("#prod-sit").val(); 92 tec = $("#tec-sit").val(); 93 nometype = $("#type-sit").val(); 94 ref = $("#ref-sit").val(); 95 dev = $("#device-sit").val(); 96 if (nometype != 'UP') { 97 idpt = $("#id-partner").val(); 98 } else { 99 idpt = ''; 100 } 101 vc = $("#invia-sitofono"+suffix).attr('data-view'); 102 $("#loaderSit"+suffix).css({'display': 'block'}); 103 $("#formSit"+suffix).css({'display': 'none'}); 104 $.ajax({
105 type: "POST", 106 url: "/inc/etc/sitofono.php", 107 data: { 108 num_tel: num_tel, 109 data_app: data_app, 110 ora_app: ora_app, 111 prod: prod, 112 tec: tec, 113 type: nometype, 114 ref: ref, 115 device: dev, 116 anagrafica: anagrafica, 117 nome_anagr: nome_anagr, 118 cognome_anagr: cognome_anagr, 119 cop_anagr: cop_anagr, 120 id_partner: idpt, 121 partner_name: partner_name, 122 page: url[2] 123 }, 124 dataType: "xml", 125 xhrFields: {withCredentials: true}, 126 success: function (xml) 127 { 128 $(xml).find('resp').each(function () { 129 $("#loaderSit"+suffix).css({'display': 'none'}); 130 $("#formSit"+suffix).css({'display': 'block'}); 131 var code = $(this).find('code').text(); 132 var err = $(this).find('err').text(); 133 var idlead = $(this).find('id').text(); 134 if (code == '1') { 135 // codici_partner(partner, idlead, prod); 136 //FBtracking(partner); 137 try { 138 dataLayer.push({ 139 'event': 'lead-insert', 140 'lead-id': idlead, 141 'product': prod 142 }); 143 } 144 catch(err) { 145 } 146 } else { 147 try { 148 dataLayer.push({ 149 'event': 'lead-error' 150 }); 151 } 152 catch(err) { 153 } 154 } 155 displayResp(code, err, vc,suffix); 156 }); 157 } 158 }); 159} 160 161function FBtracking(partner){ 162 callPartnerFB = ["salesmart_meta_b2b","salesmart_meta_b2c","salesmart_meta_mobile"]; 163 getCallPartnerFB = callPartnerFB.indexOf(partner); 164 if (getCallPartnerFB > -1) { 165 try { 166 fbq('track', 'Lead'); 167 } catch (err) { 168 } 169 } 170} 171 172function codici_partner(partner, idlead, product) { 173 pixelPartner = ["citynews_fisso_display","citynews_fisso_content","eleads","triboo","segugio_new","spinup"]; 174 selectPixel = pixelPartner.indexOf(partner); 175 iframePartner = ["alkemy","awin","sostariffe"]; 176 selectIframe = iframePartner.indexOf(partner); 177 OpenIframePartner = ["sostariffe_new","sostariffe2020", "refine", "refine_b2b", "iol"]; 178 selectIframePartner = OpenIframePartner.indexOf(partner); 179 180 if (selectIframe > -1) { 181 path_frame = "/inc/codici/" + partner + "/?idlead=" + idlead + "&product=" + product; 182 $('#partner').attr('src', path_frame); 183 } 184 185 if (selectIframePartner > -1) { 186 jQuery.get("/inc/codici/" + partner + "/?idlead=" + idlead + "&product=" + product, function (data) { 187 $('#partner').attr('src', data); 188 }); 189 } 190 191 if (selectPixel > -1) { 192 if (partner == 'webgains') { 193 path_pixel = "/inc/codici/" + partner + "/" + product + "/pixel.html"; 194 } else { 195 path_pixel = "/inc/codici/" + partner + "/pixel.html"; 196 } 197 $.ajax({
198 url: path_pixel, //or your url 199 success: function (content) { 200 var img = document.createElement("img"); 201 if (idlead) { 202 addtocontent = content.replace("{{orderID}}", idlead); 203 if (partner == 'segugio_new') { 204 addtocontent = addtocontent.replace("{{tduid}}", tduid); 205 } 206 if (partner == 'webgains') { 207 wgclickid = getUrlParameter('clickid'); 208 addtocontent = addtocontent.replace("{{wgclickid}}", wgclickid); 209 } 210 } else { 211 addtocontent = content; 212 } 213 img.src = addtocontent; 214 document.body.appendChild(img); 215 }, 216 }) 217 } 218} 219 220function displayResp(c, e, v, suffix) { 221 222 $('#box-form').css({'display': 'none'}); 223 $('#resp-sitofono-text'+suffix).empty(); 224 $('#resp-sitofono'+suffix).css({'display': 'block'}); 225 msg_ok = "<b>Grazie</b>,<br />la tua richiesta è stata inoltrata correttamente.<br>Il nostro operatore ti richiamerà dal numero: <h3>+39130</h3><br/>Oggi è domenica?\n" + 226 "Ti richiameremo da domani a partire dalle ore 9:00"; 227 if(e == '2'){ 228 msg_err = "Il numero è già stato inserito. Un operatore provvederà a contattarti. Grazie."; 229 }else{ 230 msg_err = "Attenzione. Si è verificato un errore. Ti preghiamo di riprovare più tardi."; 231 } 232 if (c == 1) { 233 $('#resp-sitofono-text'+suffix).html(msg_ok); 234 $('#contattaci'+suffix).css({'display':'none'}); 235 $('#response'+suffix).css({'display':'block'}); 236 } else { 237 $(".resp-box-sitofono").css({'background': '#c00c00'}); 238 $('#resp-sitofono-text'+suffix).html(msg_err); 239 $('#contattaci'+suffix).css({'display':'none'}); 240 $('#response'+suffix).css({'display':'block'}); 241 242 } 243} 244 245function displayRespPartner(c, e, v) {} 246function displayRespPartner_old(c, e, v) { 247 $('#resp-sitofono-text').empty(); 248 $('#contattaci').css({'display': 'none'}); 249 $('#response').css({'display': 'block'}); 250 if (v == 'y') 251 var within = " entro pochi minuti"; 252 else 253 var within = ""; 254 if (c == 1) { 255 $('#resp-sit-partner').css({'background': '#0098a7'}); 256 $('#resp-sit-partner').html("<b>Grazie</b>,<br />la tua richiesta è stata inoltrata correttamente.<br>Il nostro operatore ti richiamerà dal numero: <h3>+39130</h3><br/>Oggi è domenica?\n" + 257 "Ti richiameremo da domani a partire dalle ore 9:00"); 258 } else if (e == 4) { 259 $('#resp-sit-partner').css({'background': '#0098a7'}); 260 $('#resp-sit-partner').html("<b>Grazie</b>,<br />la tua richiesta è stata inoltrata correttamente.<br>Il nostro operatore ti richiamerà dal numero: <h3>+39130</h3><br/>Oggi è domenica?\n" + 261 "Ti richiameremo da domani a partire dalle ore 9:00"); 262 } else { 263 if (e == 1) { 264 $('#resp-sit-partner').css({'background': '#fd4b5f'}); 265 $('#resp-sit-partner').html("<b>Attenzione</b><br />Si è verificato un errore interno al sistema.<br>Ti preghiamo di riprovare più tardi"); 266 } else if (e == 2) { 267 $('#resp-sit-partner').css({'background': '#fd4b5f'}); 268 $('#resp-sit-partner').html("<b>Attenzione</b><br />Impossibile effettuare altri inserimenti. Se hai già inserito un numero di telefono un operatore provvederà a contattarti"); 269 } else if (e == 3) { 270 $('#resp-sit-partner').css({'background': '#fd4b5f'}); 271 $('#resp-sit-partner').html("<b>Attenzione</b><br />Il numero è già stato inserito.<br>Un operatore provvederà a contattarti"); 272 } 273 } 274} 275 276function displayErr(c) { 277 if (c == 0) 278 $("#box-err").html("Attenzione, devi inserire un numero di telefono cellulare."); 279 if (c == 1) 280 $("#box-err").html("Attenzione, hai inserito un numero non corretto."); 281 if (c == 5) 282 $("#box-err").html("Attenzione, devi inserire un numero di cellulare."); 283 if (c == 2) 284 $("#box-err").html("Attenzione, devi inserire solo numeri."); 285 if (c == 3) 286 $("#box-err").html("Attenzione, non inserire il prefisso internazionale."); 287 if (c == 4) { 288 $("#box-err").html("Attenzione, tutti i campi sono obbligatori."); 289 $("#nome_anagr").css({'border': '1px solid #c00c00'}); 290 $("#cognome_anagr").css({'border': '1px solid #c00c00'});
291 $("#num_tel").css({'border': '1px solid #c00c00'}); 292 } 293 //$("#num_tel").css({'border': '1px solid #c00c00'}); 294 $('#box-err').css({'display': 'block'}); 295} 296 297function getValidNumber(CLI) { 298 url = "/inc/tool-copertura/GetFormattedNumber.php?"; 299 ctrl_number = $.ajax({ 300 type: "POST", 301 url: url, 302 data: "CLI=" + CLI, 303 dataType: "html", 304 async: false 305 }).responseText; 306 if (ctrl_number == 'FIXED_LINE') { 307 return true; 308 } 309 if (ctrl_number == 'MOBILE') { 310 return true; 311 } else { 312 return false; 313 } 314} 315 316var getUrlParameter = function getUrlParameter(sParam) { 317 var sPageURL = window.location.search.substring(1), 318 sURLVariables = sPageURL.split('&'), 319 sParameterName, 320 i; 321 322 for (i = 0; i < sURLVariables.length; i++) { 323 sParameterName = sURLVariables[i].split('='); 324 325 if (sParameterName[0] === sParam) { 326 return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 327 } 328 } 329};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.