window.onload = function () {
var map = L.map('map',{
minZoom: 2,
maxZoom:5,
}).setView([38.0, -97.0], 3);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
//the slider bar
$('#button').bind('click', function(){
$('#bar').animate({"width": '200'})
var info = $("
this is where info goes
I will make a 'slide back' option later
")
.appendTo("#bar")
console.log('click')
})
//function chain for drawing the markers and lines on the map.
index = 0
delay = (400+timestamp_list[index])
AddStep(latlong[index], latlong[index+1], index)
function AddMarker(src, index){
var marker = L.marker([src[0], src[1]]).bindPopup(
"Hop no:"+hop_list[index]+"
show metadata
Server name:
"+server_name_list[index]+"
Network owner:
"+asn_list[index]+"
"
);
marker.addTo(map).openPopup()
}
function AddStep(src, dest, index){
var b = new R.BezierAnim([src, dest], {})
map.addLayer(b)
AddMarker(src, index)
processStep(index)
//console.log(delay)
}
function processStep (index) {
map.panTo(latlong[index]);
if (index < counter_max-2) {
//console.log('hop#', hop_list[index])
changeFavicon('js/world/'+country_code_list[index]+'.png')
window.setTimeout(function () {
AddStep(latlong[index], latlong[index+1], index)
}, delay);}
else
if (index < counter_max-1){
//console.log('hop#', hop_list[index])
changeFavicon('js/world/'+country_code_list[index]+'.png')
window.setTimeout(function () {
AddStep(latlong[index], latlong[index], index)
}, delay);}
else
if (index = counter_max-1){
changeFavicon('js/world/'+country_code_list[index]+'.png')
//console.log('fin')
//map.fitBounds([bounds])
}
index = index + 1
delay = (400 + timestamp_list[index])
}
};