summaryrefslogtreecommitdiff
path: root/plugins/Mapstraction/usermap-mxn-openlayers.min.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Mapstraction/usermap-mxn-openlayers.min.js')
-rw-r--r--plugins/Mapstraction/usermap-mxn-openlayers.min.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/plugins/Mapstraction/usermap-mxn-openlayers.min.js b/plugins/Mapstraction/usermap-mxn-openlayers.min.js
new file mode 100644
index 000000000..6f55fa6c6
--- /dev/null
+++ b/plugins/Mapstraction/usermap-mxn-openlayers.min.js
@@ -0,0 +1 @@
+(function(){var h=null;var e="core";var b;var a=document.getElementsByTagName("script");for(var f=0;f<a.length;f++){var d=a[f].src.replace(/%20/g,"").match(/^(.*?)mxn\.js(\?\(\[?(.*?)\]?\))?$/);if(d!=null){b=d[1];if(d[3]){var g=d[3].split(",[");h=g[0].replace("]","");if(g[1]){e+=","+g[1]}}break}}if(h==null||h=="none"){return}h=h.replace(/ /g,"").split(",");e=e.replace(/ /g,"").split(",");for(f=0;f<e.length;f++){document.write("<script type='text/javascript' src='"+b+"mxn."+e[f]+".js'><\/script>");for(var c=0;c<h.length;c++){document.write("<script type='text/javascript' src='"+b+"mxn."+h[c]+"."+e[f]+".js'><\/script>")}}})();(function(){var c={};var b=function(i,h,g,e,f){if(!d(i,h,g)){throw"Method "+g+" of object "+h+" is not supported by API "+i+". Are you missing a script tag?"}return c[i][h][g].apply(e,f)};var d=function(g,f,e){if(typeof(c[g])=="undefined"){throw"API "+g+" not loaded. Are you missing a script tag?"}if(typeof(c[g][f])=="undefined"){throw"Object definition "+f+" in API "+g+" not loaded. Are you missing a script tag?"}return typeof(c[g][f][e])=="function"};var a=window.mxn={register:function(f,e){if(!c.hasOwnProperty(f)){c[f]={}}a.util.merge(c[f],e)},addProxyMethods:function(g,k,f){for(var e=0;e<k.length;e++){var h=k[e];if(f){g.prototype[h]=new Function("return this.invoker.go('"+h+"', arguments, { overrideApi: true } );")}else{g.prototype[h]=new Function("return this.invoker.go('"+h+"', arguments);")}}},addEvents:function(f,h){for(var e=0;e<h.length;e++){var g=h[e];if(g in f){throw"Event or method "+g+" already declared."}f[g]=new a.Event(g,f)}}};a.Event=function(g,f){var e=[];if(!g){throw"Event name must be provided"}this.addHandler=function(i,h){e.push({context:h,handler:i})};this.removeHandler=function(l,h){for(var k=0;k<e.length;k++){if(e[k].handler==l&&e[k].context==h){e.splice(k,1)}}};this.removeAllHandlers=function(){e=[]};this.fire=function(l){var h=[g,f,l];for(var k=0;k<e.length;k++){e[k].handler.apply(e[k].context,h)}}};a.Invoker=function(g,h,l){var k=g;var f=h;var e=l;var i={overrideApi:false,context:null,fallback:null};this.go=function(p,n,m){if(typeof(m)=="undefined"){m=i}var o=m.overrideApi?n[0]:e.apply(k);if(typeof(o)!="string"){throw"API ID not available."}if(typeof(m.context)!="undefined"&&m.context!==null){n=Array.prototype.slice.apply(n);n.push(m.context)}if(typeof(m.fallback)=="function"&&!d(o,f,p)){return m.fallback.apply(k,n)}else{return b(o,f,p,k,n)}}};a.util={merge:function(g,e){for(var f in e){if(e.hasOwnProperty(f)){if(!g.hasOwnProperty(f)){g[f]=e[f]}else{a.util.merge(g[f],e[f])}}}},$m:function(){var g=[];for(var f=0;f<arguments.length;f++){var e=arguments[f];if(typeof(e)=="string"){e=document.getElementById(e)}if(arguments.length==1){return e}g.push(e)}return g},loadScript:function(i,k){var f=document.createElement("script");f.type="text/javascript";f.src=i;if(k){if(f.addEventListener){f.addEventListener("load",k,true)}else{if(f.attachEvent){var e=false;f.attachEvent("onreadystatechange",function(){if(!e&&document.readyState==="complete"){e=true;k()}})}}}var g=document.getElementsByTagName("head")[0];g.appendChild(f);return},convertLatLonXY_Yahoo:function(e,m){var h=1<<(26-m);var k=h/360;var l=h/(2*Math.PI);var g=new YCoordPoint(h/2,h/2);var i=new YCoordPoint();i.x=Math.floor(g.x+e.lon*k);var f=Math.sin(e.lat*Math.PI/180);i.y=Math.floor(g.y+0.5*Math.log((1+f)/(1-f))*-l);return i},loadStyle:function(e){var f=document.createElement("link");f.type="text/css";f.rel="stylesheet";f.href=e;document.getElementsByTagName("head")[0].appendChild(f);return},getStyle:function(e,g){var f;if(e.currentStyle){f=e.currentStyle[g]}else{if(window.getComputedStyle){f=window.getComputedStyle(e,"").getPropertyValue(g)}}return f},lonToMetres:function(f,e){return f*(111200*Math.cos(e*(Math.PI/180)))},metresToLon:function(e,f){return e/(111200*Math.cos(f*(Math.PI/180)))},KMToMiles:function(e){return e/1.609344},milesToKM:function(e){return e*1.609344},getDegreesFromGoogleZoomLevel:function(f,e){return(360*f)/(Math.pow(2,e+8))},getGoogleZoomLevelFromDegrees:function(f,e){return a.util.logN((360*f)/e,2)-8},logN:function(e,f){return Math.log(e)/Math.log(f)},getAvailableProviders:function(){var f=[];for(var e in c){if(c.hasOwnProperty(e)){f.push(e)}}return f}};a.util.Color=function(){if(arguments.length==3){this.red=arguments[0];this.green=arguments[1];this.blue=arguments[2]}else{if(arguments.length==1){this.setHexColor(arguments[0])}}};a.util.Color.prototype.reHex=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;a.util.Color.prototype.setHexColor=function(f){var e=f.match(this.reHex);if(e){f=e[1]}else{throw"Invalid HEX color format, expected #000, 000, #000000 or 000000"}if(f.length==3){f=f.replace(/\w/g,function(g){return g.concat(g)})}this.red=parseInt(f.substr(0,2),16);this.green=parseInt(f.substr(2,2),16);this.blue=parseInt(f.substr(4,2),16)};a.util.Color.prototype.getHexColor=function(){var f=[this.red.toString(16),this.green.toString(16),this.blue.toString(16)];for(var e=0;e<f.length;e++){f[e]=(f[e].length==1)?"0"+f[e]:f[e];f[e]=f[e].toUpperCase()}return f.join("")}})();(function(){var $m=mxn.util.$m;var init=function(){this.invoker.go("init",[this.currentElement,this.api]);this.applyOptions()};var Mapstraction=mxn.Mapstraction=function(element,api,debug){if(!api){api=mxn.util.getAvailableProviders()[0]}this.api=api;this.maps={};this.currentElement=$m(element);this.eventListeners=[];this.markers=[];this.layers=[];this.polylines=[];this.images=[];this.controls=[];this.loaded={};this.onload={};this.element=element;this.options={enableScrollWheelZoom:false,enableDragging:true};this.addControlsArgs={};this.invoker=new mxn.Invoker(this,"Mapstraction",function(){return this.api});mxn.addEvents(this,["load","click","endPan","changeZoom","markerAdded","markerRemoved","polylineAdded","polylineRemoved"]);init.apply(this)};Mapstraction.ROAD=1;Mapstraction.SATELLITE=2;Mapstraction.HYBRID=3;mxn.addProxyMethods(Mapstraction,["addLargeControls","addMapTypeControls","addOverlay","addSmallControls","applyOptions","getBounds","getCenter","getMapType","getPixelRatio","getZoom","getZoomLevelForBoundingBox","mousePosition","resizeTo","setBounds","setCenter","setCenterAndZoom","setMapType","setZoom","toggleTileLayer"]);Mapstraction.prototype.setOptions=function(oOpts){mxn.util.merge(this.options,oOpts);this.applyOptions()};Mapstraction.prototype.setOption=function(sOptName,vVal){this.options[sOptName]=vVal;this.applyOptions()};Mapstraction.prototype.enableScrollWheelZoom=function(){this.setOption("enableScrollWheelZoom",true)};Mapstraction.prototype.dragging=function(on){this.setOption("enableDragging",on)};Mapstraction.prototype.swap=function(element,api){if(this.api===api){return}var center=this.getCenter();var zoom=this.getZoom();this.currentElement.style.visibility="hidden";this.currentElement.style.display="none";this.currentElement=$m(element);this.currentElement.style.visibility="visible";this.currentElement.style.display="block";this.api=api;if(this.maps[this.api]===undefined){init.apply(this);this.setCenterAndZoom(center,zoom);for(var i=0;i<this.markers.length;i++){this.addMarker(this.markers[i],true)}for(var j=0;j<this.polylines.length;j++){this.addPolyline(this.polylines[j],true)}}else{this.setCenterAndZoom(center,zoom)}this.addControls(this.addControlsArgs)};Mapstraction.prototype.isLoaded=function(api){if(api===null){api=this.api}return this.loaded[api]};Mapstraction.prototype.setDebug=function(debug){if(debug!==null){this.debug=debug}return this.debug};Mapstraction.prototype.clickHandler=function(lat,lon,me){this.callEventListeners("click",{location:new LatLonPoint(lat,lon)})};Mapstraction.prototype.moveendHandler=function(me){this.callEventListeners("moveend",{})};Mapstraction.prototype.addEventListener=function(){var listener={};listener.event_type=arguments[0];listener.callback_function=arguments[1];if(arguments.length==3){listener.back_compat_mode=false;listener.callback_object=arguments[2]}else{listener.back_compat_mode=true;listener.callback_object=null}this.eventListeners.push(listener)};Mapstraction.prototype.callEventListeners=function(sEventType,oEventArgs){oEventArgs.source=this;for(var i=0;i<this.eventListeners.length;i++){var evLi=this.eventListeners[i];if(evLi.event_type==sEventType){if(evLi.back_compat_mode){if(evLi.event_type=="click"){evLi.callback_function(oEventArgs.location)}else{evLi.callback_function()}}else{var scope=evLi.callback_object||this;evLi.callback_function.call(scope,oEventArgs)}}}};Mapstraction.prototype.addControls=function(args){this.addControlsArgs=args;this.invoker.go("addControls",arguments)};Mapstraction.prototype.addMarker=function(marker,old){marker.mapstraction=this;marker.api=this.api;marker.location.api=this.api;marker.map=this.maps[this.api];var propMarker=this.invoker.go("addMarker",arguments);marker.setChild(propMarker);if(!old){this.markers.push(marker)}this.markerAdded.fire({marker:marker})};Mapstraction.prototype.addMarkerWithData=function(marker,data){marker.addData(data);this.addMarker(marker)};Mapstraction.prototype.addPolylineWithData=function(polyline,data){polyline.addData(data);this.addPolyline(polyline)};Mapstraction.prototype.removeMarker=function(marker){var current_marker;for(var i=0;i<this.markers.length;i++){current_marker=this.markers[i];if(marker==current_marker){this.invoker.go("removeMarker",arguments);marker.onmap=false;this.markers.splice(i,1);this.markerRemoved.fire({marker:marker});break}}};Mapstraction.prototype.removeAllMarkers=function(){var current_marker;while(this.markers.length>0){current_marker=this.markers.pop();this.invoker.go("removeMarker",[current_marker])}};Mapstraction.prototype.declutterMarkers=function(opts){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.declutterMarkers(opts)});return}var map=this.maps[this.api];switch(this.api){case"multimap":map.declutterGroup(opts.groupName);break;case" dummy":break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.declutterMarkers")}}};Mapstraction.prototype.addPolyline=function(polyline,old){polyline.api=this.api;polyline.map=this.maps[this.api];var propPoly=this.invoker.go("addPolyline",arguments);polyline.setChild(propPoly);if(!old){this.polylines.push(polyline)}this.polylineAdded.fire({polyline:polyline})};var removePolylineImpl=function(polyline){this.invoker.go("removePolyline",arguments);polyline.onmap=false;this.polylineRemoved.fire({polyline:polyline})};Mapstraction.prototype.removePolyline=function(polyline){var current_polyline;for(var i=0;i<this.polylines.length;i++){current_polyline=this.polylines[i];if(polyline==current_polyline){this.polylines.splice(i,1);removePolylineImpl.call(this,polyline);break}}};Mapstraction.prototype.removeAllPolylines=function(){var current_polyline;while(this.polylines.length>0){current_polyline=this.polylines.pop();removePolylineImpl.call(this,current_polyline)}};Mapstraction.prototype.autoCenterAndZoom=function(){var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;var lat,lon;var checkMinMax=function(){if(lat>lat_max){lat_max=lat}if(lat<lat_min){lat_min=lat}if(lon>lon_max){lon_max=lon}if(lon<lon_min){lon_min=lon}};for(var i=0;i<this.markers.length;i++){lat=this.markers[i].location.lat;lon=this.markers[i].location.lon;checkMinMax()}for(i=0;i<this.polylines.length;i++){for(var j=0;j<this.polylines[i].points.length;j++){lat=this.polylines[i].points[j].lat;lon=this.polylines[i].points[j].lon;checkMinMax()}}this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max))};Mapstraction.prototype.centerAndZoomOnPoints=function(points){var bounds=new BoundingBox(points[0].lat,points[0].lon,points[0].lat,points[0].lon);for(var i=1,len=points.length;i<len;i++){bounds.extend(points[i])}this.setBounds(bounds)};Mapstraction.prototype.visibleCenterAndZoom=function(){var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;var lat,lon;var checkMinMax=function(){if(lat>lat_max){lat_max=lat}if(lat<lat_min){lat_min=lat}if(lon>lon_max){lon_max=lon}if(lon<lon_min){lon_min=lon}};for(var i=0;i<this.markers.length;i++){if(this.markers[i].getAttribute("visible")){lat=this.markers[i].location.lat;lon=this.markers[i].location.lon;checkMinMax()}}for(i=0;i<this.polylines.length;i++){if(this.polylines[i].getAttribute("visible")){for(j=0;j<this.polylines[i].points.length;j++){lat=this.polylines[i].points[j].lat;lon=this.polylines[i].points[j].lon;checkMinMax()}}}this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max))};Mapstraction.prototype.polylineCenterAndZoom=function(radius){var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;for(var i=0;i<mapstraction.polylines.length;i++){for(var j=0;j<mapstraction.polylines[i].points.length;j++){lat=mapstraction.polylines[i].points[j].lat;lon=mapstraction.polylines[i].points[j].lon;latConv=lonConv=radius;if(radius>0){latConv=(radius/mapstraction.polylines[i].points[j].latConv());lonConv=(radius/mapstraction.polylines[i].points[j].lonConv())}if((lat+latConv)>lat_max){lat_max=(lat+latConv)}if((lat-latConv)<lat_min){lat_min=(lat-latConv)}if((lon+lonConv)>lon_max){lon_max=(lon+lonConv)}if((lon-lonConv)<lon_min){lon_min=(lon-lonConv)}}}this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max))};Mapstraction.prototype.addImageOverlay=function(id,src,opacity,west,south,east,north){var b=document.createElement("img");b.style.display="block";b.setAttribute("id",id);b.setAttribute("src",src);b.style.position="absolute";b.style.zIndex=1;b.setAttribute("west",west);b.setAttribute("south",south);b.setAttribute("east",east);b.setAttribute("north",north);var oContext={imgElm:b};this.invoker.go("addImageOverlay",arguments,{context:oContext})};Mapstraction.prototype.setImageOpacity=function(id,opacity){if(opacity<0){opacity=0}if(opacity>=100){opacity=100}var c=opacity/100;var d=document.getElementById(id);if(typeof(d.style.filter)=="string"){d.style.filter="alpha(opacity:"+opacity+")"}if(typeof(d.style.KHTMLOpacity)=="string"){d.style.KHTMLOpacity=c}if(typeof(d.style.MozOpacity)=="string"){d.style.MozOpacity=c}if(typeof(d.style.opacity)=="string"){d.style.opacity=c}};Mapstraction.prototype.setImagePosition=function(id){var imgElement=document.getElementById(id);var oContext={latLng:{top:imgElement.getAttribute("north"),left:imgElement.getAttribute("west"),bottom:imgElement.getAttribute("south"),right:imgElement.getAttribute("east")},pixels:{top:0,right:0,bottom:0,left:0}};this.invoker.go("setImagePosition",arguments,{context:oContext});imgElement.style.top=oContext.pixels.top.toString()+"px";imgElement.style.left=oContext.pixels.left.toString()+"px";imgElement.style.width=(oContext.pixels.right-oContext.pixels.left).toString()+"px";imgElement.style.height=(oContext.pixels.bottom-oContext.pixels.top).toString()+"px"};Mapstraction.prototype.addJSON=function(json){var features;if(typeof(json)=="string"){features=eval("("+json+")")}else{features=json}features=features.features;var map=this.maps[this.api];var html="";var item;var polyline;var marker;var markers=[];if(features.type=="FeatureCollection"){this.addJSON(features.features)}for(var i=0;i<features.length;i++){item=features[i];switch(item.geometry.type){case"Point":html="<strong>"+item.title+"</strong><p>"+item.description+"</p>";marker=new Marker(new LatLonPoint(item.geometry.coordinates[1],item.geometry.coordinates[0]));markers.push(marker);this.addMarkerWithData(marker,{infoBubble:html,label:item.title,date:'new Date("'+item.date+'")',iconShadow:item.icon_shadow,marker:item.id,iconShadowSize:item.icon_shadow_size,icon:"http://boston.openguides.org/markers/AQUA.png",iconSize:item.icon_size,category:item.source_id,draggable:false,hover:false});break;case"Polygon":var points=[];polyline=new Polyline(points);mapstraction.addPolylineWithData(polyline,{fillColor:item.poly_color,date:'new Date("'+item.date+'")',category:item.source_id,width:item.line_width,opacity:item.line_opacity,color:item.line_color,polygon:true});markers.push(polyline);break;default:}}return markers};Mapstraction.prototype.addTileLayer=function(tile_url,opacity,copyright_text,min_zoom,max_zoom,map_type){if(!tile_url){return}this.tileLayers=this.tileLayers||[];opacity=opacity||0.6;copyright_text=copyright_text||"Mapstraction";min_zoom=min_zoom||1;max_zoom=max_zoom||18;map_type=map_type||false;return this.invoker.go("addTileLayer",[tile_url,opacity,copyright_text,min_zoom,max_zoom,map_type])};Mapstraction.prototype.addFilter=function(field,operator,value){if(!this.filters){this.filters=[]}this.filters.push([field,operator,value])};Mapstraction.prototype.removeFilter=function(field,operator,value){if(!this.filters){return}var del;for(var f=0;f<this.filters.length;f++){if(this.filters[f][0]==field&&(!operator||(this.filters[f][1]==operator&&this.filters[f][2]==value))){this.filters.splice(f,1);f--}}};Mapstraction.prototype.toggleFilter=function(field,operator,value){if(!this.filters){this.filters=[]}var found=false;for(var f=0;f<this.filters.length;f++){if(this.filters[f][0]==field&&this.filters[f][1]==operator&&this.filters[f][2]==value){this.filters.splice(f,1);f--;found=true}}if(!found){this.addFilter(field,operator,value)}};Mapstraction.prototype.removeAllFilters=function(){this.filters=[]};Mapstraction.prototype.doFilter=function(showCallback,hideCallback){var map=this.maps[this.api];var visibleCount=0;var f;if(this.filters){switch(this.api){case"multimap":var mmfilters=[];for(f=0;f<this.filters.length;f++){mmfilters.push(new MMSearchFilter(this.filters[f][0],this.filters[f][1],this.filters[f][2]))}map.setMarkerFilters(mmfilters);map.redrawMap();break;case" dummy":break;default:var vis;for(var m=0;m<this.markers.length;m++){vis=true;for(f=0;f<this.filters.length;f++){if(!this.applyFilter(this.markers[m],this.filters[f])){vis=false}}if(vis){visibleCount++;if(showCallback){showCallback(this.markers[m])}else{this.markers[m].show()}}else{if(hideCallback){hideCallback(this.markers[m])}else{this.markers[m].hide()}}this.markers[m].setAttribute("visible",vis)}break}}return visibleCount};Mapstraction.prototype.applyFilter=function(o,f){var vis=true;switch(f[1]){case"ge":if(o.getAttribute(f[0])<f[2]){vis=false}break;case"le":if(o.getAttribute(f[0])>f[2]){vis=false}break;case"eq":if(o.getAttribute(f[0])==f[2]){vis=false}break}return vis};Mapstraction.prototype.getAttributeExtremes=function(field){var min;var max;for(var m=0;m<this.markers.length;m++){if(!min||min>this.markers[m].getAttribute(field)){min=this.markers[m].getAttribute(field)}if(!max||max<this.markers[m].getAttribute(field)){max=this.markers[m].getAttribute(field)}}for(var p=0;m<this.polylines.length;m++){if(!min||min>this.polylines[p].getAttribute(field)){min=this.polylines[p].getAttribute(field)}if(!max||max<this.polylines[p].getAttribute(field)){max=this.polylines[p].getAttribute(field)}}return[min,max]};Mapstraction.prototype.getMap=function(){return this.maps[this.api]};var LatLonPoint=mxn.LatLonPoint=function(lat,lon){this.lat=lat;this.lon=lon;this.lng=lon;this.invoker=new mxn.Invoker(this,"LatLonPoint")};mxn.addProxyMethods(LatLonPoint,["fromProprietary","toProprietary"],true);LatLonPoint.prototype.toString=function(){return this.lat+", "+this.lon};LatLonPoint.prototype.distance=function(otherPoint){var rads=Math.PI/180;var diffLat=(this.lat-otherPoint.lat)*rads;var diffLon=(this.lon-otherPoint.lon)*rads;var a=Math.sin(diffLat/2)*Math.sin(diffLat/2)+Math.cos(this.lat*rads)*Math.cos(otherPoint.lat*rads)*Math.sin(diffLon/2)*Math.sin(diffLon/2);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371};LatLonPoint.prototype.equals=function(otherPoint){return this.lat==otherPoint.lat&&this.lon==otherPoint.lon};LatLonPoint.prototype.latConv=function(){return this.distance(new LatLonPoint(this.lat+0.1,this.lon))*10};LatLonPoint.prototype.lonConv=function(){return this.distance(new LatLonPoint(this.lat,this.lon+0.1))*10};var BoundingBox=mxn.BoundingBox=function(swlat,swlon,nelat,nelon){this.sw=new LatLonPoint(swlat,swlon);this.ne=new LatLonPoint(nelat,nelon)};BoundingBox.prototype.getSouthWest=function(){return this.sw};BoundingBox.prototype.getNorthEast=function(){return this.ne};BoundingBox.prototype.isEmpty=function(){return this.ne==this.sw};BoundingBox.prototype.contains=function(point){return point.lat>=this.sw.lat&&point.lat<=this.ne.lat&&point.lon>=this.sw.lon&&point.lon<=this.ne.lon};BoundingBox.prototype.toSpan=function(){return new LatLonPoint(Math.abs(this.sw.lat-this.ne.lat),Math.abs(this.sw.lon-this.ne.lon))};BoundingBox.prototype.extend=function(point){if(this.sw.lat>point.lat){this.sw.lat=point.lat}if(this.sw.lon>point.lon){this.sw.lon=point.lon}if(this.ne.lat<point.lat){this.ne.lat=point.lat}if(this.ne.lon<point.lon){this.ne.lon=point.lon}return};var Marker=mxn.Marker=function(point){this.api=null;this.location=point;this.onmap=false;this.proprietary_marker=false;this.attributes=[];this.invoker=new mxn.Invoker(this,"Marker",function(){return this.api});mxn.addEvents(this,["openInfoBubble","closeInfoBubble","click"])};mxn.addProxyMethods(Marker,["fromProprietary","hide","openBubble","show","toProprietary","update"]);Marker.prototype.setChild=function(some_proprietary_marker){this.proprietary_marker=some_proprietary_marker;some_proprietary_marker.mapstraction_marker=this;this.onmap=true};Marker.prototype.setLabel=function(labelText){this.labelText=labelText};Marker.prototype.addData=function(options){for(var sOptKey in options){if(options.hasOwnProperty(sOptKey)){switch(sOptKey){case"label":this.setLabel(options.label);break;case"infoBubble":this.setInfoBubble(options.infoBubble);break;case"icon":if(options.iconSize&&options.iconAnchor){this.setIcon(options.icon,options.iconSize,options.iconAnchor)}else{if(options.iconSize){this.setIcon(options.icon,options.iconSize)}else{this.setIcon(options.icon)}}break;case"iconShadow":if(options.iconShadowSize){this.setShadowIcon(options.iconShadow,[options.iconShadowSize[0],options.iconShadowSize[1]])}else{this.setIcon(options.iconShadow)}break;case"infoDiv":this.setInfoDiv(options.infoDiv[0],options.infoDiv[1]);break;case"draggable":this.setDraggable(options.draggable);break;case"hover":this.setHover(options.hover);this.setHoverIcon(options.hoverIcon);break;case"hoverIcon":this.setHoverIcon(options.hoverIcon);break;case"openBubble":this.openBubble();break;case"groupName":this.setGroupName(options.groupName);break;default:this.setAttribute(sOptKey,options[sOptKey]);break}}}};Marker.prototype.setInfoBubble=function(infoBubble){this.infoBubble=infoBubble};Marker.prototype.setInfoDiv=function(infoDiv,div){this.infoDiv=infoDiv;this.div=div};Marker.prototype.setIcon=function(iconUrl,iconSize,iconAnchor){this.iconUrl=iconUrl;if(iconSize){this.iconSize=iconSize}if(iconAnchor){this.iconAnchor=iconAnchor}};Marker.prototype.setIconSize=function(iconSize){if(iconSize){this.iconSize=iconSize}};Marker.prototype.setIconAnchor=function(iconAnchor){if(iconAnchor){this.iconAnchor=iconAnchor}};Marker.prototype.setShadowIcon=function(iconShadowUrl,iconShadowSize){this.iconShadowUrl=iconShadowUrl;if(iconShadowSize){this.iconShadowSize=iconShadowSize}};Marker.prototype.setHoverIcon=function(hoverIconUrl){this.hoverIconUrl=hoverIconUrl};Marker.prototype.setDraggable=function(draggable){this.draggable=draggable};Marker.prototype.setHover=function(hover){this.hover=hover};Marker.prototype.setGroupName=function(sGrpName){this.groupName=sGrpName};Marker.prototype.setAttribute=function(key,value){this.attributes[key]=value};Marker.prototype.getAttribute=function(key){return this.attributes[key]};var Polyline=mxn.Polyline=function(points){this.api=null;this.points=points;this.attributes=[];this.onmap=false;this.proprietary_polyline=false;this.pllID="mspll-"+new Date().getTime()+"-"+(Math.floor(Math.random()*Math.pow(2,16)));this.invoker=new mxn.Invoker(this,"Polyline",function(){return this.api})};mxn.addProxyMethods(Polyline,["fromProprietary","hide","show","toProprietary","update"]);Polyline.prototype.addData=function(options){for(var sOpt in options){if(options.hasOwnProperty(sOpt)){switch(sOpt){case"color":this.setColor(options.color);break;case"width":this.setWidth(options.width);break;case"opacity":this.setOpacity(options.opacity);break;case"closed":this.setClosed(options.closed);break;case"fillColor":this.setFillColor(options.fillColor);break;default:this.setAttribute(sOpt,options[sOpt]);break}}}};Polyline.prototype.setChild=function(some_proprietary_polyline){this.proprietary_polyline=some_proprietary_polyline;this.onmap=true};Polyline.prototype.setColor=function(color){this.color=(color.length==7&&color[0]=="#")?color.toUpperCase():color};Polyline.prototype.setWidth=function(width){this.width=width};Polyline.prototype.setOpacity=function(opacity){this.opacity=opacity};Polyline.prototype.setClosed=function(bClosed){this.closed=bClosed};Polyline.prototype.setFillColor=function(sFillColor){this.fillColor=sFillColor};Polyline.prototype.setAttribute=function(key,value){this.attributes[key]=value};Polyline.prototype.getAttribute=function(key){return this.attributes[key]};Polyline.prototype.simplify=function(tolerance){var reduced=[];reduced[0]=this.points[0];var markerPoint=0;for(var i=1;i<this.points.length-1;i++){if(this.points[i].distance(this.points[markerPoint])>=tolerance){reduced[reduced.length]=this.points[i];markerPoint=i}}reduced[reduced.length]=this.points[this.points.length-1];this.points=reduced};var Radius=mxn.Radius=function(center,quality){this.center=center;var latConv=center.latConv();var lonConv=center.lonConv();var rad=Math.PI/180;this.calcs=[];for(var i=0;i<360;i+=quality){this.calcs.push([Math.cos(i*rad)/latConv,Math.sin(i*rad)/lonConv])}};Radius.prototype.getPolyline=function(radius,colour){var points=[];for(var i=0;i<this.calcs.length;i++){var point=new LatLonPoint(this.center.lat+(radius*this.calcs[i][0]),this.center.lon+(radius*this.calcs[i][1]));points.push(point)}points.push(points[0]);var line=new Polyline(points);line.setColor(colour);return line}})();mxn.register("openlayers",{Mapstraction:{init:function(a,b){var c=this;this.maps[b]=new OpenLayers.Map(a.id,{maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),maxResolution:156543,numZoomLevels:18,units:"meters",projection:"EPSG:41001"});this.layers.osmmapnik=new OpenLayers.Layer.TMS("OSM Mapnik",["http://a.tile.openstreetmap.org/","http://b.tile.openstreetmap.org/","http://c.tile.openstreetmap.org/"],{type:"png",getURL:function(h){var g=this.map.getResolution();var d=Math.round((h.left-this.maxExtent.left)/(g*this.tileSize.w));var l=Math.round((this.maxExtent.top-h.top)/(g*this.tileSize.h));var k=this.map.getZoom();var e=Math.pow(2,k);if(l<0||l>=e){return null}else{d=((d%e)+e)%e;var i=k+"/"+d+"/"+l+"."+this.type;var f=this.url;if(f instanceof Array){f=this.selectUrl(i,f)}return f+i}},displayOutsideMaxExtent:true});this.layers.osm=new OpenLayers.Layer.TMS("OSM",["http://a.tah.openstreetmap.org/Tiles/tile.php/","http://b.tah.openstreetmap.org/Tiles/tile.php/","http://c.tah.openstreetmap.org/Tiles/tile.php/"],{type:"png",getURL:function(h){var g=this.map.getResolution();var d=Math.round((h.left-this.maxExtent.left)/(g*this.tileSize.w));var l=Math.round((this.maxExtent.top-h.top)/(g*this.tileSize.h));var k=this.map.getZoom();var e=Math.pow(2,k);if(l<0||l>=e){return null}else{d=((d%e)+e)%e;var i=k+"/"+d+"/"+l+"."+this.type;var f=this.url;if(f instanceof Array){f=this.selectUrl(i,f)}return f+i}},displayOutsideMaxExtent:true});this.maps[b].addLayer(this.layers.osmmapnik);this.maps[b].addLayer(this.layers.osm)},applyOptions:function(){},resizeTo:function(b,a){this.currentElement.style.width=b;this.currentElement.style.height=a;this.maps[this.api].updateSize()},addControls:function(a){var c=this.maps[this.api];for(var b=c.controls.length;b>1;b--){c.controls[b-1].deactivate();c.removeControl(c.controls[b-1])}if(a.zoom=="large"){c.addControl(new OpenLayers.Control.PanZoomBar())}else{if(a.zoom=="small"){c.addControl(new OpenLayers.Control.ZoomPanel());if(a.pan){c.addControl(new OpenLayers.Control.PanPanel())}}else{if(a.pan){c.addControl(new OpenLayers.Control.PanPanel())}}}if(a.overview){c.addControl(new OpenLayers.Control.OverviewMap())}if(a.map_type){c.addControl(new OpenLayers.Control.LayerSwitcher())}},addSmallControls:function(){var a=this.maps[this.api];this.addControlsArgs.pan=false;this.addControlsArgs.scale=false;this.addControlsArgs.zoom="small";a.addControl(new OpenLayers.Control.ZoomBox());a.addControl(new OpenLayers.Control.LayerSwitcher({ascending:false}))},addLargeControls:function(){var a=this.maps[this.api];a.addControl(new OpenLayers.Control.PanZoomBar());this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large"},addMapTypeControls:function(){var a=this.maps[this.api];a.addControl(new OpenLayers.Control.LayerSwitcher({ascending:false}));this.addControlsArgs.map_type=true},setCenterAndZoom:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);d.setCenter(a.toProprietary(this.api),b)},addMarker:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);if(!this.layers.markers){this.layers.markers=new OpenLayers.Layer.Markers("markers");d.addLayer(this.layers.markers)}this.layers.markers.addMarker(c);return c},removeMarker:function(a){var c=this.maps[this.api];var b=a.toProprietary(this.api);this.layers.markers.removeMarker(b);b.destroy()},removeAllMarkers:function(){var a=this.maps[this.api]},declutterMarkers:function(a){var b=this.maps[this.api]},addPolyline:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);if(!this.layers.polylines){this.layers.polylines=new OpenLayers.Layer.Vector("polylines");d.addLayer(this.layers.polylines)}b.setChild(c);this.layers.polylines.addFeatures([c]);return c},removePolyline:function(a){var c=this.maps[this.api];var b=a.toProprietary(this.api);this.layers.polylines.removeFeatures([b])},removeAllPolylines:function(){var c=[];for(var a=0,b=this.polylines.length;a<b;a++){c.push(this.polylines[a].toProprietary(this.api))}if(this.layers.polylines){this.layers.polylines.removeFeatures(c)}},getCenter:function(){var a=this.maps[this.api];pt=a.getCenter();return new mxn.LatLonPoint(pt.lat,pt.lon)},setCenter:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);d.setCenter(c)},setZoom:function(a){var b=this.maps[this.api];b.zoomTo(a)},getZoom:function(){var a=this.maps[this.api];return a.zoom},getZoomLevelForBoundingBox:function(b){var a=this.maps[this.api];return zoom},setMapType:function(a){var b=this.maps[this.api];throw"Not implemented (setMapType)"},getMapType:function(){var a=this.maps[this.api];return mxn.Mapstraction.ROAD},getBounds:function(){var b=this.maps[this.api];var a=b.calculateBounds();return new mxn.BoundingBox(a.bottom,a.left,a.top,a.right)},setBounds:function(c){var e=this.maps[this.api];var a=c.getSouthWest();var d=c.getNorthEast();if(a.lon>d.lon){a.lon-=360}var b=new OpenLayers.Bounds();b.extend(new mxn.LatLonPoint(a.lat,a.lon).toProprietary(this.api));b.extend(new mxn.LatLonPoint(d.lat,d.lon).toProprietary(this.api));e.zoomToExtent(b)},addImageOverlay:function(c,a,e,i,f,g,d,h){var b=this.maps[this.api]},setImagePosition:function(e,b){var d=this.maps[this.api];var c;var a},addOverlay:function(a,b){var c=this.maps[this.api]},addTileLayer:function(f,a,b,d,e){var c=this.maps[this.api]},toggleTileLayer:function(b){var a=this.maps[this.api]},getPixelRatio:function(){var a=this.maps[this.api]},mousePosition:function(a){var b=this.maps[this.api]}},LatLonPoint:{toProprietary:function(){var b=this.lon*20037508.34/180;var a=Math.log(Math.tan((90+this.lat)*Math.PI/360))/(Math.PI/180);a=a*20037508.34/180;return new OpenLayers.LonLat(b,a)},fromProprietary:function(a){var c=(a.lon/20037508.34)*180;var b=(a.lat/20037508.34)*180;b=180/Math.PI*(2*Math.atan(Math.exp(b*Math.PI/180))-Math.PI/2);this.lon=c;this.lat=b}},Marker:{toProprietary:function(){var e,d,f;if(this.iconSize){e=new OpenLayers.Size(this.iconSize[0],this.iconSize[1])}else{e=new OpenLayers.Size(21,25)}if(this.iconAnchor){d=new OpenLayers.Pixel(this.iconAnchor[0],this.iconAnchor[1])}else{d=new OpenLayers.Pixel(-(e.w/2),-e.h)}if(this.iconUrl){f=new OpenLayers.Icon(this.iconUrl,e,d)}else{f=new OpenLayers.Icon("http://openlayers.org/dev/img/marker-gold.png",e,d)}var b=new OpenLayers.Marker(this.location.toProprietary("openlayers"),f);if(this.infoBubble){var a=new OpenLayers.Popup(null,this.location.toProprietary("openlayers"),new OpenLayers.Size(100,100),this.infoBubble,true);a.autoSize=true;var c=this.map;if(this.hover){b.events.register("mouseover",b,function(h){c.addPopup(a);a.show()});b.events.register("mouseout",b,function(h){a.hide();c.removePopup(a)})}else{var g=false;b.events.register("mousedown",b,function(h){if(g){a.hide();c.removePopup(a);g=false}else{c.addPopup(a);a.show();g=true}})}}if(this.hoverIconUrl){}if(this.infoDiv){}return b},openBubble:function(){},hide:function(){this.proprietary_marker.setOptions({visible:false})},show:function(){this.proprietary_marker.setOptions({visible:true})},update:function(){}},Polyline:{toProprietary:function(){var f;var d=[];var a;var c={strokeColor:this.color||"#000000",strokeOpacity:this.opacity||1,strokeWidth:this.width||1,fillColor:this.fillColor||"#000000",fillOpacity:this.getAttribute("fillOpacity")||0.2};for(var b=0,e=this.points.length;b<e;b++){olpoint=this.points[b].toProprietary("openlayers");d.push(new OpenLayers.Geometry.Point(olpoint.lon,olpoint.lat))}if(this.closed){a=new OpenLayers.Geometry.LinearRing(d)}else{a=new OpenLayers.Geometry.LineString(d)}f=new OpenLayers.Feature.Vector(a,null,c);return f},show:function(){throw"Not implemented"},hide:function(){throw"Not implemented"}}});function scrapeNotices(a){var b=[];$(".notice").each(function(){var c=getNoticeFromElement($(this));if(a){c.user=a}else{c.user=getUserFromElement($(this))}if(c.geo){b.push(c)}});return b}function scrapeUser(){var b=$(".entity_profile .entity_depiction img.avatar").attr("src");var c=$(".entity_profile .entity_nickname .url").attr("href");var a=$(".entity_profile .entity_nickname .nickname").text();return{profile_image_url:b,profile_url:c,screen_name:a}}function getMicroformatValue(a){if(a[0].tagName.toLowerCase()=="abbr"){return a.attr("title")}else{return a.text()}}function getNoticeFromElement(a){var c={};if(a.find(".geo").length){var b=a.find(".geo").attr("title").split(";");c.geo={coordinates:[parseFloat(b[0]),parseFloat(b[1])]}}c.html=a.find(".entry-content").html();c.url=a.find("a.timestamp").attr("href");c.created_at=a.find("abbr.published").text();return c}function getUserFromElement(b){var c=b.find("img.avatar").attr("src");var d=b.find(".author a.url").attr("href");var a=b.find(".author .nickname").text();return{profile_image_url:c,profile_url:d,screen_name:a}}function showMapstraction(f,h){if(f instanceof jQuery){f=f[0]}if(!$.isArray(h)){h=[h]}var b=new mxn.Mapstraction(f,_provider);var d=181;var e=-181;var l=181;var m=-181;for(var g in h){var c=h[g];var k=c.geo["coordinates"][0];var a=c.geo["coordinates"][1];if(k<d){d=k}if(k>e){e=k}if(a<l){l=a}if(a>m){m=a}pt=new mxn.LatLonPoint(k,a);mkr=new mxn.Marker(pt);mkr.setIcon(c.user["profile_image_url"],[24,24]);mkr.setInfoBubble('<a href="'+c.user["profile_url"]+'">'+c.user["screen_name"]+"</a> "+c.html+'<br/><a href="'+c.url+'">'+c.created_at+"</a>");b.addMarker(mkr)}bounds=new mxn.BoundingBox(d,l,e,m);b.setBounds(bounds)}; \ No newline at end of file