lablanca.js 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. function expand(year){
  2. console.log('Expanding ' + year);
  3. }
  4. function expandDay(id){
  5. if (document.getElementById('day_schedule_' + id).style.maxHeight != '' && document.getElementById('day_schedule_' + id).style.maxHeight != '0em'){
  6. document.getElementById('day_schedule_' + id).style.maxHeight = '0em';
  7. setTimeout(function(){document.getElementById('slid_day_' + id).src = '/img/misc/slid-right.png';}, 500);
  8. }
  9. else{
  10. document.getElementById('day_schedule_' + id).style.maxHeight = 'initial';
  11. setTimeout(function(){document.getElementById('slid_day_' + id).src = '/img/misc/slid-down.png';}, 500);
  12. }
  13. document.getElementById('slid_day_' + id).style.opacity = '0';
  14. setTimeout(function(){document.getElementById('slid_day_' + id).style.opacity = '1';}, 500);
  15. }
  16. function hideMap(){
  17. document.getElementById('map').innerHTML = "";
  18. document.getElementById('map_container').style.opacity = 0;
  19. document.getElementById('map_container').style.display = 'none';
  20. }
  21. function showMap(title){
  22. document.getElementById('map_container').style.display = 'block';
  23. document.getElementById('map_container').style.opacity = 1;
  24. document.getElementById('map_title').innerHTML = title;
  25. }
  26. function showMapRoute(route, title, format, lat = 42.846484, lon = -2.673625, zoom = 15){
  27. showMap(title);
  28. var map;
  29. map = new OpenLayers.Map ("map", {
  30. //controls:[
  31. //new OpenLayers.Control.Navigation(),
  32. //new OpenLayers.Control.PanZoomBar(),
  33. //new OpenLayers.Control.LayerSwitcher(),
  34. //new OpenLayers.Control.Attribution()],
  35. maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
  36. maxResolution: 156543.0399,
  37. numZoomLevels: 19,
  38. units: 'm',
  39. projection: new OpenLayers.Projection("EPSG:900913"),
  40. displayProjection: new OpenLayers.Projection("EPSG:4326")
  41. });
  42. map.addLayer(new OpenLayers.Layer.OSM());
  43. var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
  44. map.setCenter (lonLat, zoom);
  45. if (format == "osm"){
  46. // Add the layer with the osm route.
  47. var layer = new OpenLayers.Layer.Vector(title, {
  48. strategies: [new OpenLayers.Strategy.Fixed()],
  49. protocol: new OpenLayers.Protocol.HTTP({
  50. url: "/osm/" + route + ".xml",
  51. format: new OpenLayers.Format.OSM()
  52. }),
  53. style: {strokeColor: "green", strokeWidth: 10, strokeOpacity: 0.8},
  54. projection: new OpenLayers.Projection("EPSG:4326")
  55. });
  56. map.addLayers([layer]);
  57. }
  58. else if (format == "gpx"){
  59. // Add the Layer with the GPX Track
  60. var layer = new OpenLayers.Layer.Vector(title, {
  61. strategies: [new OpenLayers.Strategy.Fixed()],
  62. protocol: new OpenLayers.Protocol.HTTP({
  63. url: "/gpx/" + route + ".gpx",
  64. format: new OpenLayers.Format.GPX()
  65. }),
  66. style: {strokeColor: "green", strokeWidth: 10, strokeOpacity: 0.8},
  67. projection: new OpenLayers.Projection("EPSG:4326")
  68. });
  69. map.addLayer(layer);
  70. }
  71. }
  72. function showMapPoint(lat, lon, title){
  73. showMap(title);
  74. var map = new OpenLayers.Map("map");
  75. map.addLayer(new OpenLayers.Layer.OSM());
  76. var lonLat = new OpenLayers.LonLat(lon ,lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
  77. var zoom = 16;
  78. var markers = new OpenLayers.Layer.Markers(title);
  79. map.addLayer(markers);
  80. markers.addMarker(new OpenLayers.Marker(lonLat));
  81. map.setCenter (lonLat, zoom);
  82. }