Widget:Test1: Difference between revisions

From International Robin Hood Bibliography
mNo edit summary
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><div id="navMapNav"></div><script>
//Utility
//Test --> Template:Test --> Widget:Test1
//TRY THIS FIRST: https://bl.ocks.org/mbostock/1014829
//RequestIdleCallback:
//https://developers.google.com/web/updates/2015/08/using-requestidlecallback?hl=en
//https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback
//Utility
//Utility
( function() {
( function() {
Line 233: Line 242:
var w = window.IRHB;
var w = window.IRHB;
w.map = {};
w.map = {};
var m = w.map, u = w.utility, d = w.data, get = w.get;
var m = w.map, u = w.utility, d = w.data;
var tooltip, features, zoom, tooltipOffset;
var tooltip, features, zoom, tooltipOffset;
m.curMap = false;
m.curMap = false;
Line 250: Line 259:
tooltip = d3.select("body").append("div").attr("class","ttip");
tooltip = d3.select("body").append("div").attr("class","ttip");
d3.xml("/wiki/geo/england/country/England.svg",function(error,geodata) {
d3.xml("/wiki/geo/england/country/England.svg",function(error,geodata) {
//d3.json("/wiki/geo/england/country/England.json",function(error,geodata) {
if (!error) {
if (!error) {
features.selectAll("path").data(geodata.features).enter().append("path").attr("d",path).on("mouseover",showTooltip).on("mousemove",moveTooltip).on("mouseout",hideTooltip).on("click",clicked);
features.selectAll("path").data(geodata.features).enter().append("path").attr("d",path).on("mouseover",showTooltip).on("mousemove",moveTooltip).on("mouseout",hideTooltip).on("click",clicked);
if (m.curMap === "navMap" || m.curMap === "choroMap") {
//if (m.curMap === "navMap" || m.curMap === "choroMap") {
w.choro.choropleth();
w.choro.choropleth();
}
//}
if (mp.childNodes.length > 1) {
if (mp.childNodes.length > 1) {
mp.removeChild(mp.childNodes[0]);
mp.removeChild(mp.childNodes[0]);
Line 269: Line 277:
m.initMap = function() {
m.initMap = function() {
//addSpinner(get(m.curMap));
d.calcStats();
d.calcStats();
};
};

Revision as of 16:16, 22 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.