diff --git a/modules/ui/biomes-editor.js b/modules/ui/biomes-editor.js
index fb048044..ca5bb41d 100644
--- a/modules/ui/biomes-editor.js
+++ b/modules/ui/biomes-editor.js
@@ -94,10 +94,14 @@ function editBiomes() {
lines += `
-
+
%
-
+
${b.cells[i]}
@@ -189,41 +193,27 @@ function editBiomes() {
}
function openWiki(el) {
- const name = el.parentNode.dataset.name;
- if (name === "Custom" || !name) {
- tip("Please provide a biome name", false, "error");
- return;
- }
- const wiki = "https://en.wikipedia.org/wiki/";
+ const biomeName = el.parentNode.dataset.name;
+ if (biomeName === "Custom" || !biomeName) return tip("Please fill in the biome name", false, "error");
- switch (name) {
- case "Hot desert":
- openURL(wiki + "Desert_climate#Hot_desert_climates");
- case "Cold desert":
- openURL(wiki + "Desert_climate#Cold_desert_climates");
- case "Savanna":
- openURL(wiki + "Tropical_and_subtropical_grasslands,_savannas,_and_shrublands");
- case "Grassland":
- openURL(wiki + "Temperate_grasslands,_savannas,_and_shrublands");
- case "Tropical seasonal forest":
- openURL(wiki + "Seasonal_tropical_forest");
- case "Temperate deciduous forest":
- openURL(wiki + "Temperate_deciduous_forest");
- case "Tropical rainforest":
- openURL(wiki + "Tropical_rainforest");
- case "Temperate rainforest":
- openURL(wiki + "Temperate_rainforest");
- case "Taiga":
- openURL(wiki + "Taiga");
- case "Tundra":
- openURL(wiki + "Tundra");
- case "Glacier":
- openURL(wiki + "Glacier");
- case "Wetland":
- openURL(wiki + "Wetland");
- default:
- openURL(`https://en.wikipedia.org/w/index.php?search=${name}`);
- }
+ const wikiBase = "https://en.wikipedia.org/wiki/";
+ const pages = {
+ "Hot desert": "Desert_climate#Hot_desert_climates",
+ "Cold desert": "Desert_climate#Cold_desert_climates",
+ Savanna: "Tropical_and_subtropical_grasslands,_savannas,_and_shrublands",
+ Grassland: "Temperate_grasslands,_savannas,_and_shrublands",
+ "Tropical seasonal forest": "Seasonal_tropical_forest",
+ "Temperate deciduous forest": "Temperate_deciduous_forest",
+ "Tropical rainforest": "Tropical_rainforest",
+ "Temperate rainforest": "Temperate_rainforest",
+ Taiga: "Taiga",
+ Tundra: "Tundra",
+ Glacier: "Glacier",
+ Wetland: "Wetland"
+ };
+ const customBiomeLink = `https://en.wikipedia.org/w/index.php?search=${biomeName}`;
+ const link = pages[biomeName] ? wikiBase + pages[biomeName] : customBiomeLink;
+ openURL(link);
}
function toggleLegend() {
@@ -343,7 +333,11 @@ function editBiomes() {
$("#biomesEditor").dialog({position: {my: "right top", at: "right-10 top+10", of: "svg"}});
tip("Click on biome to select, drag the circle to change biome", true);
- viewbox.style("cursor", "crosshair").on("click", selectBiomeOnMapClick).call(d3.drag().on("start", dragBiomeBrush)).on("touchmove mousemove", moveBiomeBrush);
+ viewbox
+ .style("cursor", "crosshair")
+ .on("click", selectBiomeOnMapClick)
+ .call(d3.drag().on("start", dragBiomeBrush))
+ .on("touchmove mousemove", moveBiomeBrush);
}
function selectBiomeOnLineClick(line) {