Actualizar index.html

This commit is contained in:
2026-05-17 20:37:11 +00:00
parent 6d816e1a67
commit 8ca8d57bb4

View File

@@ -89,8 +89,9 @@
<div onclick="openProtectionPlan()" class="relative cursor-pointer rounded-[2rem] overflow-hidden shadow-[0_12px_30px_rgba(15,23,42,0.18)] active:scale-[0.98] transition-all duration-300"> <div onclick="openProtectionPlan()" class="relative cursor-pointer rounded-[2rem] overflow-hidden shadow-[0_12px_30px_rgba(15,23,42,0.18)] active:scale-[0.98] transition-all duration-300">
<img <img
id="promoBannerImg"
src="img/banner-proteccion.jpg" src="img/banner-proteccion.jpg"
alt="Plan Protección Eléctrica" alt="Publicidad"
class="w-full h-auto block" class="w-full h-auto block"
> >
@@ -413,7 +414,7 @@
} }
function openProtectionPlan() { function openProtectionPlan() {
window.location.href = `plan-tranquilidad.html?token=${urlToken}`; window.location.href = `https://portal.integrarepara.es/publi.html`;
} }
function closeProtectionBanner() { function closeProtectionBanner() {
@@ -429,12 +430,20 @@ function closeProtectionBanner() {
function initProtectionBanner(subscription) { function initProtectionBanner(subscription) {
const banner = document.getElementById('promo-banner'); const banner = document.getElementById('promo-banner');
const bannerImg = document.getElementById('promoBannerImg');
if (!banner) return; if (!banner) return;
const wasClosed = localStorage.getItem(`promo_closed_${urlToken}`) === 'true'; // Si la empresa subió una imagen desde configuración, la aplicamos
const isPlanPage = window.location.pathname.includes('plan-tranquilidad'); const customAd = globalCompanyData?.company_ad || globalCompanyData?.ad;
if (customAd && bannerImg) {
bannerImg.src = customAd;
}
if (!subscription && !wasClosed && !isPlanPage) { const wasClosed = localStorage.getItem(`promo_closed_${urlToken}`) === 'true';
const isPlanPage = window.location.pathname.includes('publi.html');
// Mostramos el banner si no lo ha cerrado manualmente
if (!wasClosed && !isPlanPage) {
banner.classList.remove('hidden'); banner.classList.remove('hidden');
} else { } else {
banner.classList.add('hidden'); banner.classList.add('hidden');