1/*DETECT SCROLLBAR + CSS */ 2var scrollDiv = document.createElement("div"); 3scrollDiv.className = "scrollbar-measure"; 4document.body.appendChild(scrollDiv); 5var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; 6document.body.removeChild(scrollDiv); 7 8 function ValEmeial(val){ 9 var emailVal = val; 10 var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,15})?$/; 11 if(!emailReg.test(emailVal)) { 12 return false; 13 } 14 return true; 15 } 16 17 function chiamata(page,data,options,url) { 18 var addfnc = 0; 19 var $content = $("#overlay"); 20 if (options=='scheda') { $content = $("#overlayinline"); } 21 if (page.indexOf('ajx_scheda.php') !== -1) { addfnc = 1; } else if (page.indexOf('ajx_disclaimer.php') !== -1) { addfnc = 2; } 22 var reurl = url; 23 var origin = window.location.href; 24 $("#loading").addClass('On'); 25 $.ajax({ 26 type: "GET", 27 url : page, 28 data: { data : data, options : options }, 29 cache: false, 30 success : function (data,stato) { 31 var data = $.trim(data); 32 if(data == 2){ 33 } else { 34 if(options=='open'){ window.history.pushState({href: reurl}, '', reurl); } 35 36 $content.html(data); 37 38 $(".chzn-select").chosen({no_results_text:"Nessun risultato", disable_search_threshold: 20000}); 39 $(".chzn-select-deselect").chosen({no_results_text:"Nessun risultato", allow_single_deselect:true, disable_search_threshold: 20000}); 40 } 41 }, 42 error : function (richiesta,stato,errori) { 43 console.log("** LOAD SCHEDA = "+errori); 44 } 45 }).done(function(html) { 46 var html = $.trim(html); 47 if(html == 2){ 48 } else { 49 50 if (addfnc==1) { 51 initScheda(); 52 } 53 if (addfnc==2) { 54 initDisclaimer(data); 55 } 56 57 var $elems = $('#overlay').find('img.img-scheda'); 58 var elemsCount = $elems.length; 59 var loadedCount = 0; 60 if(elemsCount>0){ 61 $elems.on('load', function () { 62 loadedCount++; 63 if (loadedCount == elemsCount) { 64 $("#loading").removeClass('On'); 65 if(!options || options!='scheda'){ 66 $("body").addClass("overlay-open"); 67 setTimeout(function(){ 68 $content.addClass("overlay-scroll"); 69 }, 1); 70 } 71 } 72 }); 73 }else{ 74 $("#loading").removeClass('On'); 75 if(!options || options!='scheda'){ 76 $("body").addClass("overlay-open"); 77 setTimeout(function(){ 78 $content.addClass("overlay-scroll"); 79 }, 1); 80 } 81 } 82 83 var wO = $(".overlay").width(), 84 wOB = wO - scrollbarWidth; 85 $(".overlay-bg").width(wOB); 86 87 if(!options || options!='scheda'){ 88 $(".closeOVER").bind( "click", function() { 89 history.replaceState({href: origin}, '', origin); 90 if(options=='carrello'){ 91 location.reload(); 92 return false; 93 } 94 $("body").removeClass("overlay-open"); 95 $content.html(''); 96 return false; 97 }); 98 } 99 } 100 }); 101 } 102 103 function SearchAction(page,lg,voce1,voce2) { 104 var $content = $("#overlay"); 105 $("#loading").addClass('On'); 106 $.ajax({ 107 type: "POST", 108 url : page, 109 data: "voce1="+voce1+"&voce2="+voce2+"&lang="+lg, 110 cache: false, 111 success : function (data,stato) { 112 var data = $.trim(data); 113 if(data == 2){ 114 console.log("LOAD SEARCH"); 115 } else { 116 $content.html(data); 117 } 118 }, 119 error : function (richiesta,stato,errori) { 120 console.log("ERROR LOAD SEARCH = "+errori); 121 } 122 }).done(function(html) { 123 var html = $.trim(html); 124 if(html == 2){ 125 console.log("LOAD SEARCH"); 126 } else { 127 var $elems = $('#overlay').find('img'); 128 var elemsCount = $elems.length; 129 var loadedCount = 0; 130 if(elemsCount>0){ 131 $elems.on('load', function () { 132 loadedCount++; 133 if (loadedCount == elemsCount) { 134 $("body").addClass("overlay-open"); 135 $("#loading").removeClass('On'); 136 } 137 }); 138 }else{ 139 $("body").addClass("overlay-open"); 140 $("#loading").removeClass('On'); 141 } 142 143 $(".overlay-close").bind( "click", function() { 144 $("body").removeClass("overlay-open"); 145 $content.html(''); 146 return false; 147 });
148 149 } 150 }); 151 } 152 153 function getHash() { 154 return window.location.hash.slice(1); 155 } 156 157 function checkHash(pref) { 158 var hash = getHash(); 159 hash = hash.replace(pref, ""), 160 hash = hash.replace("!", ""); 161 162 if (hash) { 163 return hash; 164 } 165 return false; 166 } 167 168function initScheda() { 169 var dataEl = document.getElementById('scheda-data'); 170 if (!dataEl) return; 171 172 var cfg = JSON.parse(dataEl.textContent); 173 174 if (cfg.options == 'scheda') { 175 $('.scheda-logo').click(function () { 176 window.location.href = cfg.pathROOT + cfg.pathMOB + cfg.pathHOME; 177 return false; 178 }); 179 } 180 181 $("#schedaIMG img").click(function () { 182 var img = $(this).attr("src"); 183 if (img) { 184 img = img.replace(cfg.pathPROtmb, cfg.pathPRObig); 185 $(".zoomimage").html('<img src="' + img + '">'); 186 setTimeout(function () { 187 $("body").addClass("gozoomimage"); 188 $(".zoomimage").on("click", "img", function () { 189 $("body").removeClass("gozoomimage"); 190 }); 191 }, 100); 192 } 193 }); 194 195 $("form[name='addCAR']").submit(function() { 196 var opt01 = $("select#selectopt01 option:selected").attr('value'), 197 opt02 = $("select#selectopt02 option:selected").attr('value'), 198 selopt01 = opt01, 199 selopt02 = opt02; 200 if(!opt01){ selopt01 = 0; } 201 if(!opt02){ selopt02 = 0; } 202 203 if(opt01 && selopt01==0){ 204 alert("Seleziona un'opzione"); 205 return false; 206 } 207 if(opt02 && selopt02==0){ 208 alert("Seleziona un'opzione"); 209 return false; 210 } 211 212 var daticarrello = $(this).serialize(); 213 $.ajax({ 214 type: "POST", 215 url : "ajx_carrello_action.php", 216 data: daticarrello, 217 beforeSend: function () {}, 218 success : function (data,stato) { 219 var response = $.trim(data); 220 response = parseInt(response); 221 222 if(response>0){ 223 $(".btnroundedAddCart").addClass("aggiunto").text(cfg.txtLANG06); 224 $("#carrello").addClass("show").find("div").html(response); 225 226 if (cfg.options == 'scheda') { 227 setTimeout(function () { window.location.href = cfg.pathROOT+cfg.pathMOB+cfg.pathCARRELLO; }, 500); 228 } else { 229 setTimeout(function () { $(".closeOVER").trigger("click"); }, 500); 230 } 231 232 return false; 233 } else { 234 alert("Si è verificato un errore!"); 235 console.log('Errore ADD TO CART = '+data); 236 } 237 }, 238 error : function (richiesta,stato,errori) { 239 console.log(errori); 240 } 241 }); 242 return false; 243 }); 244 245// OPZIONE 1 -- 246if (cfg.nOPT1val>0) { 247 248$(".openINFO").click(function () { 249 var url = $(this).attr("rel"), 250 open = $(this).attr("data-open"); 251 if(open==="1"){ 252 $.ajax({ 253 url: url, 254 success: function(result){ 255 $("#infooption").html(result); 256 }}).done(function(data) { 257 $("body").addClass("openinfo"); 258 259 $(".closeINFOOPTION").click(function () { 260 $("body").removeClass("openinfo"); 261 $("#infooption").html(''); 262 }); 263 264 }); 265 } else { 266 window.open(url); 267 } 268 return false; 269}); 270 271// ECCEZIONI DI PREZZO -- 272const prezzoEU = cfg.prezzoEU; 273function eccprezzo(opz01,opz02) { 274 275$.ajax({ 276 url: "ajx_eccezione_prezzo.php", 277 method: "POST", 278 dataType: "json", 279 data: { 280 proid: cfg.proid, 281 optgruid01: cfg.proOPT01, 282 optgruid02: cfg.proOPT02, 283 opz01: opz01, 284 opz02: opz02, 285 sconto: cfg.sconto 286 } 287}) 288.done(function (res) { 289 290$("#pricePRO").html(prezzoEU); 291$("#pricePROMO").html('').removeClass('strike'); 292 293 if (!res || res.ok !== true) { 294 console.log(res.error); 295 $("#sendCART").addClass("hidden"); 296 $("#INPROMO").addClass('hidden'); 297 return; 298 } 299 if (res.prezzo.length === 0) { 300 $("#sendCART").addClass("hidden"); 301 $("#INPROMO").addClass('hidden'); 302 return; 303 } 304 305 let prezzoECC = res.prezzo; 306 let listinoECC = res.listino; 307 let inpromoECC = res.inpromo; 308 let scontoECC = res.sconto; 309 310 let prezzoVAL = res.prezzoVAL; 311 let listinoVAL = res.listinoVAL; 312 313 $("#pricePRO").html(prezzoECC); 314 if (listinoECC!=prezzoECC) { 315 $("#pricePROMO").html(listinoECC); 316 } 317 318// Input modificati 319 $("input[name='costo']").val(listinoVAL); 320 $("input[name='costosconto']").val(prezzoVAL); 321 $("input[name='sconto']").val(scontoECC); 322 323 if (inpromoECC==1) { $("#INPROMO").removeClass('hidden'); $("#pricePROMO").addClass('strike'); } else { $("#INPROMO").addClass('hidden'); } 324 325}) 326.fail(function () { 327 console.log("Nessun di rete / server"); 328}); 329} // \eccprezzo 330 331// MAGAZZINO -- 332const nopt01 = cfg.nOPT1val; 333const nopt02 = cfg.nOPT2val; 334 335const btntxtOK = cfg.txtLANG05; 336const btntxtKO = cfg.txtLANG20; 337const btntxtADD = cfg.txtLANG06; 338 339const btnclassOK = 'btnroundedAddCart'; 340const btnclassKO = 'btnroundedNOCart'; 341const btnclassADD = 'aggiunto'; 342 343function magazzino(opz01,opz02) { 344if (nopt02 > 0 && opz02==0) { 345return; 346} 347 348$.ajax({
349 url: "ajx_check_magazzino.php", 350 method: "POST", 351 dataType: "json", 352 data: { 353 proid: cfg.proid, 354 nopt01: nopt01, 355 nopt02: nopt02, 356 opz01: opz01, 357 opz02: opz02, 358 qtaORDINATA: 1 359 } 360}) 361.done(function (res) { 362 363 if (!res || res.ok !== true) { 364 console.log(res.error); 365 $("#sendCART").addClass("hidden"); 366 return; 367 } 368 if (res.disponibilita.length === 0) { 369 $("#sendCART").addClass("hidden"); 370 return; 371 } 372 373 let disponibilita = res.disponibilita; 374 let incart = res.incart; 375 376// Non acquistabile -- 377 if (disponibilita==0) { 378 $('#sendCART').prop('type','button').text(btntxtKO).addClass(btnclassKO).removeClass(btnclassOK).removeClass(btnclassADD); 379 } else { 380 $('#sendCART').prop('type','submit').text(btntxtOK).addClass(btnclassOK).removeClass(btnclassKO); 381 if (incart==1) { 382 $('#sendCART').addClass(btnclassADD).text(btntxtADD); 383 } else { 384 $('#sendCART').removeClass(btnclassADD).text(btntxtOK); 385 } 386 } // \non acquistabile 387 388 if (opz01==0) { 389 $("#sendCART").addClass("hidden"); 390 } else { 391 $("#sendCART").removeClass("hidden"); 392 } 393}) 394.fail(function () { 395 console.log("Nessun di rete / server"); 396}); 397} // \magazzino 398 399// Opzione 1 -- 400 $("#selectopt01").chosen().change(function () { 401 var opt01 = $("select#selectopt01 option:selected").attr('value'), 402 relopt01 = $("select#selectopt01 option:selected").attr('rel') 403 opt02 = $("select#selectopt02 option:selected").attr('value'); 404 if(!opt02){ opt02 = 0; } 405 406 // relopt01 = relopt01.split(","); 407 408 if(opt01>0) { 409 $( ".imgopt01" ).html(""); 410/* OPTION 2 */ 411 if(cfg.nOPT2val>0) { 412 $("select#selectopt02").attr("disabled",false).trigger("liszt:updated"); 413 } // \option 2 414 eccprezzo(opt01,opt02); 415 magazzino(opt01,opt02); 416 417 // Immagine Opzione -- 418 var nameimg = 'OPT01'+opt01+'OPT02'+opt02; 419 var imgoption = $("img[rel='"+nameimg+"']"); 420 if(imgoption.length > 0){ 421 var cloneimgoption = imgoption.clone(false).removeAttr("id"); 422 $( ".imgopt01" ).html(cloneimgoption); 423 $('#imgopt01').on('click', 'img.lazy', function() { 424 var big = $(this).attr("data-big"); 425 setTimeout(function () { $("#"+big).trigger("click"); }, 2); 426 }); 427 } else {
428 nameimg = 'OPT01'+opt01+'OPT020'; 429 imgoption = $("img[rel='"+nameimg+"']"); 430 if(imgoption.length > 0){ 431 cloneimgoption = imgoption.clone(false).removeAttr("id"); 432 $( ".imgopt01" ).html(cloneimgoption); 433 $('#imgopt01').on('click', 'img.lazy', function() { 434 var big = $(this).attr("data-big"); 435 setTimeout(function () { $("#"+big).trigger("click"); }, 2); 436 }); 437 } else { 438 $( ".imgopt01" ).html(""); 439 } 440 } 441 442 } else { 443 $( ".imgopt01" ).html(""); 444 $("select#selectopt02").val(0).attr("disabled",false).trigger("liszt:updated"); 445 eccprezzo(opt01,0); 446 magazzino(opt01,opt02); 447 } 448 return false; 449 }); 450 451// OPZIONE 2 -- 452 if(cfg.nOPT2val>0) { 453 $("#selectopt02").chosen().change(function () { 454 var opt01 = $("select#selectopt01 option:selected").attr('value'), 455 opt02 = $("select#selectopt02 option:selected").attr('value'); 456 if(!opt02){ opt02 = 0; } 457 458 if(opt01>0 && opt02>0) { 459 460 eccprezzo(opt01,opt02); 461 magazzino(opt01,opt02); 462 463 $( ".imgopt02" ).html(""); 464 var nameimg = 'OPT01'+opt01+'OPT02'+opt02; 465 var imgoption = $("img[rel='"+nameimg+"']"); 466 if(imgoption.length > 0){ 467 var cloneimgoption = imgoption.clone(false).removeAttr("id"); 468 $( ".imgopt02" ).html(cloneimgoption); 469 $('#imgopt02').on('click', 'img.lazy', function() { 470 var big = $(this).attr("data-big"); 471 setTimeout(function () { $("#"+big).trigger("click"); }, 2); 472 }); 473 } else { 474 nameimg = 'OPT010OPT02'+opt02; 475 imgoption = $("img[rel='"+nameimg+"']"); 476 if(imgoption.length > 0){ 477 cloneimgoption = imgoption.clone(false).removeAttr("id"); 478 $( ".imgopt02" ).html(cloneimgoption); 479 $('#imgopt02').on('click', 'img.lazy', function() { 480 var big = $(this).attr("data-big"); 481 setTimeout(function () { $("#"+big).trigger("click"); }, 2); 482 }); 483 } else { 484 $( ".imgopt02" ).html(""); 485 } 486 } 487 } else { 488 $( ".imgopt02" ).html(""); 489 eccprezzo(opt01,opt02); 490 magazzino(opt01,opt02); 491 } 492 return false; 493 }); 494 } // \option 2 495 } 496} // initScheda 497 498function initDisclaimer(data) { 499 if (data) { 500 var $el = $('#' + data); 501 502 if ($el.length) { 503 var offset = $el.offset(); 504 if (offset) { 505 var scroll = $(window).scrollTop(); 506 var linkPos = offset.top; 507 508 linkPos = (linkPos - scroll) - 90; 509 510 if (linkPos <= 140) { 511 linkPos = 0; 512 } 513 514 $("#overlay") 515 .css("overflow-y", "scroll") 516 .animate({ scrollTop: linkPos }, 'slow'); 517 } 518 } 519 } // \data 520} // initDisclaimer
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.