Widget:PlaceNamesChoropleths: Difference between revisions

From International Robin Hood Bibliography
(Created page with "<noinclude><div class="no-img">This widget displays the navigation map on country and administrative division landing pages in the place-names section of IRHB. It takes no par...")
 
mNo edit summary
Line 1: Line 1:
<noinclude><div class="no-img">This widget displays the navigation map on country and administrative division landing pages in the place-names section of IRHB. It takes no parameters.</div></noinclude><includeonly><div id="navMapNav"></div><script>
<noinclude><div class="no-img">This widget displays the navigation map on country and administrative division landing pages in the place-names section of IRHB. It takes no parameters.</div></noinclude><includeonly><script>
//Utility
//Utility
( function() {
( function() {
Line 369: Line 369:
n.prepareNav = function() {
n.prepareNav = function() {
get("navMapNav").innerHTML = "<a id='nmnOverview'>Overview</a><a id='nmnNav'>Navigation</a><a id='nmnChoro'>Choropleths</a>";
get("nmnOverview").onclick = n.toggleNav;
get("nmnNav").onclick = n.toggleNav;
get("nmnChoro").onclick = n.toggleNav;
var d = get("choroMapLegend2");
var d = get("choroMapLegend2");
d.onclick = selectChoroVar;
d.onclick = selectChoroVar;
Line 383: Line 379:
d.style.color = "#4d8375";
d.style.color = "#4d8375";
d.style.cursor = "pointer";
d.style.cursor = "pointer";
get("navMap").style.backgroundColor = "#f9fafa";
get("choroMap").style.backgroundColor = "#f9fafa";
get("choroMap").style.backgroundColor = "#f9fafa";
};
};
Line 390: Line 385:
n.toggleNav = function() {
n.toggleNav = function() {
var t = event.target.id;
var t = event.target.id;
var selfTarget = false;
if (t === "nmnChoro") {
var mainMap = window.getComputedStyle(get("ctyMapLegend"), null).getPropertyValue("display") === "block" ? true : false;
var navMap = window.getComputedStyle(get("navMapLegend"), null).getPropertyValue("display") === "block" ? true : false;
var choroMap = window.getComputedStyle(get("choroMapLegend"), null).getPropertyValue("display") === "block" ? true : false;
if ((t === "nmnOverview" && mainMap) || (t === "nmnNav" && navMap) || (t === "nmnChoro" && choroMap)) {
selfTarget = true;
}
if (!selfTarget) {
if (t === "nmnOverview") {
get("ctyMapLegend").style.display = "block";
get("map_leaflet_1").style.display = "block";
w.maps.resizeMaps();
maps.leafletList[0].map.invalidateSize();
} else if (t === "nmnNav") {
get("navMap").style.display = "block";
get("navMapLegend").style.display = "block";
} else if (t === "nmnChoro") {
get("choroMapLegend1").innerHTML = choroLegend[n.choroVar].s1;
get("choroMapLegend1").innerHTML = choroLegend[n.choroVar].s1;
get("choroMapLegend2").innerHTML = choroLegend[n.choroVar].s2;
get("choroMapLegend2").innerHTML = choroLegend[n.choroVar].s2;
Line 413: Line 392:
get("choroMapLegend").style.display = "block";
get("choroMapLegend").style.display = "block";
}
}
if (t !== "nmnOverview") {
if (t === "nmnChoro") {
get("ctyMapLegend").style.display = "none";
get("map_leaflet_1").style.display = "none";
}
if (t !== "nmnNav") {
get("navMap").style.display = "none";
get("navMap").innerHTML = "";
get("navMapLegend").style.display = "none";
}
if (t !== "nmnChoro") {
get("choroMap").style.display = "none";
get("choroMap").innerHTML = "";
get("choroMapLegend").style.display = "none";
}
if (t === "nmnNav") {
m.curMap = "navMap";
} else if (t === "nmnChoro") {
m.curMap = "choroMap";
m.curMap = "choroMap";
}
}
if (t !== "nmnOverview") {
m.initMap();
m.initMap();
}
}
};
};



Revision as of 10:34, 2 June 2019

This widget displays the navigation map on country and administrative division landing pages in the place-names section of IRHB. It takes no parameters.