summaryrefslogtreecommitdiff
path: root/site/media/js/photos.js
diff options
context:
space:
mode:
Diffstat (limited to 'site/media/js/photos.js')
-rw-r--r--site/media/js/photos.js73
1 files changed, 22 insertions, 51 deletions
diff --git a/site/media/js/photos.js b/site/media/js/photos.js
index 32e262f..1331b0e 100644
--- a/site/media/js/photos.js
+++ b/site/media/js/photos.js
@@ -1,48 +1,19 @@
//Utility functions for map info window
-function mapit(latlontitle) {
- lat = parseFloat(latlontitle.split(',')[0]);
- lon = parseFloat(latlontitle.split(',')[1]);
- //title= latlontitle.split(',')[2];
- elid= latlontitle.split(',')[2];
- centerCoord = new google.maps.LatLng(lat, lon);
- var mapitinit;
- if (mapitinit == true) {
- mapPanTo();
- } else {
- mapInit();
- }
-
- function mapInit() {
- var mapOptions = {
- zoom: 8,
- center: centerCoord,
- disableDefaultUI: true,
- navigationControl: true,
- mapTypeId: google.maps.MapTypeId.TERRAIN,
- navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}
- };
- map = new google.maps.Map(document.getElementById("mw-"+elid), mapOptions);
- var marker = new google.maps.Marker({
- position: centerCoord,
- map: map
- //title: title
- });
- mapitinit = true;
- }
- function mapPanTo(){
- var marker = new google.maps.Marker({
- position: centerCoord,
- map: map
- //title: title
- });
- map.panTo(centerCoord);
- }
-}
-
-//########## utility functions to create/remove map container ############
+function mapit(obj) {
+ lat = parseFloat(obj.attr('data-latitude'));
+ lon = parseFloat(obj.attr('data-longitude'));
+ elid= obj.attr('data-imgid');
+ map = L.map(document.getElementById("mw-"+elid));
+ centerCoord = new L.LatLng(lat, lon);
+ zoom = 8;
+ L.tileLayer.provider('Esri.WorldTopoMap', {maxZoom: 18, attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Tiles © Esri and the GIS User Community'}).addTo(map);
+ map.setView(centerCoord, zoom);
+ L.marker([lat, lon]).addTo(map);
+}
+ //########## utility functions to create/remove map container ############
function create_map(obj) {
//find id of this image caption:
- imgid = obj.title.split(',')[2];
+ var imgid = obj.attr('data-imgid');
//create container divs
$('<div class="map-container" id="mc-'+imgid+'">').insertBefore($(obj).parent().parent());
//$(obj).parent().parent().parent().prepend('<div class="map-container" id="mc-'+imgid+'">');
@@ -54,7 +25,7 @@ function create_map(obj) {
}
});
- mapit(obj.title);
+ mapit(obj);
}
function remove_map(imgid) {
$('#mc-'+imgid).remove();
@@ -65,31 +36,31 @@ $(document).ready(function(){
//set up click events for map button
$('.map-link').click( function() {
- imgid = this.title.split(',')[2];
+ imgid = $(this).attr('data-imgid');
if ($('#mc-'+imgid).is(":visible")) {
remove_map(imgid);
} else {
- create_map(this);
+ create_map($(this));
}
return false;
});
- var $ele = $('#slides').children()
- var $curr = 0
+ var $ele = $('#slides').children();
+ var $curr = 0;
$(document).bind('keydown', function (e) {
var code = e.which;
switch (code) {
case 39:
if ($curr <= $ele.size()) {
$.scrollTo($ele[$curr], 800 );
- $curr++
+ $curr++;
}
break;
case 37:
if ($curr > 0) {
- $curr--
- var $now = $curr
- $now--
+ $curr--;
+ var $now = $curr;
+ $now--;
$.scrollTo($ele[$now], 800 );
}
break;