updated screenshot filename to add the date and time

This commit is contained in:
Jacob Haddon 2024-03-12 21:47:28 -04:00
parent faaeb2633b
commit a8c87ec87e

View File

@ -67,11 +67,22 @@ $(document).ready(function(){
// make a screenshot
$("#screen").click(function() {
// get the date and format the filename
const today = new Date(Date.now());
let day = today.getDate();
let month = today.getMonth() + 1;
let year = today.getFullYear();
let minutes = today.getMinutes();
let hours = today.getHours();
let fileName = "dbpc_" + year + "_" + month + "_" + day + "_" + hours +"-" + minutes + ".png";
// make the screenshot
html2canvas(document.getElementById('poem'), {
scale: 3
}).then(function(canvas) {
canvas.toBlob(function(blob) {
window.saveAs(blob, "yourwebsite_screenshot.png");
window.saveAs(blob, fileName);
});
});
}); // screen button click