mypastebin/static/js/remove-gps.js
2025-05-29 22:40:58 +02:00

36 lines
1.1 KiB
JavaScript

function removeGPSMetadata(pasteId) {
fetch(`/paste/${pasteId}/remove_gps`, {
method: "POST",
headers: {
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(data => {
if (data.success) {
showToast("GPS data removed successfully!", "bg-success");
// Ocultar el botón de "Remove GPS Data"
let gpsButton = document.getElementById("gps-button");
if (gpsButton) {
gpsButton.style.display = "none";
}
// Recargar la imagen sin caché para reflejar los cambios
setTimeout(() => {
let img = document.getElementById('original-image');
if (img) {
img.src = img.src.split("?")[0] + "?t=" + new Date().getTime(); // Agrega un timestamp
}
}, 1500);
} else {
showToast("Error removing GPS data.", "bg-danger");
}
})
.catch(err => {
console.error(err);
showToast("Error removing GPS data.", "bg-danger");
});
}