minor js tweak; would not have been a blocker issue
This commit is contained in:
parent
97095eeaba
commit
76d79c5e53
1 changed files with 29 additions and 7 deletions
|
@ -5,6 +5,7 @@ $(document).ready(function(){
|
||||||
var globalMapBuilt = false;
|
var globalMapBuilt = false;
|
||||||
var countryMapBuilt = false;
|
var countryMapBuilt = false;
|
||||||
var localMapBuilt = false;
|
var localMapBuilt = false;
|
||||||
|
var legendIsVisible = false;
|
||||||
var researchAreas = { "type": "FeatureCollection", "features": []};
|
var researchAreas = { "type": "FeatureCollection", "features": []};
|
||||||
var geoResearcherCount = "0";
|
var geoResearcherCount = "0";
|
||||||
|
|
||||||
|
@ -412,13 +413,15 @@ $(document).ready(function(){
|
||||||
|
|
||||||
function getResearcherCount(area) {
|
function getResearcherCount(area) {
|
||||||
|
|
||||||
|
var localResearcherCount = 0;
|
||||||
var areaCount = 0;
|
var areaCount = 0;
|
||||||
|
var displayCount = "";
|
||||||
var text = "";
|
var text = "";
|
||||||
if ( area == "global" ) {
|
if ( area == "global" ) {
|
||||||
text = " " + i18nStrings.countriesAndRegions;
|
text = " " + i18nStrings.countriesAndRegions;
|
||||||
}
|
}
|
||||||
else if ( area == "country" ) {
|
else if ( area == "country" ) {
|
||||||
text = " " + i18nStrings.stateString;
|
text = " " + i18nStrings.statesString;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
text = " " + i18nStrings.statewideLocations;
|
text = " " + i18nStrings.statewideLocations;
|
||||||
|
@ -426,6 +429,7 @@ $(document).ready(function(){
|
||||||
|
|
||||||
$.each(researchAreas.features, function() {
|
$.each(researchAreas.features, function() {
|
||||||
if ( this.properties.mapType == area ) {
|
if ( this.properties.mapType == area ) {
|
||||||
|
localResearcherCount = localResearcherCount + this.properties.html ;
|
||||||
areaCount = areaCount + 1;
|
areaCount = areaCount + 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -433,27 +437,45 @@ $(document).ready(function(){
|
||||||
if ( areaCount == 1 && text == " states.") {
|
if ( areaCount == 1 && text == " states.") {
|
||||||
text = " " + i18nStrings.stateString;
|
text = " " + i18nStrings.stateString;
|
||||||
}
|
}
|
||||||
if ( geoResearcherCount == 1 ) {
|
|
||||||
researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString;
|
if ( area == "global" ) {
|
||||||
|
if ( geoResearcherCount == 1 ) {
|
||||||
|
researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
researcherText = " " + i18nStrings.researchersString + " " + i18nStrings.inString;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayCount = geoResearcherCount;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
researcherText = " " + i18nStrings.researchersString
|
if ( localResearcherCount == 1 ) {
|
||||||
|
researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
researcherText = " " + i18nStrings.researchersString + " " + i18nStrings.inString;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayCount = localResearcherCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('div#researcherTotal').html("<font style='font-size:1.05em;color:#167093'>"
|
$('div#researcherTotal').html("<font style='font-size:1.05em;color:#167093'>"
|
||||||
+ geoResearcherCount
|
+ displayCount
|
||||||
+ "</font> " + researcherText + " <font style='font-size:1.05em;color:#167093'>"
|
+ "</font> " + researcherText + " <font style='font-size:1.05em;color:#167093'>"
|
||||||
+ areaCount + "</font>" + text);
|
+ areaCount + "</font>" + text);
|
||||||
}
|
}
|
||||||
function appendLegendToLeafletContainer() {
|
function appendLegendToLeafletContainer() {
|
||||||
var htmlString = "<div class='leaflet-bottom leaflet-left' style='padding:0 0 8px 12px'><ul><li>"
|
if ( !this.legendIsVisible ) {
|
||||||
|
var htmlString = "<div class='leaflet-bottom leaflet-left' style='padding:0 0 8px 12px'><ul><li>"
|
||||||
+ "<img alt='" + i18nStrings.regionsString + "' src='" + urlsBase
|
+ "<img alt='" + i18nStrings.regionsString + "' src='" + urlsBase
|
||||||
+ "/images/map_legend_countries.png' style='margin-right:5px'><font style='color:#555'>"
|
+ "/images/map_legend_countries.png' style='margin-right:5px'><font style='color:#555'>"
|
||||||
+ i18nStrings.countriesString + "</font></li><li><img alt='" + i18nStrings.regionsString
|
+ i18nStrings.countriesString + "</font></li><li><img alt='" + i18nStrings.regionsString
|
||||||
+ "' src='" + urlsBase
|
+ "' src='" + urlsBase
|
||||||
+ "/images/map_legend_regions.png' style='margin-right:5px'><font style='color:#555'>"
|
+ "/images/map_legend_regions.png' style='margin-right:5px'><font style='color:#555'>"
|
||||||
+ i18nStrings.regionsString + "</font></li></ul></div>";
|
+ i18nStrings.regionsString + "</font></li></ul></div>";
|
||||||
$('div.leaflet-control-container').append(htmlString);
|
$('div.leaflet-control-container').append(htmlString);
|
||||||
|
this.legendIsVisible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue