more tests share button

This commit is contained in:
David Itehua Xalamihua 2025-05-03 17:08:07 -06:00
parent 396df4293f
commit 5d7c2c551e
3 changed files with 17 additions and 2 deletions

View File

@ -59,4 +59,5 @@
.fb { background: #1877f2; }
.tw { background: #000000; }
.in { background: #0077b5; }
.copy { background: #444; }
.copy { background: #444; }
.wa { background-color: #25D366; }

View File

@ -55,3 +55,17 @@ if (btn_x) {
openShareWindow(xShareUrl);
});
}
// compartir por whatsapp
// WhatsApp
const btn_wa = document.querySelector("button.wa");
if (btn_wa) {
btn_wa.addEventListener("click", () => {
const whatsappText = encodeURIComponent("Mira este post interesante:");
const whatsappUrl = `https://api.whatsapp.com/send?text=${whatsappText}%20${encode_url('wa')}`;
openShareWindow(whatsappUrl);
});
}

View File

@ -11,7 +11,6 @@
{% block body %}
{{data}}
<div class="pst-cont">
<h1>{{data[5]}}</h1>
@ -33,6 +32,7 @@
<button href="#" class="share__button tw"><i class="bi bi-twitter-x"></i></button>
<button class="share__button in"><i class="bi bi-linkedin"></i></button>
<button class="share__button copy"><i class="bi bi-link-45deg"></i></button>
<button class="share__button wa"><i class="bi bi-whatsapp"></i></button>
</div>
</div>