Buenas tardes. ¿Alguien sabe qué cambios tendría que hacer en este código para que el botón Whatsapp se mostrase durante las 24 horas y no de 7 de la mañana a 15 horas como ocurre ahora? Mi web es
www.gamalux.es (Prestashop) GRACIAS
{
let $ = jQuery;
console.log("whatsapp 2.7");
let abierto;
function compruebaHorario(){
var fecha = new Date();
var diaSemana = fecha.getDay();
var hora = fecha.getHours();
console.log("dia semana: " + diaSemana);
if(diaSemana < 6){
if( hora > 7 && hora < 22){
abierto = 1;
}
}
}
compruebaHorario();
if(abierto){
$( "body" ).append( "<div class='whatsapp sticky' data-phone='34644953031' data-action='contact' data-text=''></div>" );
$(".whatsapp").click(function(e){
var action = e.target.dataset["action"];
if (action == "share"){
var text = e.target.dataset["text"];
var url = window.location.href; //sharing_url;
var message = encodeURIComponent(text) + "-" + encodeURIComponent(url);
if($(window).width()>768){
var whatsapp_url = "
https://web.whatsapp.com/send?text=" + message;
}else{
var whatsapp_url = "
https://api.whatsapp.com/send?text=" + message;
}
}
if (action == "contact"){
var phone = e.target.dataset["phone"];
if($(window).width()>768){
var whatsapp_url = "
https://web.whatsapp.com/send?phone=" + phone;
}else{
var whatsapp_url = "
https://api.whatsapp.com/send?phone=" + phone;
}
}
//window.location.href = whatsapp_url;
window.open(whatsapp_url, '_blank');
});
}
}