From ed878bfc46df42c56d13fb6f235f9e7f63a64d61 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Mon, 19 Oct 2015 22:57:41 +0700 Subject: + RSS, basic classes --- web/map.js | 182 ------------------------------------------------------------- 1 file changed, 182 deletions(-) delete mode 100644 web/map.js (limited to 'web/map.js') diff --git a/web/map.js b/web/map.js deleted file mode 100644 index 4359727f..00000000 --- a/web/map.js +++ /dev/null @@ -1,182 +0,0 @@ -var map; -var mc; -var icon=new GIcon(G_DEFAULT_ICON,"http://maps.google.com/mapfiles/marker_orange.png"); - -function mapInit() { - var lat=getHashVar("lat"); - var lon=getHashVar("lon"); - var zoom=getHashVar("zoom"); - if(!lat || !lon || !zoom) { - lat=readCookie("lat"); - lon=readCookie("lon"); - zoom=readCookie("zoom"); - if(!lat || !lon || !zoom) { - lat=30; - lon=0; - zoom=2; - } - else { - lat=parseFloat(lat); - lon=parseFloat(lon); - zoom=parseInt(zoom); - } - } else { - lat=parseFloat(lat); - lon=parseFloat(lon); - zoom=parseInt(zoom); - } - - map=new GMap2(document.getElementById("geomap")); - map.setCenter(new GLatLng(lat,lon),zoom,G_HYBRID_MAP); - map.addControl(new GMapTypeControl()); - map.enableScrollWheelZoom(); - map.addControl(new GLargeMapControl(),new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(-10,-60))); - - mc=new MarkerClusterer(map,null,{ - gridSize:40, - maxZoom:15 - }); - - GEvent.addListener(map,"moveend",mapLoadMarkers); - GEvent.addListener(map,"zoomend",mapLoadMarkers); - - mapLoadMarkers(); -} - -function mapLoadMarkers() { - var mapcenter=map.getCenter(); - var lat=Math.round(mapcenter.lat()*100000)/100000; - var lon=Math.round(mapcenter.lng()*100000)/100000; - window.location.hash.replace("#lat="+lat+"&lon="+lon+"&zoom="+map.getZoom()); - writeCookie("lat",lat,365,"/map"); - writeCookie("lon",lon,365,"/map"); - writeCookie("zoom",map.getZoom(),365,"/map"); - - var bounds=map.getBounds(); - var swlat=bounds.getSouthWest().lat(); - if(swlat<-90) swlat=-90; - var swlng=bounds.getSouthWest().lng(); - if(swlng<-180) swlng=-180; - - var nelat=bounds.getNorthEast().lat(); - if(nelat>90) nelat=90; - var nelng=bounds.getNorthEast().lng(); - if(nelng>180) nelng=180; - - if(nelng'+json[i].name+''; - places.appendChild(li); - } - } - mc.clearMarkers(); - mc.addMarkers(markers); -} - -function mapParseMessages(json) { - var msgs=document.getElementById("messages"); - while(msgs.hasChildNodes()) msgs.removeChild(msgs.lastChild); - for(var i=0; i@'+json[i].user.uname+':'; - if(json[i].tags) - for(var n=0; n*'+json[i].tags[n]+''; - ihtml+='
'; - if(json[i].location) - ihtml+='Location: '+json[i].location.name+'
'; - if(json[i].photo) - ihtml+='Attachment: Photo
'; - if(json[i].video) - ihtml+='Attachment: Video
'; - ihtml+=json[i].body+'
'; - - var li=document.createElement("li"); - li.className='liav'; - li.style.backgroundImage='url(http://i.juick.com/as/'+json[i].user.uid+'.png)'; - li.innerHTML=ihtml; - msgs.appendChild(li); - } -} - -function createMarker(id,latlng,title,href,icon) { - var marker=new GMarker(latlng,{ - 'icon':icon, - 'title':title - }); - marker.param=id; - if(href && href!="") - GEvent.addListener(marker,"click",function(ll) { - var txt=''+title+''; - map.openInfoWindowHtml(ll,txt); - }); - return marker; -} - -function getHashVar(variable) { - var query=window.location.hash.substring(1); - var vars=query.split("&"); - for(var i=0; i