mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 10:01:23 +01:00
Implement improved save functionality with custom filename, timestamp toggle, and overwrite protection
Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>
This commit is contained in:
parent
ba837ab6f8
commit
df15f74d95
4 changed files with 113 additions and 18 deletions
|
|
@ -892,10 +892,15 @@ function unfog(id) {
|
|||
if (!defs.selectAll("#fog path").size()) fogging.style("display", "none");
|
||||
}
|
||||
|
||||
function getFileName(dataType) {
|
||||
function getFileName(dataType, customName = null, includeTimestamp = true) {
|
||||
const formatTime = time => (time < 10 ? "0" + time : time);
|
||||
const name = mapName.value;
|
||||
const name = customName || mapName.value;
|
||||
const type = dataType ? dataType + " " : "";
|
||||
|
||||
if (!includeTimestamp) {
|
||||
return name + (type ? " " + type.trim() : "");
|
||||
}
|
||||
|
||||
const date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = formatTime(date.getMonth() + 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue