This commit is contained in:
Azgaar 2019-10-19 14:44:56 +03:00
parent a836e066d8
commit 46ebc938e9
4 changed files with 24 additions and 24 deletions

View file

@ -16,10 +16,7 @@
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32"/>
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16"/>
<link rel="canonical" href="https://azgaar.github.io/Fantasy-Map-Generator/">
<link rel="stylesheet" type="text/css" href="index.css?version=1.1.09"/>
<link rel="stylesheet" type="text/css" href="icons.css?version=1.1.09"/>
<link rel="stylesheet" type="text/css" href="libs/jquery-ui.css"/>
<link rel="preload" href="index.css?version=1.1.09" as="style" onload="this.onload=null; this.rel='stylesheet'">
</head>
<body>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="map" width="100%" height="100%">
@ -3225,6 +3222,9 @@
<input type="file" accept=".json" id="styleToLoad">
</div>
<link rel="preload" href="icons.css?version=1.1.09" as="style" onload="this.onload=null; this.rel='stylesheet'">
<link rel="preload" href="libs/jquery-ui.css" as="style" onload="this.onload=null; this.rel='stylesheet'">
<script src="libs/jquery-3.1.1.min.js"></script>
<script src="libs/d3.min.js"></script>
<script src="libs/priority-queue.min.js"></script>

24
main.js
View file

@ -192,8 +192,7 @@ function loadMapFromURL(maplink, random) {
function showUploadErrorMessage(error, URL, random) {
console.error(error);
alertMessage.innerHTML = `
Cannot load map from the <a href='${URL}' target='_blank'>link provided</a>.
alertMessage.innerHTML = `Cannot load map from the ${link(URL, "link provided")}.
${random?`A new random map is generated. `:''}
Please ensure the linked file is reachable and CORS is allowed on server side`;
$("#alert").dialog({title: "Loading error", width: "32em", buttons: {OK: function() {$(this).dialog("close");}}});
@ -316,12 +315,16 @@ function applyDefaultBiomesSystem() {
}
function showWelcomeMessage() {
const link = 'https://www.reddit.com/r/FantasyMapGenerator/comments/daf6g2/update_new_version_is_published_v_11'; // announcement on Reddit
alertMessage.innerHTML = `The Fantasy Map Generator is updated up to version <b>${version}</b>.
This version is compatible with <a href='https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog' target='_blank'>previous version</a>,
loaded <i>.map</i> files will be auto-updated.
const post = link("https://www.reddit.com/r/FantasyMapGenerator/comments/daf6g2/update_new_version_is_published_v_11", "Main changes:"); // announcement on Reddit
const changelog = link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog", "previous version");
const reddit = link("https://www.reddit.com/r/FantasyMapGenerator", "Reddit community");
const discord = link("https://discordapp.com/invite/X7E84HU", "Discord server");
const patreon = link("https://www.patreon.com/azgaar", "Patreon");
<ul><a href=${link} target='_blank'>Main changes:</a>
alertMessage.innerHTML = `The Fantasy Map Generator is updated up to version <b>${version}</b>.
This version is compatible with ${changelog}, loaded <i>.map</i> files will be auto-updated.
<ul>${post}
<li>Lake Editor</li>
<li>Coastline Editor</li>
<li>New lake groups (types)</li>
@ -333,11 +336,8 @@ function showWelcomeMessage() {
<li>Map loading from URL</li>
</ul>
<p>Join our <a href='https://www.reddit.com/r/FantasyMapGenerator' target='_blank'>Reddit community</a> and
<a href='https://discordapp.com/invite/X7E84HU' target='_blank'>Discord server</a>
to ask questions, share maps, discuss the Generator, report bugs and propose new features.</p>
<p>Thanks for all supporters on <a href='https://www.patreon.com/azgaar' target='_blank'>Patreon</a>!</i></p>`;
<p>Join our ${reddit} and ${discord} to ask questions, share maps, discuss the Generator, report bugs and propose new features.</p>
<p>Thanks for all supporters on ${patreon}!</i></p>`;
$("#alert").dialog(
{resizable: false, title: "Fantasy Map Generator update", width: "28em",

View file

@ -268,7 +268,7 @@ async function saveMap() {
// download map data as GeoJSON
function saveGeoJSON() {
alertMessage.innerHTML = `You can export map data in GeoJSON format used in GIS tools such as QGIS.
Check out <a href="https://github.com/Azgaar/Fantasy-Map-Generator/wiki/GIS-data-export" target="_blank">wiki-page</a> for guidance`;
Check out ${link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/GIS-data-export", "wiki-page")} for guidance`;
$("#alert").dialog({title: "GIS data export", resizable: false, width: "32em", position: {my: "center", at: "center", of: "svg"},
buttons: {
@ -497,7 +497,7 @@ function uploadMap(file, callback) {
const mapVersion = data[0].split("|")[0] || data[0];
if (mapVersion === version) {parseLoadedData(data); return;}
const archive = "<a href='https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog' target='_blank'>archived version</a>";
const archive = link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog", "archived version");
const parsed = parseFloat(mapVersion);
let message = "", load = false;
if (isNaN(parsed) || data.length < 26 || !data[5]) {

View file

@ -551,11 +551,6 @@ function parseError(error) {
return errorParsed;
}
// open URL in a new tab or window
function openURL(url) {
window.open(url, '_blank');
}
// polyfills
if (Array.prototype.flat === undefined) {
Array.prototype.flat = function() {
@ -581,9 +576,14 @@ function getAbsolutePath(href) {
return link.href;
}
// open URL in a new tab or window
function openURL(url) {
window.open(url, '_blank');
}
// wrap URL into html a element
function link(URL, description) {
return `<a href="${URL}" target="_blank">${description}</a>`
return `<a href="${URL}" rel="noopener" target="_blank">${description}</a>`
}
// localStorageDB