"use strict"; // version and caching control const version = "1.96.07"; // generator version, update each time { document.title += " v" + version; const loadingScreenVersion = document.getElementById("versionText"); if (loadingScreenVersion) loadingScreenVersion.innerText = `v${version}`; const versionNumber = parseFloat(version); const storedVersion = localStorage.getItem("version") ? parseFloat(localStorage.getItem("version")) : 0; const isOutdated = storedVersion !== versionNumber; if (isOutdated) clearCache(); const showUpdate = storedVersion < versionNumber; if (showUpdate) setTimeout(showUpdateWindow, 6000); function showUpdateWindow() { const changelog = "https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog"; const reddit = "https://www.reddit.com/r/FantasyMapGenerator"; const discord = "https://discordapp.com/invite/X7E84HU"; const patreon = "https://www.patreon.com/azgaar"; alertMessage.innerHTML = /* html */ `The Fantasy Map Generator is updated up to version ${version}. This version is compatible with previous versions, loaded save files will be auto-updated. ${storedVersion ? "Reload the page to fetch fresh code." : ""}
Join our Discord server and Reddit community to ask questions, share maps, discuss the Generator and Worlbuilding, report bugs and propose new features.
Thanks for all supporters on Patreon!`; const buttons = { Ok: function () { $(this).dialog("close"); if (storedVersion) localStorage.clear(); localStorage.setItem("version", version); } }; if (storedVersion) { buttons.Reload = () => { localStorage.clear(); localStorage.setItem("version", version); location.reload(); }; } $("#alert").dialog({ resizable: false, title: "Fantasy Map Generator update", width: "28em", position: {my: "center center-4em", at: "center", of: "svg"}, buttons }); } async function clearCache() { const cacheNames = await caches.keys(); Promise.all(cacheNames.map(cacheName => caches.delete(cacheName))); } }