updated screenshot filename to add the date and time
This commit is contained in:
parent
faaeb2633b
commit
a8c87ec87e
13
index.html
13
index.html
@ -67,11 +67,22 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
// make a screenshot
|
// make a screenshot
|
||||||
$("#screen").click(function() {
|
$("#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'), {
|
html2canvas(document.getElementById('poem'), {
|
||||||
scale: 3
|
scale: 3
|
||||||
}).then(function(canvas) {
|
}).then(function(canvas) {
|
||||||
canvas.toBlob(function(blob) {
|
canvas.toBlob(function(blob) {
|
||||||
window.saveAs(blob, "yourwebsite_screenshot.png");
|
window.saveAs(blob, fileName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}); // screen button click
|
}); // screen button click
|
||||||
|
Loading…
x
Reference in New Issue
Block a user