//****Anti GDPR temporaneo /* if(document.location == "http://www.alfarestyling.it/alfarestyling/index.php?controller=authentication&back=my-account" || document.location == "http://www.alfarestyling.it/alfarestyling/index.php?controller=authentication&back=my-account") { document.location = "http://www.alfarestyling.it/alfarestyling/index.php"; } */ //**** //**** Deviazione form contatti (viene attaccato da droidi) if(document.location == "http://www.alfarestyling.it/alfarestyling/index.php?controller=contact") { document.location = "http://www.alfarestyling.it/alfarestyling/index.php"; } //**** //**** Sospensione funzionalità di vendita /* if(document.location == "http://www.alfarestyling.it/alfarestyling/index.php") { setTimeout(function(){ alert("Servizio di vendita momentaneamente sospeso. Rimane possibile la consultazione nell'attesa di ripartire. Ci scusiamo per l'inconveniente."); }, 2000); } setInterval(function(){ try{ document.getElementById("add_to_cart").style.display = "none"; } catch(err){} }, 250); */ //**** // function AggiuntaNerettoMenu() { var uls = document.getElementsByTagName("ul"); for(var Ciclo=0;Ciclo"; a.innerHTML = inner_html; a.style.color = "#ff0000"; } } } } // function Rimuovi_NR() { //**** console.log("HTMLbox.jsp - Rimuovi_NR()"); //**** var divs = document.getElementsByTagName("div"); for(var Ciclo=0;Ciclo"; span.innerHTML = inner_html; //span.style.color = "#ff0000"; } } } } // Gestione click lungo **************** var long_click; var element_clicked; var element_clicked_bk; var element_clicked_color; // function LongClick(time, callback, element) { element_clicked = element; long_click = setTimeout(function() { ClearLongClick_count = 0; setTimeout(callback,1); }, time); } // var ClearLongClick_count = 0; function ClearLongClick() { ClearLongClick_count++; clearTimeout(long_click); if(ClearLongClick_count > 3) { ClearLongClick_count = 0; alert("Devi tenere premuto per qualche secondo!"); } } //*************************************** // function setCookie(c_name,value,ex) { var exdate = new Date(); //**** //alert("HTMLbox.jsp - setCookie(...)"); //**** var millisecondi = exdate.getTime(); var millisecondi2 = millisecondi + (ex * 24 * 60 * 60 * 1000); // ex = numero di giorni exdate.setTime(millisecondi2); //**** //alert("HTMLbox.jsp - setCookie(...) - exdate.toUTCString() = " + exdate.toUTCString()); //**** var c_value = escape(value) + ((ex==null) ? "" : "; expires=" + exdate.toUTCString() + "; path=/alfarestyling/"); var c = c_name + "=" + c_value; //**** //alert("HTMLbox.jsp - setCookie(...) - Cookie = " + c); //**** document.cookie = c; } // function deleteCookie(c_name) { //**** //alert("HTMLbox.jsp - deleteCookie(...) - c_name = " + c_name); //**** try{ var c_value = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/alfarestyling/"; var c_value2 = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/alfarestyling"; var c = c_name + "=" + c_value; var c2 = c_name + "=" + c_value2; //**** //alert("HTMLbox.jsp - deleteCookie(...) - Cookie = " + c); //**** document.cookie = c; document.cookie = c2; } catch(err){ alert("HTMLbox.jsp - deleteCookie(...) - Errore: " + err.message); } } // function getCookie(c_name) { var c_value = document.cookie; var c_start = c_value.indexOf(" " + c_name + "="); //**** //alert("HTMLbox.jsp - getCookie(...) - c_name = " + c_name); //**** if(c_start == -1) { c_start = c_value.indexOf(c_name + "="); } if(c_start == -1) { c_value = ""; } else { c_start = c_value.indexOf("=", c_start) + 1; var c_end = c_value.indexOf(";", c_start); if(c_end == -1) { c_end = c_value.length; } c_value = unescape(c_value.substring(c_start,c_end)); } c_value = c_value.replace(new RegExp('"', 'g'), ''); return c_value; } var ctrl_press = 0; window.addEventListener("keydown", function(event) { //**** //alert(event.keyCode); //**** if(event.keyCode == 18) { ctrl_press++; if((ctrl_press) % 2 == 1) { document.getElementById("byST-Tools").innerHTML = ""; setTimeout(function() { ctrl_press = 0; document.getElementById("byST-Tools").innerHTML = ""; },5000); } else { document.getElementById("byST-Tools").innerHTML = ""; } } }, false); // function LoginExtraTools() { //**** //alert("HTMLbox.jsp - LoginExtraTools()"); //**** var wndLET; var url; var x = (window.screen.width - 640) / 2; var y = (window.screen.height - 480) / 2; url = "login-extra-tools.jsp?" + new Date(); wndLET = window.open(url,'wndLET','resizable=no,scrollbars=no,toolbar=no,status=no,width=640,height=480,left=' + x + ',top=' + y); wndLET.focus(); } // function RinominaMenuPrincipale() { //**** console.log("HTMLbox.jsp - RinominaMenuPrincipale()"); //**** try{ var testata_menu = document.getElementsByClassName("cat-title")[0]; if(testata_menu) { var linguaggio = document.getElementsByClassName("current")[1].innerHTML; if(linguaggio.indexOf("Italiano") != -1) { testata_menu.innerHTML = "Scegli la ricerca"; } else { testata_menu.innerHTML = "Choose the method"; } } else { setTimeout("RinominaMenuPrincipale();", 250); } } catch(err){ //alert(err); setTimeout("RinominaMenuPrincipale();", 250); } } RinominaMenuPrincipale(); // function RidimensionaMenuPrincipale() { //**** console.log("HTMLbox.jsp - RidimensionaMenuPrincipale()"); //**** try{ var menu_tipo_ricerca = document.getElementsByClassName("sf-menu clearfix menu-content sf-js-enabled sf-arrows")[0]; //**** //alert(menu_tipo_ricerca); //**** if(menu_tipo_ricerca) { //**** //alert("STEP"); //**** var lis = menu_tipo_ricerca.getElementsByTagName("li"); var uls_remove = new Array(); for(var Ciclo=0;Ciclo 20) resp = 20; for(var Ciclo=0;Ciclo 0) alert("Etichette inviate alla coda di stampa!"); } catch(err){} } String.prototype.replaceAll = function(search, replacement) { var target = this; return target.replace(new RegExp(search, 'g'), replacement); }; const copyToClipboard = str => { const el = document.createElement('textarea'); el.value = str; el.setAttribute('readonly', ''); el.style.position = 'absolute'; el.style.left = '-9999px'; document.body.appendChild(el); el.select(); document.execCommand('copy'); document.body.removeChild(el); }; var product_reference; window.onload = function() { RinominaEtichetteNuovo(); try{ document.getElementById("product_reference").onmousedown = function(){ product_reference = document.getElementById("product_reference"); var codice = product_reference.innerText; codice = codice.replace("Riferimento", "").trim(); copyToClipboard(codice); product_reference.title = "Copiato in clipboard"; LongClick(2000, "StampaEtichetta();", document.getElementById("product_reference")); } document.getElementById("product_reference").onmouseup = function(){ ClearLongClick(); } document.getElementById("product_reference").style.cursor = "pointer"; } catch(err){} // document.getElementById("search_query_top").onchange = function() { var v = document.getElementById("search_query_top").value; v = v.replaceAll("'","-"); document.getElementById("search_query_top").value = v; } setTimeout(function(){ document.getElementById("search_query_top").value = ""; var top = window.pageYOffset || document.documentElement.scrollTop; document.getElementById("search_query_top").focus(); window.scrollTo(0, top); }, 10); // try{ document.getElementById("quantity_wanted").style.fontSize = "20px"; document.getElementById("group_4").style.fontSize = "20px"; var opt = document.getElementById("group_4").options; for(var Ciclo=0;Ciclo