Widget:PlaceNamesNavigationMapEnglish: Difference between revisions

From International Robin Hood Bibliography
mNo edit summary
mNo edit summary
Line 30: Line 30:
d.counties = {
d.counties = {
'Bedfordshire': {
'Bedfordshire': {
'path': 0
'path': 1
},
},
'Berkshire': {
'Berkshire': {
'path': 0
'path': 2
},
},
'Buckinghamshire': {
'Buckinghamshire': {
'path': 0
'path': 3
},
},
'Cambridgeshire': {
'Cambridgeshire': {
'path': 0
'path': 4
},
},
'Cheshire': {
'Cheshire': {
'path': 0
'path': 5
},
},
'Cornwall': {
'Cornwall': {
'path': 0
'path': 6
},
},
'Cumberland': {
'Cumberland': {
Line 51: Line 51:
},
},
'Derbyshire': {
'Derbyshire': {
'path': 0
'path': 7
},
},
'Devon': {
'Devon': {
'path': 0
'path': 8
},
},
'Dorset': {
'Dorset': {
'path': 0
'path': 9
},
},
'Durham': {
'Durham': {
'path': 0
'path': 10
},
},
'Essex': {
'Essex': {
'path': 0
'path': 11
},
},
'Gloucestershire': {
'Gloucestershire': {
'path': 0
'path': 12
},
},
'Hampshire': {
'Hampshire': {
'path': 0
'path': 13
},
},
'Herefordshire': {
'Herefordshire': {
'path': 0
'path': 14
},
},
'Hertfordshire': {
'Hertfordshire': {
'path': 0
'path': 15
},
},
'Huntingdonshire': {
'Huntingdonshire': {
'path': 0
'path': 16
},
},
'Kent': {
'Kent': {
'path': 0
'path': 17
},
},
'Lancashire': {
'Lancashire': {
'path': 0
'path': 18
},
},
'Leicestershire': {
'Leicestershire': {
'path': 0
'path': 19
},
},
'Lincolnshire': {
'Lincolnshire': {
'path': 0
'path': 20
},
},
'Middlesex': {
'Middlesex': {
'path': 0
'path': 21
},
},
'Norfolk': {
'Norfolk': {
'path': 0
'path': 22
},
},
'Northamptonshire': {
'Northamptonshire': {
'path': 0
'path': 23
},
},
'Northumberland': {
'Northumberland': {
'path': 0
'path': 24
},
},
'Nottinghamshire': {
'Nottinghamshire': {
'path': 0
'path': 25
},
},
'Oxfordshire': {
'Oxfordshire': {
'path': 0
'path': 38
},
},
'Rutland': {
'Rutland': {
'path': 0
'path': 26
},
},
'Shropshire': {
'Shropshire': {
'path': 0
'path': 27
},
},
'Somerset': {
'Somerset': {
'path': 0
'path': 28
},
},
'Staffordshire': {
'Staffordshire': {
'path': 0
'path': 29
},
},
'Suffolk': {
'Suffolk': {
'path': 0
'path': 30
},
},
'Surrey': {
'Surrey': {
'path': 0
'path': 31
},
},
'Sussex': {
'Sussex': {
'path': 0
'path': 32
},
},
'Warwickshire': {
'Warwickshire': {
'path': 0
'path': 33
},
},
'Westmorland': {
'Westmorland': {
'path': 0
'path': 34
},
},
'Wiltshire': {
'Wiltshire': {
'path': 0
'path': 35
},
},
'Worcestershire': {
'Worcestershire': {
'path': 0
'path': 36
},
},
'Yorkshire': {
'Yorkshire': {
'path': 0
'path': 37
}
}
};
};
Line 167: Line 167:
d.calcStats = function() {
d.calcStats = function() {
var counties;
var placeNames;
var url = "https://www.irhb.org/wiki/api.php?action=ask&query=[[Concept:English%20counties%20with%20place-names]]|?Area|?Population&format=json";
var url = "https://www.irhb.org/wiki/api.php?action=ask&query=[[Concept: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);
counties = jsnCty;
url = "https://www.irhb.org/wiki/api.php?action=ask&query=[[Concept:English%20place-names]]|?Pntype|?Pnadmdiv|sort=Pnadmdiv&format=json";
url = "https://www.irhb.org/wiki/api.php?action=ask&query=[[Concept:English%20place-names]]|?Pntype|?Pnadmdiv|sort=Pnadmdiv&format=json";
fetch(url).then(res => res.json()).then((jsnPN) => {
fetch(url).then(res => res.json()).then((jsnPN) => {
  placeNames = jsnPN;
  calcPlaceNames(jsnPN);
  calcPlaceNames(jsnPN);
  console.log(d.counties);
  console.log(d.counties);
Line 202: Line 198:
var paths = u.get("choroMap").firstChild.firstChild.getElementsByTagName("path");
var paths = u.get("choroMap").firstChild.firstChild.getElementsByTagName("path");
paths[d.counties.Cumberland.path].style.fill = "#000000";
paths[d.counties.Cumberland.path].style.fill = "#000000";
 
paths[1].style.fill = "#123001";
paths[2].style.fill = "#123002";
paths[3].style.fill = "#123003";
paths[4].style.fill = "#123004";
paths[5].style.fill = "#123005";
paths[6].style.fill = "#123006";
paths[7].style.fill = "#123007";
paths[8].style.fill = "#123008";
paths[9].style.fill = "#123009";
paths[10].style.fill = "#123010";
paths[11].style.fill = "#123011";
paths[12].style.fill = "#123012";
paths[13].style.fill = "#123013";
paths[14].style.fill = "#123014";
paths[15].style.fill = "#123015";
paths[16].style.fill = "#123016";
paths[17].style.fill = "#123017";
paths[18].style.fill = "#123018";
paths[19].style.fill = "#123019";
paths[20].style.fill = "#123020";
paths[21].style.fill = "#123021";
paths[22].style.fill = "#123022";
paths[23].style.fill = "#123023";
paths[24].style.fill = "#123024";
paths[25].style.fill = "#123025";
paths[26].style.fill = "#123026";
paths[27].style.fill = "#123027";
paths[28].style.fill = "#123028";
paths[29].style.fill = "#123029";
paths[30].style.fill = "#123030";
paths[31].style.fill = "#123031";
paths[32].style.fill = "#123032";
paths[33].style.fill = "#123033";
paths[34].style.fill = "#123034";
paths[35].style.fill = "#123035";
paths[36].style.fill = "#123036";
paths[37].style.fill = "#123037";
paths[38].style.fill = "#123038";
d.calcStats();
d.calcStats();
};
};

Revision as of 17:13, 17 May 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.