MediaWiki:InciskinMobile/JS/Inciclopedia:20 años de Inciclopedia/quizMobile/6.js
Ir a la navegación
Ir a la búsqueda
Nota: Después de publicar, quizás necesite actualizar la caché de su navegador para ver los cambios.
- Firefox/Safari: Mantenga presionada la tecla Shift mientras pulsa el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
- Google Chrome: presione Ctrl+Shift+R (⌘+Shift+R en Mac)
- Internet Explorer/Edge: mantenga presionada Ctrl mientras pulsa Actualizar, o presione Ctrl+F5
- Opera: Presiona Ctrl+F5.
// Abrir y cerrar pop-up
document.getElementById("shareBtn").onclick = function() {
document.getElementById("sharePopup").style.display = "block";
};
document.getElementById("closePopup").onclick = function() {
document.getElementById("sharePopup").style.display = "none";
};
// Funciones de compartir
document.getElementById("copyBtn").onclick = function() {
const text = window.location.href;
navigator.clipboard.writeText(text).then(() => {
alert("Enlace copiado al portapapeles");
});
};
document.getElementById("facebookBtn").onclick = function() {
const url = encodeURIComponent(window.location.href);
window.open("https://www.facebook.com/sharer/sharer.php?u=" + url, "_blank");
};
document.getElementById("twitterBtn").onclick = function() {
const url = encodeURIComponent(window.location.href);
window.open("https://twitter.com/intent/tweet?url=" + url, "_blank");
};
document.getElementById("emailBtn").onclick = function() {
const subject = encodeURIComponent("Mira esta imagen");
const body = encodeURIComponent("Te comparto este enlace: " + window.location.href);
window.location.href = "mailto:?subject=" + subject + "&body=" + body;
};
$(function () {
$('.mw-download-div').on('click', function () {
const enlace = document.createElement('a');
enlace.href = $(this).data('href'); // URL desde atributo data-href
enlace.download = $(this).data('file') || '';
document.body.appendChild(enlace);
enlace.click();
document.body.removeChild(enlace);
});
});