2013-04-30 14:46:22 -04:00
|
|
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
|
|
|
var globalMapBuilt = false;
|
2013-07-03 14:00:56 -04:00
|
|
|
var countryMapBuilt = false;
|
|
|
|
var localMapBuilt = false;
|
2013-04-30 14:46:22 -04:00
|
|
|
var researchAreas = { "type": "FeatureCollection", "features": []};
|
2013-11-04 14:45:43 -05:00
|
|
|
var geoResearcherCount = "0";
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
$.extend(this, urlsBase);
|
2013-06-07 11:59:14 -04:00
|
|
|
$.extend(this, i18nStrings);
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-11-04 14:45:43 -05:00
|
|
|
getGeoFocusResearcherCount();
|
2013-11-25 12:50:13 -05:00
|
|
|
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
$('a#globalLink').click(function() {
|
|
|
|
buildGlobalMap();
|
|
|
|
$(this).addClass("selected");
|
2013-07-03 14:00:56 -04:00
|
|
|
$('a#countryLink').removeClass("selected");
|
2013-04-30 14:46:22 -04:00
|
|
|
$('a#nyLink').removeClass("selected");
|
|
|
|
});
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
$('a#countryLink').click(function() {
|
|
|
|
buildCountryMap();
|
2013-04-30 14:46:22 -04:00
|
|
|
$(this).addClass("selected");
|
|
|
|
$('a#globalLink').removeClass("selected");
|
|
|
|
$('a#nyLink').removeClass("selected");
|
|
|
|
});
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
$('a#localLink').click(function() {
|
|
|
|
buildLocalMap();
|
2013-04-30 14:46:22 -04:00
|
|
|
$(this).addClass("selected");
|
2013-07-03 14:00:56 -04:00
|
|
|
$('a#countryLink').removeClass("selected");
|
2013-04-30 14:46:22 -04:00
|
|
|
$('a#globalLink').removeClass("selected");
|
|
|
|
});
|
|
|
|
|
2013-11-19 16:22:29 -05:00
|
|
|
function getLatLong(localName,popup) {
|
2013-04-30 14:46:22 -04:00
|
|
|
var lat = [];
|
2013-11-25 12:50:13 -05:00
|
|
|
jQuery.map(latLongJson, function (json) {
|
2013-11-19 16:22:29 -05:00
|
|
|
if ( json.local == localName) {
|
2013-04-30 14:46:22 -04:00
|
|
|
lat.push(json.data["longitude"]);
|
|
|
|
lat.push(json.data["latitude"]);
|
|
|
|
}
|
|
|
|
});
|
2013-11-19 16:22:29 -05:00
|
|
|
if (lat.length == 0) {
|
2013-11-25 12:50:13 -05:00
|
|
|
jQuery.map(latLongJson, function (json) {
|
2013-11-19 16:22:29 -05:00
|
|
|
if ( json.name == popup) {
|
|
|
|
lat.push(json.data["longitude"]);
|
|
|
|
lat.push(json.data["latitude"]);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2013-04-30 14:46:22 -04:00
|
|
|
if (lat.length == 0) {
|
|
|
|
lat.push(0.0);
|
|
|
|
lat.push(0.0);
|
|
|
|
}
|
|
|
|
return(lat);
|
|
|
|
}
|
|
|
|
|
2013-11-19 16:22:29 -05:00
|
|
|
function getMapType(localName,popup) {
|
2013-04-30 14:46:22 -04:00
|
|
|
var mt = "";
|
2013-11-25 12:50:13 -05:00
|
|
|
jQuery.map(latLongJson, function (json) {
|
2013-11-19 16:22:29 -05:00
|
|
|
if ( json.local == localName) {
|
2013-04-30 14:46:22 -04:00
|
|
|
mt = json.data["mapType"];
|
|
|
|
}
|
|
|
|
});
|
2013-11-19 16:22:29 -05:00
|
|
|
if ( mt.length == 0 ) {
|
2013-11-25 12:50:13 -05:00
|
|
|
jQuery.map(latLongJson, function (json) {
|
2013-11-19 16:22:29 -05:00
|
|
|
if ( json.name == popup) {
|
|
|
|
mt = json.data["mapType"];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2013-04-30 14:46:22 -04:00
|
|
|
return(mt);
|
|
|
|
}
|
|
|
|
|
2013-11-19 16:22:29 -05:00
|
|
|
function getGeoClass(localName,popup) {
|
2013-06-14 10:51:26 -04:00
|
|
|
var gc = "";
|
2013-11-25 12:50:13 -05:00
|
|
|
jQuery.map(latLongJson, function (json) {
|
2013-11-19 16:22:29 -05:00
|
|
|
if ( json.local == localName) {
|
2013-06-14 10:51:26 -04:00
|
|
|
gc = json.data["geoClass"];
|
|
|
|
}
|
|
|
|
});
|
2013-11-19 16:22:29 -05:00
|
|
|
if ( gc.length == 0 ) {
|
2013-11-25 12:50:13 -05:00
|
|
|
jQuery.map(latLongJson, function (json) {
|
2013-11-19 16:22:29 -05:00
|
|
|
if ( json.name == popup) {
|
|
|
|
gc = json.data["geoClass"];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2013-06-14 10:51:26 -04:00
|
|
|
return(gc);
|
|
|
|
}
|
|
|
|
|
2013-04-30 14:46:22 -04:00
|
|
|
function onEachFeature(feature, layer) {
|
|
|
|
var popupContent = "";
|
|
|
|
var uri = "";
|
|
|
|
|
|
|
|
if (feature.properties && feature.properties.popupContent) {
|
|
|
|
popupContent += feature.properties.popupContent;
|
|
|
|
}
|
|
|
|
if (feature.properties && feature.properties.html) {
|
|
|
|
if ( feature.properties.html == "1") {
|
2013-06-07 11:59:14 -04:00
|
|
|
popupContent += ": " + feature.properties.html + " " + i18nStrings.researcherString;
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
|
|
|
else {
|
2013-06-07 11:59:14 -04:00
|
|
|
popupContent += ": " + feature.properties.html + " " + i18nStrings.researchersString;
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
layer.on('mouseover', function(e) {
|
|
|
|
e.target.bindPopup(popupContent,{closeButton:false}).openPopup();
|
|
|
|
});
|
|
|
|
layer.on('mouseout', function(e) {
|
|
|
|
e.target.closePopup();
|
|
|
|
});
|
|
|
|
|
|
|
|
if (feature.properties && feature.properties.uri) {
|
|
|
|
uri += feature.properties.uri;
|
|
|
|
layer.on('click', function(e) {
|
|
|
|
document.location.href = urlsBase + "/individual?uri=" + uri + "&#map";
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getDivIcon(feature) {
|
|
|
|
var htmlContent = "";
|
|
|
|
var myIcon;
|
|
|
|
|
|
|
|
if (feature.properties && feature.properties.html) {
|
|
|
|
htmlContent += feature.properties.html;
|
|
|
|
}
|
|
|
|
if ( htmlContent > 99 ) {
|
|
|
|
myIcon = L.divIcon({className: 'divIconCountPlus', html: htmlContent});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
myIcon = L.divIcon({className: 'divIconCount', html: htmlContent});
|
|
|
|
}
|
|
|
|
return myIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getMarkerRadius(feature) {
|
|
|
|
var radiusContent;
|
|
|
|
|
|
|
|
if (feature.properties && feature.properties.radius) {
|
|
|
|
radiusContent = feature.properties.radius;
|
|
|
|
}
|
|
|
|
return radiusContent;
|
|
|
|
}
|
|
|
|
|
2013-06-14 10:51:26 -04:00
|
|
|
function getMarkerFillColor(feature) {
|
|
|
|
var geoClass = "";
|
|
|
|
var fillColor;
|
|
|
|
|
|
|
|
if (feature.properties && feature.properties.radius) {
|
|
|
|
geoClass = feature.properties.geoClass;
|
|
|
|
}
|
|
|
|
if ( geoClass == "region") {
|
|
|
|
fillColor = "#abf7f8";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fillColor = "#fdf9cd"
|
|
|
|
}
|
|
|
|
return fillColor;
|
|
|
|
}
|
|
|
|
|
2013-04-30 14:46:22 -04:00
|
|
|
function checkGlobalCoordinates(feature, layer) {
|
|
|
|
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
|
|
|
var mt = feature.properties.mapType;
|
|
|
|
if ( !theLatLng.equals([0,0]) && mt == "global" ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
function checkCountryCoordinates(feature, layer) {
|
2013-04-30 14:46:22 -04:00
|
|
|
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
|
|
|
var mt = feature.properties.mapType;
|
2013-07-03 14:00:56 -04:00
|
|
|
if ( !theLatLng.equals([0,0]) && mt == "country" ) {
|
2013-04-30 14:46:22 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
function checkLocalCoordinates(feature, layer) {
|
2013-04-30 14:46:22 -04:00
|
|
|
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
|
|
|
|
var mt = feature.properties.mapType;
|
2013-07-03 14:00:56 -04:00
|
|
|
if ( !theLatLng.equals([0,0]) && mt == "local" ) {
|
2013-04-30 14:46:22 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildGlobalMap() {
|
|
|
|
$('div#mapGlobal').show();
|
2013-07-03 14:00:56 -04:00
|
|
|
$('div#mapCountry').hide();
|
|
|
|
$('div#mapLocal').hide();
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
if ( !globalMapBuilt ) {
|
|
|
|
|
|
|
|
var mapGlobal = L.map('mapGlobal').setView([25.25, 23.20], 2);
|
2013-07-03 14:00:56 -04:00
|
|
|
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
|
|
|
maxZoom: 12,
|
|
|
|
minZoom: 1,
|
|
|
|
boxZoom: false,
|
|
|
|
doubleClickZoom: false,
|
|
|
|
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
2013-04-30 14:46:22 -04:00
|
|
|
}).addTo(mapGlobal);
|
|
|
|
|
|
|
|
L.geoJson(researchAreas, {
|
|
|
|
|
|
|
|
filter: checkGlobalCoordinates,
|
|
|
|
onEachFeature: onEachFeature,
|
|
|
|
|
|
|
|
pointToLayer: function(feature, latlng) {
|
|
|
|
return L.circleMarker(latlng, {
|
|
|
|
radius: getMarkerRadius(feature),
|
2013-06-14 10:51:26 -04:00
|
|
|
fillColor: getMarkerFillColor(feature),
|
2013-04-30 14:46:22 -04:00
|
|
|
color: "none",
|
|
|
|
weight: 1,
|
|
|
|
opacity: 0.8,
|
|
|
|
fillOpacity: 0.8
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}).addTo(mapGlobal);
|
|
|
|
|
|
|
|
L.geoJson(researchAreas, {
|
|
|
|
|
|
|
|
filter: checkGlobalCoordinates,
|
|
|
|
onEachFeature: onEachFeature,
|
|
|
|
|
|
|
|
pointToLayer: function(feature, latlng) {
|
|
|
|
return L.marker(latlng, {
|
|
|
|
icon: getDivIcon(feature)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}).addTo(mapGlobal);
|
|
|
|
|
|
|
|
globalMapBuilt = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
getResearcherCount("global");
|
2013-06-14 10:51:26 -04:00
|
|
|
appendLegendToLeafletContainer();
|
2013-07-03 14:00:56 -04:00
|
|
|
}
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
function buildCountryMap() {
|
2013-04-30 14:46:22 -04:00
|
|
|
$('div#mapGlobal').hide();
|
2013-07-03 14:00:56 -04:00
|
|
|
$('div#mapLocal').hide();
|
|
|
|
$('div#mapCountry').show();
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
if ( !countryMapBuilt ) {
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
// CHANGE THE setView COORDINATES SO THAT THE COUNTRY YOU WANT TO
|
|
|
|
// DISPLAY IS CENTERED CORRECTLY. THE COORDINATES BELOW CENTERS THE MAP ON THE U.S.
|
|
|
|
var mapCountry = L.map('mapCountry').setView([46.0, -97.0], 3);
|
|
|
|
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
2013-04-30 14:46:22 -04:00
|
|
|
maxZoom: 30,
|
|
|
|
minZoom: 1,
|
|
|
|
boxZoom: false,
|
|
|
|
zIndex: 1,
|
|
|
|
doubleClickZoom: false,
|
|
|
|
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
2013-07-03 14:00:56 -04:00
|
|
|
}).addTo(mapCountry);
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
L.geoJson(researchAreas, {
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
filter: checkCountryCoordinates,
|
2013-04-30 14:46:22 -04:00
|
|
|
onEachFeature: onEachFeature,
|
|
|
|
|
|
|
|
pointToLayer: function(feature, latlng) {
|
|
|
|
return L.circleMarker(latlng, {
|
|
|
|
radius: getMarkerRadius(feature),
|
|
|
|
fillColor: "#fdf9cd", //fdf38a",
|
|
|
|
color: "none",
|
|
|
|
weight: 1,
|
|
|
|
opacity: 0.8,
|
|
|
|
fillOpacity: 0.8
|
|
|
|
});
|
|
|
|
}
|
2013-07-03 14:00:56 -04:00
|
|
|
}).addTo(mapCountry);
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
L.geoJson(researchAreas, {
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
filter: checkCountryCoordinates,
|
2013-04-30 14:46:22 -04:00
|
|
|
onEachFeature: onEachFeature,
|
|
|
|
|
|
|
|
pointToLayer: function(feature, latlng) {
|
|
|
|
return L.marker(latlng, {
|
|
|
|
icon: getDivIcon(feature)
|
|
|
|
});
|
|
|
|
}
|
2013-07-03 14:00:56 -04:00
|
|
|
}).addTo(mapCountry);
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
countryMapBuilt = true;
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
getResearcherCount("country");
|
|
|
|
}
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
function buildLocalMap() {
|
2013-04-30 14:46:22 -04:00
|
|
|
$('div#mapGlobal').hide();
|
2013-07-03 14:00:56 -04:00
|
|
|
$('div#mapCountry').hide();
|
|
|
|
$('div#mapLocal').show();
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
if ( !localMapBuilt ) {
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
// CHANGE THE setView COORDINATES SO THAT THE LOCAL AREA (E.G. A STATE OR PROVINCE) YOU WANT TO
|
|
|
|
// DISPLAY IS CENTERED CORRECTLY. THE COORDINATES BELOW CENTERS THE MAP ON NEW YORK STATE.
|
|
|
|
var mapLocal = L.map('mapLocal').setView([42.83, -75.50], 7);
|
|
|
|
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
2013-04-30 14:46:22 -04:00
|
|
|
maxZoom: 12,
|
|
|
|
minZoom: 1,
|
|
|
|
boxZoom: false,
|
|
|
|
doubleClickZoom: false,
|
|
|
|
attribution: 'Tiles © <a href="http://www.esri.com/">Esri</a>'
|
2013-07-03 14:00:56 -04:00
|
|
|
}).addTo(mapLocal);
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile\/{z}\/{y}\/{x}.png', {
|
|
|
|
maxZoom: 12,
|
|
|
|
minZoom: 1,
|
|
|
|
boxZoom: false,
|
|
|
|
doubleClickZoom: false
|
2013-07-03 14:00:56 -04:00
|
|
|
}).addTo(mapLocal);
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
L.geoJson(researchAreas, {
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
filter: checkLocalCoordinates,
|
2013-04-30 14:46:22 -04:00
|
|
|
onEachFeature: onEachFeature,
|
|
|
|
|
|
|
|
pointToLayer: function(feature, latlng) {
|
|
|
|
return L.circleMarker(latlng, {
|
|
|
|
radius: getMarkerRadius(feature) + 3,
|
|
|
|
fillColor: "#fdf9cd",
|
|
|
|
color: "none",
|
|
|
|
weight: 1,
|
|
|
|
opacity: 0.8,
|
|
|
|
fillOpacity: 0.8
|
|
|
|
});
|
|
|
|
}
|
2013-07-03 14:00:56 -04:00
|
|
|
}).addTo(mapLocal);
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
L.geoJson(researchAreas, {
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
filter: checkLocalCoordinates,
|
2013-04-30 14:46:22 -04:00
|
|
|
onEachFeature: onEachFeature,
|
|
|
|
|
|
|
|
pointToLayer: function(feature, latlng) {
|
|
|
|
return L.marker(latlng, {
|
|
|
|
icon: getDivIcon(feature)
|
|
|
|
});
|
|
|
|
}
|
2013-07-03 14:00:56 -04:00
|
|
|
}).addTo(mapLocal);
|
2013-04-30 14:46:22 -04:00
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
localMapBuilt = true;
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
|
|
|
|
2013-07-03 14:00:56 -04:00
|
|
|
getResearcherCount("local");
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function getGeoJsonForMaps() {
|
|
|
|
$.ajax({
|
|
|
|
url: urlsBase + "/homePageAjax",
|
|
|
|
dataType: "json",
|
|
|
|
data: {
|
|
|
|
action: "getGeoFocusLocations",
|
|
|
|
},
|
|
|
|
complete: function(xhr, status) {
|
2013-05-02 12:34:18 -04:00
|
|
|
var results = $.parseJSON(xhr.responseText);
|
|
|
|
if ( results.length == 0 ) {
|
2013-06-07 11:59:14 -04:00
|
|
|
var html = i18nStrings.currentlyNoResearchers;
|
2013-07-16 10:04:33 -04:00
|
|
|
$('section#home-geo-focus div#timeIndicatorGeo span').html(html);
|
2013-05-02 12:34:18 -04:00
|
|
|
$('section#home-geo-focus').css("height","175px");
|
2013-12-04 15:26:09 -05:00
|
|
|
$('section#home-geo-focus div#timeIndicatorGeo').css("margin-top","50px");
|
2013-05-02 12:34:18 -04:00
|
|
|
$('section#home-geo-focus div#mapGlobal').hide();
|
2013-07-03 14:00:56 -04:00
|
|
|
$('section#home-geo-focus div#mapCountry').hide();
|
|
|
|
$('section#home-geo-focus div#mapLocal').hide();
|
2013-12-04 15:26:09 -05:00
|
|
|
$('section#home-geo-focus div#mapControls').hide();
|
2013-05-02 12:34:18 -04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$.each(results, function() {
|
2013-11-19 16:22:29 -05:00
|
|
|
var popup = this.properties.popupContent;
|
|
|
|
var localName = this.properties.local;
|
|
|
|
this.geometry.coordinates = getLatLong(localName,popup);
|
|
|
|
this.properties.mapType = getMapType(localName,popup);
|
|
|
|
this.properties.geoClass = getGeoClass(localName,popup);
|
2013-05-02 12:34:18 -04:00
|
|
|
researchAreas["features"].push(this);
|
|
|
|
});
|
|
|
|
buildGlobalMap();
|
2013-05-14 12:51:50 -04:00
|
|
|
$('div#timeIndicatorGeo').hide();
|
2013-05-02 12:34:18 -04:00
|
|
|
}
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-11-04 14:45:43 -05:00
|
|
|
function getGeoFocusResearcherCount() {
|
|
|
|
$.ajax({
|
|
|
|
url: urlsBase + "/homePageAjax",
|
|
|
|
dataType: "json",
|
|
|
|
data: {
|
|
|
|
action: "getGeoFocusResearcherCount",
|
|
|
|
},
|
|
|
|
complete: function(xhr, status) {
|
|
|
|
|
|
|
|
var results = $.parseJSON(xhr.responseText);
|
|
|
|
// there will only ever be one key/value pair
|
|
|
|
if ( results != null ) {
|
|
|
|
geoResearcherCount = results.count;
|
|
|
|
}
|
2013-11-25 12:50:13 -05:00
|
|
|
getGeoJsonForMaps();
|
2013-11-04 14:45:43 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-04-30 14:46:22 -04:00
|
|
|
function getResearcherCount(area) {
|
|
|
|
|
|
|
|
var areaCount = 0;
|
|
|
|
var text = "";
|
|
|
|
if ( area == "global" ) {
|
2013-06-07 11:59:14 -04:00
|
|
|
text = " " + i18nStrings.countriesAndRegions;
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
2013-07-03 14:00:56 -04:00
|
|
|
else if ( area == "country" ) {
|
2013-06-07 11:59:14 -04:00
|
|
|
text = " " + i18nStrings.stateString;
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
|
|
|
else {
|
2013-06-07 11:59:14 -04:00
|
|
|
text = " " + i18nStrings.statewideLocations;
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
$.each(researchAreas.features, function() {
|
|
|
|
if ( this.properties.mapType == area ) {
|
|
|
|
areaCount = areaCount + 1;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( areaCount == 1 && text == " states.") {
|
2013-06-07 11:59:14 -04:00
|
|
|
text = " " + i18nStrings.stateString;
|
2013-04-30 14:46:22 -04:00
|
|
|
}
|
2013-11-04 14:45:43 -05:00
|
|
|
if ( geoResearcherCount == 1 ) {
|
2013-08-23 16:27:10 -04:00
|
|
|
researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString;
|
|
|
|
}
|
|
|
|
else {
|
2013-10-07 11:36:06 -04:00
|
|
|
researcherText = " " + i18nStrings.researchersString
|
2013-08-23 16:27:10 -04:00
|
|
|
}
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
$('div#researcherTotal').html("<font style='font-size:1.05em;color:#167093'>"
|
2013-11-04 14:45:43 -05:00
|
|
|
+ geoResearcherCount
|
2013-08-23 16:27:10 -04:00
|
|
|
+ "</font> " + researcherText + " <font style='font-size:1.05em;color:#167093'>"
|
2013-04-30 14:46:22 -04:00
|
|
|
+ areaCount + "</font>" + text);
|
|
|
|
}
|
2013-06-14 10:51:26 -04:00
|
|
|
function appendLegendToLeafletContainer() {
|
|
|
|
var htmlString = "<div class='leaflet-bottom leaflet-left' style='padding:0 0 8px 12px'><ul><li>"
|
|
|
|
+ "<img alt='" + i18nStrings.regionsString + "' src='" + urlsBase
|
|
|
|
+ "/images/map_legend_countries.png' style='margin-right:5px'><font style='color:#555'>"
|
|
|
|
+ i18nStrings.countriesString + "</font></li><li><img alt='" + i18nStrings.regionsString
|
|
|
|
+ "' src='" + urlsBase
|
|
|
|
+ "/images/map_legend_regions.png' style='margin-right:5px'><font style='color:#555'>"
|
|
|
|
+ i18nStrings.regionsString + "</font></li></ul></div>";
|
|
|
|
$('div.leaflet-control-container').append(htmlString);
|
2013-07-03 14:00:56 -04:00
|
|
|
}
|
2013-04-30 14:46:22 -04:00
|
|
|
|
|
|
|
});
|