Widget:PlaceNamesNavigationMapEnglish: Difference between revisions
From International Robin Hood Bibliography
mNo edit summary |
mNo edit summary |
||
Line 155: | Line 155: | ||
if (!d.stats) { | if (!d.stats) { | ||
w.map.addSpinner(get(w.map.curMap)); | w.map.addSpinner(get(w.map.curMap)); | ||
var url = " | var url = "/wiki/api.php?action=ask&query=[[Category:English%20counties%20with%20place-names]]|?Area|?Population&format=json"; | ||
fetch(url).then(res => res.json()).then((jsnCty) => { | fetch(url).then(res => res.json()).then((jsnCty) => { | ||
calcCounties(jsnCty); | calcCounties(jsnCty); | ||
url = " | url = "/wiki/api.php?action=ask&query=[[Category:English%20place-names]]|?Pninterest|?Pnadmdiv|sort=Pnadmdiv&format=json"; | ||
fetch(url).then(res => res.json()).then((jsnPN) => { | fetch(url).then(res => res.json()).then((jsnPN) => { | ||
calcPlaceNames(jsnPN); | calcPlaceNames(jsnPN); | ||
Line 190: | Line 190: | ||
var svg = mp.childNodes.length > 1 ? mp.firstChild.nextSibling.firstChild : mp.firstChild.firstChild; | var svg = mp.childNodes.length > 1 ? mp.firstChild.nextSibling.firstChild : mp.firstChild.firstChild; | ||
var paths = svg.getElementsByTagName("path"); | var paths = svg.getElementsByTagName("path"); | ||
if (curMap | var props = { "count": "totalcol", "area": "pnperkm2col", "areaPop": "pnperkm2popcol" }; | ||
if (curMap !== "navMap") { | |||
for (var key in d.counties) { | for (var key in d.counties) { | ||
var cur = d.counties[key]; | var cur = d.counties[key]; | ||
paths[cur.path].style. | paths[ cur.path ].style.fill = cur[ props[ w.nav.choroVar ] ]; | ||
} | } | ||
} | } | ||
Line 252: | Line 233: | ||
m.prepareMap = function() { | m.prepareMap = function() { | ||
var mp = get(m.curMap); | var mp = get(m.curMap); | ||
var width = | var width = "500px", height = "550px"; | ||
var projection = d3.geo.conicEqualArea() | var projection = d3.geo.conicEqualArea() | ||
.scale(5165.269352442655).center([-1.4602454263940616,52.55675714793008]) | .scale(5165.269352442655).center([-1.4602454263940616,52.55675714793008]) | ||
Line 291: | Line 272: | ||
m.addSpinner = function (elem) { | m.addSpinner = function (elem) { | ||
var svg = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" xml:space="preserve">'; | var svg = '<svg xmlns="http://www.w3.org/2000/svg" xml:id="spinner" id="spinner" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" xml:space="preserve">'; | ||
svg += '<path stroke="none !important" d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">'; | svg += '<path stroke="none !important" d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">'; | ||
svg += '<animateTransform attributeName="transform" attributeType="XML" type="rotate" dur="2s" from="0 50 50" to="360 50 50" repeatCount="indefinite"/>'; | svg += '<animateTransform attributeName="transform" attributeType="XML" type="rotate" dur="2s" from="0 50 50" to="360 50 50" repeatCount="indefinite"/>'; | ||
Line 397: | Line 378: | ||
get("map_leaflet_1").style.display = "block"; | get("map_leaflet_1").style.display = "block"; | ||
w.maps.resizeMaps(); | w.maps.resizeMaps(); | ||
maps.leafletList[0].map.invalidateSize(); | //NOW CAUSES A BUG AND FOR SOME REASON IS NO LONGER NEEDED: maps.leafletList[0].map.invalidateSize(); | ||
} else if (t === "nmnNav") { | } else if (t === "nmnNav") { | ||
get("navMap").style.display = "block"; | get("navMap").style.display = "block"; | ||
Line 441: | Line 422: | ||
var w = window.IRHB; | var w = window.IRHB; | ||
var gjson = " | var gjson = "/wiki/geo/england/country/England.json"; | ||
var script = document.createElement('script'); | var script = document.createElement('script'); | ||
script.type = 'text/javascript'; | script.type = 'text/javascript'; | ||
script.src = " | script.src = "/wiki/js/d3js/d3.v3.min.js"; | ||
script.onload = w.nav.prepareNav; | script.onload = w.nav.prepareNav; | ||
document.head.appendChild(script); | document.head.appendChild(script); | ||
}());</script><p style="display:none;"></includeonly> | }());</script><p style="display:none;"></includeonly> |
Revision as of 00:35, 26 April 2020
This widget displays the navigation map on country and administrative division landing pages in the place-names section of IRHB. It takes no parameters.