mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-23 04:21:24 +01:00
Update main.js
This commit is contained in:
parent
31b253e0a2
commit
d0b6c35d0b
2 changed files with 40 additions and 3 deletions
18
main.js
18
main.js
|
|
@ -197,9 +197,16 @@ if (!location.hostname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideLoading() {
|
function hideLoading() {
|
||||||
|
const queryString = window.location.search;
|
||||||
|
const urlParams = new URLSearchParams(queryString);
|
||||||
|
|
||||||
|
const hideEditor = urlParams.get("hideEditor") ? true : false;
|
||||||
|
|
||||||
d3.select("#loading").transition().duration(4000).style("opacity", 0);
|
d3.select("#loading").transition().duration(4000).style("opacity", 0);
|
||||||
d3.select("#initial").transition().duration(4000).attr("opacity", 0);
|
d3.select("#initial").transition().duration(4000).attr("opacity", 0);
|
||||||
d3.select("#optionsContainer").transition().duration(3000).style("opacity", 1);
|
if (!hideEditor) {
|
||||||
|
d3.select("#optionsContainer").transition().duration(3000).style("opacity", 1);
|
||||||
|
}
|
||||||
d3.select("#tooltip").transition().duration(4000).style("opacity", 1);
|
d3.select("#tooltip").transition().duration(4000).style("opacity", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -438,6 +445,15 @@ function applyDefaultBiomesSystem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showWelcomeMessage() {
|
function showWelcomeMessage() {
|
||||||
|
const queryString = window.location.search;
|
||||||
|
const urlParams = new URLSearchParams(queryString);
|
||||||
|
|
||||||
|
const hideWelcomeMessage = urlParams.get("hideWelcomeMessage");
|
||||||
|
|
||||||
|
if (hideWelcomeMessage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const changelog = link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog", "previous versions");
|
const changelog = link("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog", "previous versions");
|
||||||
const reddit = link("https://www.reddit.com/r/FantasyMapGenerator", "Reddit community");
|
const reddit = link("https://www.reddit.com/r/FantasyMapGenerator", "Reddit community");
|
||||||
const discord = link("https://discordapp.com/invite/X7E84HU", "Discord server");
|
const discord = link("https://discordapp.com/invite/X7E84HU", "Discord server");
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ let presets = {}; // global object
|
||||||
restoreCustomPresets(); // run on-load
|
restoreCustomPresets(); // run on-load
|
||||||
|
|
||||||
function getDefaultPresets() {
|
function getDefaultPresets() {
|
||||||
return {
|
const presets = {
|
||||||
|
geographical: ["toggleBiomes", "toggleIce", "toggleRelief", "toggleRivers", "toggleScaleBar"],
|
||||||
political: ["toggleBorders", "toggleIcons", "toggleIce", "toggleLabels", "toggleRivers", "toggleRoutes", "toggleScaleBar", "toggleStates"],
|
political: ["toggleBorders", "toggleIcons", "toggleIce", "toggleLabels", "toggleRivers", "toggleRoutes", "toggleScaleBar", "toggleStates"],
|
||||||
cultural: ["toggleBorders", "toggleCultures", "toggleIcons", "toggleLabels", "toggleRivers", "toggleRoutes", "toggleScaleBar"],
|
cultural: ["toggleBorders", "toggleCultures", "toggleIcons", "toggleLabels", "toggleRivers", "toggleRoutes", "toggleScaleBar"],
|
||||||
religions: ["toggleBorders", "toggleIcons", "toggleLabels", "toggleReligions", "toggleRivers", "toggleRoutes", "toggleScaleBar"],
|
religions: ["toggleBorders", "toggleIcons", "toggleLabels", "toggleReligions", "toggleRivers", "toggleRoutes", "toggleScaleBar"],
|
||||||
|
|
@ -18,6 +19,16 @@ function getDefaultPresets() {
|
||||||
emblems: ["toggleBorders", "toggleIcons", "toggleIce", "toggleEmblems", "toggleRivers", "toggleRoutes", "toggleScaleBar", "toggleStates"],
|
emblems: ["toggleBorders", "toggleIcons", "toggleIce", "toggleEmblems", "toggleRivers", "toggleRoutes", "toggleScaleBar", "toggleStates"],
|
||||||
landmass: ["toggleScaleBar"]
|
landmass: ["toggleScaleBar"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const queryString = window.location.search;
|
||||||
|
const urlParams = new URLSearchParams(queryString);
|
||||||
|
const urlPreset = urlParams.get("presetLayers") ? urlParams.get("presetLayers").split(',') : undefined;
|
||||||
|
|
||||||
|
if (urlPreset) {
|
||||||
|
presets.url = urlPreset;
|
||||||
|
}
|
||||||
|
|
||||||
|
return presets;
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreCustomPresets() {
|
function restoreCustomPresets() {
|
||||||
|
|
@ -35,7 +46,17 @@ function restoreCustomPresets() {
|
||||||
|
|
||||||
// run on map generation
|
// run on map generation
|
||||||
function applyPreset() {
|
function applyPreset() {
|
||||||
const preset = localStorage.getItem("preset") || document.getElementById("layersPreset").value;
|
const queryString = window.location.search;
|
||||||
|
const urlParams = new URLSearchParams(queryString);
|
||||||
|
|
||||||
|
const layersInUrl = urlParams.get("presetLayers");
|
||||||
|
|
||||||
|
if (layersInUrl) {
|
||||||
|
changePreset('url');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const preset = urlParams.get("preset") || localStorage.getItem("preset") || document.getElementById("layersPreset").value;
|
||||||
changePreset(preset);
|
changePreset(preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue