mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
parent
2e0a74f34d
commit
168656c864
6 changed files with 30 additions and 30 deletions
20
index.html
20
index.html
|
|
@ -2353,8 +2353,8 @@
|
|||
<div id="sticked">
|
||||
<button id="newMapButton" data-tip="Generate a new map based on options" data-shortcut="F2">New Map</button>
|
||||
<button id="exportButton" data-tip="Select format to download image or export map data">Export</button>
|
||||
<button id="saveButton" data-tip="Save fully-functional map in .gz format">Save</button>
|
||||
<button id="loadButton" data-tip="Load fully-functional map (.gz or .map formats)">Load</button>
|
||||
<button id="saveButton" data-tip="Save fully-functional map file">Save</button>
|
||||
<button id="loadButton" data-tip="Load fully-functional map (.map or .gz formats)">Load</button>
|
||||
<button id="zoomReset" data-tip="Reset map zoom" data-shortcut="0 (zero)">Reset Zoom</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -5919,7 +5919,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<p>
|
||||
Maps are saved in <i>.gz</i> format, that can be loaded back via the <i>Load</i> in menu. There is no way to
|
||||
Maps are saved in <i>.map</i> format, that can be loaded back via the <i>Load</i> in menu. There is no way to
|
||||
restore the progress if file is lost. Please keep old save files on your machine or cloud storage as backups.
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -5927,12 +5927,12 @@
|
|||
<div id="loadMapData" style="display: none" class="dialog">
|
||||
<div>
|
||||
<strong>Load map from</strong>
|
||||
<button onclick="mapToLoad.click()" data-tip="Load map file (.gz or .map) from your local disk">
|
||||
<button onclick="mapToLoad.click()" data-tip="Load map file (.map or .gz) from your local disk">
|
||||
machine
|
||||
</button>
|
||||
<button
|
||||
onclick="loadURL()"
|
||||
data-tip="Load map file (.gz or .map) file from URL. Note that the server should allow CORS"
|
||||
data-tip="Load map file (.map or .gz) file from URL. Note that the server should allow CORS"
|
||||
>
|
||||
URL
|
||||
</button>
|
||||
|
|
@ -5955,7 +5955,7 @@
|
|||
|
||||
<select id="loadFromDropboxSelect" style="width: 22em"></select>
|
||||
<div id="loadFromDropboxButtons" style="margin-bottom: 0.6em">
|
||||
<button onclick="loadFromDropbox()" data-tip="Load map file (.gz or .map) from your Dropbox">Load</button>
|
||||
<button onclick="loadFromDropbox()" data-tip="Load map file (.map or .gz) from your Dropbox">Load</button>
|
||||
<button
|
||||
onclick="createSharableDropboxLink()"
|
||||
data-tip="Select file and create a link to share with your friends"
|
||||
|
|
@ -7992,8 +7992,8 @@
|
|||
<script src="modules/ui/stylePresets.js?v=1.89.11"></script>
|
||||
|
||||
<script src="modules/ui/general.js?v=1.93.01"></script>
|
||||
<script src="modules/ui/options.js?v=1.93.00"></script>
|
||||
<script src="main.js?v=1.93.00"></script>
|
||||
<script src="modules/ui/options.js?v=1.93.02"></script>
|
||||
<script src="main.js?v=1.93.02"></script>
|
||||
|
||||
<script defer src="modules/relief-icons.js"></script>
|
||||
<script defer src="modules/ui/style.js"></script>
|
||||
|
|
@ -8034,8 +8034,8 @@
|
|||
<script defer src="modules/coa-renderer.js?v=1.91.00"></script>
|
||||
<script defer src="libs/rgbquant.min.js"></script>
|
||||
<script defer src="libs/jquery.ui.touch-punch.min.js"></script>
|
||||
<script defer src="modules/io/save.js?v=1.93.00"></script>
|
||||
<script defer src="modules/io/load.js?v=1.93.00"></script>
|
||||
<script defer src="modules/io/save.js?v=1.93.02"></script>
|
||||
<script defer src="modules/io/load.js?v=1.93.02"></script>
|
||||
<script defer src="modules/io/cloud.js"></script>
|
||||
<script defer src="modules/io/export.js?v=1.89.36"></script>
|
||||
<script defer src="modules/io/formats.js"></script>
|
||||
|
|
|
|||
4
main.js
4
main.js
|
|
@ -270,7 +270,7 @@ async function checkLoadParameters() {
|
|||
const url = new URL(window.location.href);
|
||||
const params = url.searchParams;
|
||||
|
||||
// of there is a valid maplink, try to load .gz/.map file from URL
|
||||
// of there is a valid maplink, try to load .map/.gz file from URL
|
||||
if (params.get("maplink")) {
|
||||
WARN && console.warn("Load map from URL");
|
||||
const maplink = params.get("maplink");
|
||||
|
|
@ -580,7 +580,7 @@ void (function addDragToUpload() {
|
|||
|
||||
if (!file.name.endsWith(".map") && !file.name.endsWith(".gz")) {
|
||||
alertMessage.innerHTML =
|
||||
"Please upload a map file (<i>.gz</i> or <i>.map</i> formats) you have previously downloaded";
|
||||
"Please upload a map file (<i>.map</i> or <i>.gz</i> formats) you have previously downloaded";
|
||||
$("#alert").dialog({
|
||||
resizable: false,
|
||||
title: "Invalid file format",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"use strict";
|
||||
// Functions to load and parse .gz/.map files
|
||||
// Functions to load and parse .map/.gz files
|
||||
async function quickLoad() {
|
||||
const blob = await ldb.get("lastMap");
|
||||
if (blob) loadMapPrompt(blob);
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ async function saveMap(method) {
|
|||
closeDialogs("#alert");
|
||||
|
||||
try {
|
||||
const compressedMapData = await compressData(prepareMapData());
|
||||
const filename = getFileName() + ".gz";
|
||||
const mapData = prepareMapData();
|
||||
const filename = getFileName() + ".map";
|
||||
|
||||
saveToStorage(compressedMapData, method === "storage"); // any method saves to indexedDB
|
||||
if (method === "machine") saveToMachine(compressedMapData, filename);
|
||||
if (method === "dropbox") saveToDropbox(compressedMapData, filename);
|
||||
saveToStorage(mapData, method === "storage"); // any method saves to indexedDB
|
||||
if (method === "machine") saveToMachine(mapData, filename);
|
||||
if (method === "dropbox") saveToDropbox(mapData, filename);
|
||||
} catch (error) {
|
||||
ERROR && console.error(error);
|
||||
alertMessage.innerHTML = /* html */ `An error is occured on map saving. If the issue persists, please copy the message below and report it on ${link(
|
||||
|
|
@ -153,15 +153,15 @@ function prepareMapData() {
|
|||
}
|
||||
|
||||
// save map file to indexedDB
|
||||
async function saveToStorage(compressedMapData, showTip = false) {
|
||||
const blob = new Blob([compressedMapData], {type: "text/plain"});
|
||||
async function saveToStorage(mapData, showTip = false) {
|
||||
const blob = new Blob([mapData], {type: "text/plain"});
|
||||
await ldb.set("lastMap", blob);
|
||||
showTip && tip("Map is saved to the browser storage", false, "success");
|
||||
}
|
||||
|
||||
// download .gz file
|
||||
function saveToMachine(compressedMapData, filename) {
|
||||
const blob = new Blob([compressedMapData], {type: "text/plain"});
|
||||
// download map file
|
||||
function saveToMachine(mapData, filename) {
|
||||
const blob = new Blob([mapData], {type: "text/plain"});
|
||||
const URL = window.URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement("a");
|
||||
|
|
@ -173,8 +173,8 @@ function saveToMachine(compressedMapData, filename) {
|
|||
window.URL.revokeObjectURL(URL);
|
||||
}
|
||||
|
||||
async function saveToDropbox(compressedMapData, filename) {
|
||||
await Cloud.providers.dropbox.save(filename, compressedMapData);
|
||||
async function saveToDropbox(mapData, filename) {
|
||||
await Cloud.providers.dropbox.save(filename, mapData);
|
||||
tip("Map is saved to your Dropbox", true, "success", 8000);
|
||||
}
|
||||
|
||||
|
|
@ -192,8 +192,8 @@ async function initiateAutosave() {
|
|||
|
||||
try {
|
||||
tip("Autosave: saving map...", false, "warning", 3000);
|
||||
const compressedMapData = await compressData(prepareMapData());
|
||||
await saveToStorage(compressedMapData);
|
||||
const mapData = prepareMapData();
|
||||
await saveToStorage(mapData);
|
||||
tip("Autosave: map is saved", false, "success", 2000);
|
||||
|
||||
lastSavedAt = Date.now();
|
||||
|
|
@ -205,6 +205,7 @@ async function initiateAutosave() {
|
|||
setInterval(autosave, MINUTE / 2);
|
||||
}
|
||||
|
||||
// TODO: unused code
|
||||
async function compressData(uncompressedData) {
|
||||
const compressedStream = new Blob([uncompressedData]).stream().pipeThrough(new CompressionStream("gzip"));
|
||||
|
||||
|
|
|
|||
|
|
@ -845,7 +845,7 @@ async function connectToDropbox() {
|
|||
function loadURL() {
|
||||
const pattern = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
|
||||
const inner = `Provide URL to map file:
|
||||
<input id="mapURL" type="url" style="width: 24em" placeholder="https://e-cloud.com/test.gz">
|
||||
<input id="mapURL" type="url" style="width: 24em" placeholder="https://e-cloud.com/test.map">
|
||||
<br><i>Please note server should allow CORS for file to be loaded. If CORS is not allowed, save file to Dropbox and provide a direct link</i>`;
|
||||
alertMessage.innerHTML = inner;
|
||||
$("#alert").dialog({
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
// version and caching control
|
||||
const version = "1.93.01"; // generator version, update each time
|
||||
const version = "1.93.02"; // generator version, update each time
|
||||
|
||||
{
|
||||
document.title += " v" + version;
|
||||
|
|
@ -29,7 +29,6 @@ const version = "1.93.01"; // generator version, update each time
|
|||
<ul>
|
||||
<strong>Latest changes:</strong>
|
||||
<li>Auto-load of the last saved map is now optional (see <i>Onload behavior</i> in Options)</li>
|
||||
<li>Save files compression (file extension is changed to <i>.gz</i>). Old <i>.map</i> files are still supported</li>
|
||||
<li>New label placement algorithm for states</li>
|
||||
<li>North and South Poles temperature can be set independently</li>
|
||||
<li>More than 70 new heraldic charges</li>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue