diff --git a/dist/mapbbcode-latest.zip b/dist/mapbbcode-latest.zip index 2e70726..7eb6ff2 100644 Binary files a/dist/mapbbcode-latest.zip and b/dist/mapbbcode-latest.zip differ diff --git a/lib/mapbbcode.js b/lib/mapbbcode.js index 3f89c84..1070210 100644 --- a/lib/mapbbcode.js +++ b/lib/mapbbcode.js @@ -1,8 +1,8 @@ /* MapBBCode, a JavaScript library for parsing, displaying and editing [map] code. - Version 1.2.0-dev built on 18.12.2013 + Version 1.2.0-dev built on 20.12.2013 http://mapbbcode.org (c) 2013, Ilya Zverev */ -!function(window,document,undefined){var L=window.L;window.MapBBCodeProcessor={options:{decimalDigits:5,brackets:"[]",tagParams:!1,shareTag:"mapid"},setOptions:function(t){for(var e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])},_getRegExp:function(){var t=this.options.brackets.substring(0,1).replace(/([\[\({])/,"\\$1"),e=this.options.brackets.substring(1,2).replace(/([\]\)}])/,"\\$1"),o="\\s*(-?\\d+(?:\\.\\d+)?)\\s*,\\s*(-?\\d+(?:\\.\\d+)?)",i="\\((?:([a-zA-Z0-9,]*)\\|)?(|[\\s\\S]*?[^\\\\])\\)",n=o+"(?:"+o+")*(?:\\s*"+i+")?",r=t+"map(?:"+(this.options.tagParams?"\\s+z=['\"]([12]?\\d)['\"](?:\\s+ll=['\"]"+o+"['\"])?":"=['\"]?([12]?\\d)(?:,"+o+")?")+")?['\"]?"+e,a=t+"map"+e+"\\s*"+t+"/map"+e,s=r+"("+n+"(?:\\s*;"+n+")*)?\\s*"+t+"/map"+e;return{coord:o,params:i,mapElement:n,map:s,mapEmptyCompiled:new RegExp(a,"i"),mapCompiled:new RegExp(s,"i")}},getOpenTagSubstring:function(){return this.options.brackets.substring(0,1)+"map"},getOpenTagWithPart:function(t){return this.options.brackets.substring(0,1)+"map"+(t&&t.length>0?(this.options.tagParams?" "==t.substring(0,1)?"":" ":"="==t.substring(0,1)?"":"=")+t:"")+this.options.brackets.substring(1,2)},getOpenTag:function(t,e){return this.options.brackets.substring(0,1)+"map"+(t||"0"===t?this.options.tagParams?' z="'+t+'"'+(e?' ll="'+e+'"':""):"="+t+(e?","+e:""):"")+this.options.brackets.substring(1,2)},getCloseTag:function(){return this.options.brackets.substring(0,1)+"/map"+this.options.brackets.substring(1,2)},getShareTag:function(t){var e=this.options.brackets.substring(0,1),o=this.options.brackets.substring(1,2),i=this.options.shareTag||"mapid";return t?e+i+o+t+e+"/"+i+o:e+i+o},getBBCodeRegExp:function(){return this._getRegExp().mapCompiled},isValid:function(t){return this._getRegExp().mapCompiled.test(t)},isEmpty:function(t){return this._getRegExp().mapEmptyCompiled.test(t)},stringToObjects:function(t){var e=this._getRegExp(),o=t.match(e.mapCompiled),i={objs:[]};if(o&&o[1]&&o[1].length&&+o[1]>0&&(i.zoom=+o[1],o[3]&&o[3].length>0))try{i.pos=L&&L.LatLng?new L.LatLng(o[2],o[3]):[+o[2],+o[3]]}catch(n){}if(o&&o[4]){var r,a=o[4],s=new RegExp("^\\s*(?:;\\s*)?("+e.mapElement+")"),l=new RegExp("^"+e.coord);for(r=a.match(s);r;){var d,p=r[1],c=[],h="",u=[];for(d=p.match(l);d;)c.push(L&&L.LatLng?new L.LatLng(d[1],d[2]):[+d[1],+d[2]]),p=p.substring(d[0].length),d=p.match(l);r[6]&&(u=r[6].split(",")),"string"==typeof r[7]&&r[7].length>0&&(h=r[7].replace(/\\\)/g,")").replace(/^\s+|\s+$/g,"")),i.objs.push({coords:c,text:h,params:u}),a=a.substring(r[0].length),r=a.match(s)}}return i},objectsToString:function(t){var e,o;t.zoom>0&&(e=t.zoom,t.pos&&(o=this._latLngToString(t.pos)));for(var i=[],n=[],r=t.objs||[],a=0;a0&&(l+=" "),l+=this._latLngToString(s[d]);var p=r[a].text||"",c=r[a].params||[];p.indexOf("|")>=0&&0===c.length&&(p="|"+p),(p.length>0||c.length>0)&&(l=l+"("+(c.length>0?c.join(",")+"|":"")+p.replace(/\)/g,"\\)")+")"),s.length&&(1==s.length?i.push(l):n.push(l))}return i.length||n.length||e?this.getOpenTag(e,o)+i.concat(n).join("; ")+this.getCloseTag():""},_latLngToString:function(t){var e=Math.pow(10,this.options.decimalDigits);return""+Math.round((t.lat||t[0])*e)/e+","+Math.round((t.lng||t[1])*e)/e}},window.MapBBCode=L.Class.extend({options:{createLayers:null,layers:null,maxInitialZoom:15,defaultPosition:[22,11],defaultZoom:2,leafletOptions:{},polygonOpacity:.1,editorHeight:400,viewWidth:600,viewHeight:300,fullViewHeight:600,fullScreenButton:!0,fullFromStart:!1,windowWidth:800,windowHeight:500,windowFeatures:"resizable,status,dialog",windowPath:"lib/mapbbcode-window.html",editorCloseButtons:!0,confirmFormSubmit:!0,outerLinkTemplate:!1,helpButton:!0,allowedHTML:"[auib]|span|br|em|strong|tt",letterIconLength:2,popupIconLength:30,enablePolygons:!0,preferStandardLayerSwitcher:!0,hideInsideClasses:[],watchResize:!1,panelHook:null,externalEndpoint:"http://share.mapbbcode.org/",exportTypes:"csv,geojson,gpx,plt,wpt,kml",uploadButton:!1},strings:{},initialize:function(t){L.setOptions(this,t),L.Browser.ie&&t&&t.defaultPosition&&"splice"in t.defaultPosition&&2==t.defaultPosition.length&&(this.options.defaultPosition=[t.defaultPosition[0],t.defaultPosition[1]])},setStrings:function(t){this.strings=L.extend({},this.strings,t)},_eachHandler:function(t,e,o){var i=window.mapBBCodeHandlers;if(i)for(var n=0;n2&&t.coords[0].equals(t.coords[t.coords.length-1])?(t.coords.splice(t.coords.length-1,1),e=L.polygon(t.coords,{weight:3,opacity:.7,fill:!0,fillOpacity:this.options.polygonOpacity})):e=L.polyline(t.coords,{weight:5,opacity:.7}),this._eachHandler(function(o){if("objectToLayer"in o){var i=[];if("reKeys"in o)for(var n=0;ne&&t.setZoom(e,{animate:!1})}},a=t.getBoundsZoom(n,!1);a?r.call(this):t.on("load",r,this)},createOpenStreetMapLayer:function(t){var e=t||L;return e.tileLayer("http://tile.openstreetmap.org/{z}/{x}/{y}.png",{name:"OpenStreetMap",attribution:'Map © OpenStreetMap',minZoom:2,maxZoom:18})},_addLayers:function(t){var e=this.options.createLayers?this.options.createLayers.call(this,L):null;if(e&&e.length||!window.layerList||!this.options.layers||(e=window.layerList.getLeafletLayers(this.options.layers,L)),e&&e.length||(e=[this.createOpenStreetMapLayer(L)]),t.addLayer(e[0]),e.length>1){var o,i;if(!this.options.preferStandardLayerSwitcher&&L.StaticLayerSwitcher)for(o=L.staticLayerSwitcher(null,{enforceOSM:!0}),i=0;iMapBBCode'),this._addLayers(i);var n=new L.FeatureGroup;n.addTo(i);for(var r=window.MapBBCodeProcessor.stringToObjects(e),a=r.objs,s=0;s0&&"position"in t[0]&&(e={position:t[0].position}),L.Control.prototype.initialize.call(this,e)},onAdd:function(t){this._map=t,this._links=[];for(var e=L.DomUtil.create("div","leaflet-bar"),o=0;o=this._buttons.length)){var e=this._buttons[t],o=e.link,i=e.content;if(o)if(i===undefined||i===!1||null===i||""===i)o.innerHTML=e.alt||" ";else if("string"==typeof i){var n=i.length<4?"":i.substring(i.length-4),r="data:image/"===i.substring(0,11);".png"===n||".gif"===n||".jpg"===n||r?(o.style.width=""+(e.imageSize||26)+"px",o.style.height=""+(e.imageSize||26)+"px",o.style.padding="0",o.style.backgroundImage="url("+i+")",o.style.backgroundRepeat="no-repeat",o.style.backgroundPosition=e.bgPos?-e.bgPos[0]+"px "+-e.bgPos[1]+"px":"0px 0px"):o.innerHTML=i}else{for(;o.firstChild;)o.removeChild(o.firstChild);o.appendChild(i)}}},setContent:function(t,e){e===undefined&&(e=t,t=0),t])","g"),"<"))}else t.options.clickable=!1},_getIcon:function(t,e,o){if(t instanceof L.Marker&&e.length>0){if(L.LetterIcon&&e.length<=o.options.letterIconLength)return new L.LetterIcon(e);if(L.PopupIcon&&e.length<=o.options.popupIconLength&&e.indexOf("<")<0)return new L.PopupIcon(e)}},layerToObject:function(t){return t.inputField?t.inputField.value.replace(/\\n/g,"\n").replace(/\\\n/g,"\\n"):t._text||""},createEditorPanel:function(t,e){if(t instanceof L.Marker){var o=document.createElement("div"),i=document.createTextNode(e.strings.title+": "),n=document.createElement("input");return n.type="text",n.size=20,t._text&&(n.value=t._text.replace(/\\n/g,"\\\\n").replace(/[\r\n]+/g,"\\n")),o.appendChild(i),o.appendChild(n),o.style.marginBottom="8px",t.inputField=n,t.options.draggable=!0,t.defaultIcon=new L.Icon.Default,n.onkeypress=function(e){var o=window.event?(e||window.event).which:e.keyCode;return 27==o||13==o?(t.closePopup(),e.preventDefault(),!1):void 0},t.on("popupopen",function(){n.focus()}),t.on("popupclose",function(){var o=t.inputField.value,i=this._getIcon(t,o,e)||t.defaultIcon;t.setIcon(i)},this),o}}}),window.MapBBCode.include({layerToObject:function(t){var e={};if(t instanceof L.Marker)e.coords=[t.getLatLng()];else if(t.getLatLngs){var o,i=t.getLatLngs(),n=i.length,r=[];for(o=0;n>o;o++)r.push(i[o]);t instanceof L.Polygon&&r.push(r[0]),e.coords=r}return e.params=t._objParams||[],this._eachHandler(function(o){if(o.text&&"layerToObject"in o){var i=o.layerToObject(t,"",this);i&&(e.text=i)}else if("layerToObject"in o){var n,r=[];if("reKeys"in o)for(n=e.params.length-1;n>=0;n--)o.reKeys.test(e.params[n])&&r.unshift(e.params.splice(n,1));var a=o.layerToObject(t,r,this);if(a&&a.length>0)for(n=0;n0&&(window.confirm(this.strings.submitWarning)||L.DomEvent.preventDefault(i))}},this)},_findMapInTextArea:function(t){var e=window.MapBBCodeProcessor.getOpenTagSubstring(),o=window.MapBBCodeProcessor.getCloseTag(),i=t.value,n="selectionStart"in t?t.selectionStart:i.indexOf(o);if(n>=i.length||i.length<10||i.indexOf(o)<0)return"";var r=i.lastIndexOf(e,n);if(r>=0){var a=i.indexOf(o,r);if(a+o.length>n){var s=i.substring(r,a+6);if(window.MapBBCodeProcessor.isValid(s))return s}}return""},_updateMapInTextArea:function(t,e,o){var i=t.selectionStart,n=t.value;t.value=e.length&&n.indexOf(e)>=0?n.replace(e,o):!("selectionStart"in t)||i>=n.length?n+o:n.substring(0,i)+o+n.substring(i)},_getBBCode:function(t,e){var o=[];e.eachLayer(function(t){o.push(this.layerToObject(t))},this);var i=!o.length||t.wasPositionSet;return window.MapBBCodeProcessor.objectsToString({objs:o,zoom:i?t.getZoom():0,pos:i?t.getCenter():0})},editor:function(t,e,o,i){var n=this._createMapPanel(t,!0);if(n){var r=this.strings,a=L.map(n,L.extend({},{zoomControl:!1},this.options.leafletOptions));a.addControl(new L.Control.Zoom({zoomInTitle:r.zoomInTitle,zoomOutTitle:r.zoomOutTitle})),a.attributionControl&&a.attributionControl.setPrefix('MapBBCode'),L.Control.Search&&a.addControl(new L.Control.Search({title:r.searchTitle})),this._addLayers(a);var s;"string"!=typeof e&&(s=e,e=this._findMapInTextArea(s));for(var l=new L.FeatureGroup,d=window.MapBBCodeProcessor.stringToObjects(e),p=d.objs,c=0;c0&&!!d.pos;var h=L.drawLocal.draw.toolbar,u=L.drawLocal.draw.handlers;h.actions.text=r.cancel,h.actions.title=r.drawCancelTitle,h.undo.text=r.undoPoint,h.undo.title=r.undoPointTitle,h.buttons.polyline=r.polylineTitle,h.buttons.polygon=r.polygonTitle,h.buttons.marker=r.markerTitle,u.marker.tooltip.start=r.markerTooltip,u.polyline.tooltip.start=r.polylineStartTooltip,u.polyline.tooltip.cont=r.polylineContinueTooltip,u.polyline.tooltip.end=r.polylineEndTooltip,u.polygon.tooltip.start=r.polygonStartTooltip,u.polygon.tooltip.cont=r.polygonContinueTooltip,u.polygon.tooltip.end=r.polygonEndTooltip;var g=new L.Control.Draw({position:"topleft",draw:{marker:!0,polyline:{showLength:!1,guidelineDistance:10,shapeOptions:{color:"#0033FF",weight:5,opacity:.7}},polygon:this.options.enablePolygons?{showArea:!1,guidelineDistance:10,shapeOptions:{color:"#0033FF",weight:3,opacity:.7,fillOpacity:this.options.polygonOpacity}}:!1,rectangle:!1,circle:!1},edit:{featureGroup:l,edit:!1,remove:!1}});if(this._eachHandler(function(t){"initDrawControl"in t&&t.initDrawControl(g)}),a.addControl(g),a.on("draw:created",function(t){var e=t.layer;this._eachHandler(function(t){"initLayer"in t&&t.initLayer(e)},this,e),this._makeEditable(e,l),l.addLayer(e),"marker"===t.layerType&&e.openPopup()},this),this.options.editorCloseButtons){var m=L.functionButtons([{content:""+r.apply+"",title:r.applyTitle}],{position:"topleft"});if(m.on("clicked",function(){var t=this._getBBCode(a,l);n.close(),s&&this._updateMapInTextArea(s,e,t),o&&o.call(i,t)},this),a.addControl(m),this.options.uploadButton&&this._upload){var f=L.functionButtons([{content:r.upload,title:r.uploadTitle}],{position:"topleft"});f.on("clicked",function(){this._upload(n,l.getLayers().length?this._getBBCode(a,l):!1,function(t){n.close();var r=window.MapBBCodeProcessor.getShareTag(t);s&&this._updateMapInTextArea(s,e,r),o&&o.call(i,r)})},this),a.addControl(f)}var y=L.functionButtons([{content:r.cancel,title:r.cancelTitle}],{position:"topright"});y.on("clicked",function(){n.close(),o&&o.call(i,null)},this),a.addControl(y)}if(this.options.helpButton){var v=L.functionButtons([{content:'?',title:r.helpTitle}],{position:"topright"});v.on("clicked",function(){for(var t="",e=t.helpContents.split(/\n+/),o="1.2.0-dev",i="resizable,dialog,scrollbars,height="+this.options.windowHeight+",width="+this.options.windowWidth,n=window.open("","mapbbcode_help",i),r=0;r"+e[r].replace(/^#\s*/,"")+"":"

"+e[r]+"

":"

"+e[0]+"

";t=t.replace("{version}",o),t+='
';var a="";n.document.open(),n.document.write(a),n.document.write(t),n.document.close(),n.onkeypress=function(t){var e=window.event?(t||window.event).which:t.keyCode;27==e&&n.close()}},this),a.addControl(v)}return this.options.confirmFormSubmit&&this._addSubmitHandler(a,l),this._createControlAndCallHooks(n,a,l,{editor:!0,close:function(){var t=this.getBBCode();this.map=this._ui=null,this.getBBCode=function(){return t},n.close()},getBBCode:function(){return this._ui._getBBCode(a,l)},updateBBCode:function(t,e){var o=window.MapBBCodeProcessor.stringToObjects(t),i=o.objs;l.clearLayers(),a.removeLayer(l);for(var n=0;n=200&&300>t?!1:t||499,r.responseText)}var r;if(window.XMLHttpRequest&&(r=new window.XMLHttpRequest),!window.XDomainRequest||r&&"withCredentials"in r||(r=new window.XDomainRequest),r){"onload"in r?r.onload=r.onerror=n:r.onreadystatechange=function(){4==r.readyState&&n()};try{i?(r.open("POST",t,!0),r.setRequestHeader("Content-type","application/x-www-form-urlencoded"),r.send(i)):(r.open("GET",t,!0),r.send(null))}catch(a){e.call(o,399)}}},showExternal:function(element,id,callback,context){var endpoint=this._getEndpoint();if(endpoint&&id){var errorDiv=this._createMapPanel(element);errorDiv.style.display="table";var cell=document.createElement("div");cell.style.display="table-cell",cell.style.width="100%",cell.style.backgroundColor="#ddd",cell.style.textAlign="center",cell.style.verticalAlign="middle",cell.innerHTML=this.strings.sharedCodeLoading.replace("{url}",endpoint+id),errorDiv.appendChild(cell);var showMap=function(error,content){var show,result,derror=!1;if(error?derror=!0:result=eval("("+content+")"),error||result.error||!result.bbcode)cell.innerHTML=this.strings.sharedCodeError.replace("{url}",endpoint+id),show={close:function(){errorDiv.close()}};else if(show=this.show(element,result.bbcode),result.title,show){var map=show.map;if(this.options.outerLinkTemplate||map.addControl(L.functionButtons([{content:window.MapBBCode.buttonsImage,bgPos:[52,0],href:endpoint+id,alt:"↷",title:this.strings.outerTitle}],{position:"topright"})),L.ExportControl){var ec=new L.ExportControl({name:this.strings.exportName,title:this.strings.exportTitle,filter:"string"==typeof this.options.exportTypes&&this.options.exportTypes.length>0?this.options.exportTypes.split(","):this.options.exportTypes,endpoint:endpoint,codeid:id});map.addControl(ec)}}callback&&callback.call(context||this,show)};this._ajax(endpoint+id+"?api=1",showMap,this)}},_upload:function(mapDiv,bbcode,callback){var outerDiv=document.createElement("div");outerDiv.style.display="table";try{outerDiv.style.backgroundColor="rgba(0, 0, 0, 0.8)"}catch(err){outerDiv.style.backgroundColor="black"}outerDiv.style.zIndex=2e3,outerDiv.style.position="absolute",outerDiv.style.left=outerDiv.style.right=outerDiv.style.top=outerDiv.style.bottom=0,outerDiv.style.width=outerDiv.style.height="100%",mapDiv.appendChild(outerDiv);var back=document.createElement("div");back.style.width=back.style.height="100%",back.style.textAlign="center",back.style.color="white",back.style.verticalAlign="middle",back.style.display="table-cell",back.style.cursor="default";var stop=L.DomEvent.stopPropagation;L.DomEvent.on(back,"click",stop).on(back,"mousedown",stop).on(back,"dblclick",stop),outerDiv.appendChild(back);var cancel=document.createElement("input"),endpoint=this._getEndpoint();if(bbcode){var message=document.createElement("div");message.innerHTML=this.strings.uploading+"...",back.appendChild(message),this._ajax(endpoint+"save?api=1",function(error,content){if(error)message.innerHTML=this.strings.uploadError+": "+error;else{var result=eval("("+content+")");if(result.error||!result.codeid)message.innerHTML=this.strings.uploadError+":
"+result.error;else{message.innerHTML=this.strings.uploadSuccess+':
'+result.editurl+"";var sthis=this;cancel.onclick=function(){mapDiv.removeChild(outerDiv),callback.call(sthis,result.codeid)}}}},this,"title=&bbcode="+encodeURIComponent(bbcode).replace(/%20/g,"+"))}else{var descDiv=document.createElement("div");descDiv.innerHTML=this.strings.sharedFormHeader,back.appendChild(descDiv);var inputDiv=document.createElement("div"),url=document.createElement("input");url.type="text",url.size=40,inputDiv.appendChild(url);var urlBtn=document.createElement("input");urlBtn.type="button",urlBtn.value=this.strings.apply,inputDiv.appendChild(urlBtn),back.appendChild(inputDiv),url.focus();var errorDiv=document.createElement("div");errorDiv.style.color="#fcc",errorDiv.style.display="none",back.appendChild(errorDiv);var checkCode=function(){errorDiv.style.display="none";var t=new RegExp("(?:/|^)([a-z]+)\\s*$").exec(url.value);if(t){var e=t[1];this._ajax(endpoint+e+"?api=1",function(t,o){t?(errorDiv.innerHTML=this.strings.sharedFormError,errorDiv.style.display="block"):o.substring(0,15).indexOf('"error"')>0?(url.value="",errorDiv.innerHTML=this.strings.sharedFormInvalidCode,errorDiv.style.display="block"):(mapDiv.removeChild(outerDiv),callback.call(this,e))},this)}};L.DomEvent.on(urlBtn,"click",checkCode,this),L.DomEvent.on(url,"keypress",function(t){var e=window.event?(t||window.event).which:t.keyCode;13==e?checkCode.call(this):27==e&&mapDiv.removeChild(outerDiv)},this)}cancel.type="button",cancel.value=this.strings.close,cancel.style.marginTop="30px",cancel.onclick=function(){mapDiv.removeChild(outerDiv)},back.appendChild(cancel)}}),"mapBBCodeHandlers"in window||(window.mapBBCodeHandlers=[]),window.mapBBCodeHandlers.push({lineColors:{def:"#0022dd",blue:"#0022dd",red:"#bb0000",green:"#007700",brown:"#964b00",purple:"#800080",black:"#000000"},reKeys:new RegExp("^(blue|red|green|brown|purple|black)$"),applicableTo:function(t){return t instanceof L.Polygon||t instanceof L.Polyline},objectToLayer:function(t,e){var o=this.lineColors,i=e.length>0&&e[0]in o?o[e[0]]:o.def;t.options.color=i,t instanceof L.Polygon&&(t.options.fillColor=i)},layerToObject:function(t,e){return t._colorName?this.lineColors[t._colorName]!==this.lineColors.def?[t._colorName]:[]:e},initLayer:function(){},initDrawControl:function(t){t.options.draw.polyline.shapeOptions.color=this.lineColors.def,t.options.draw.polygon&&(t.options.draw.polygon.shapeOptions.color=this.lineColors.def)},createEditorPanel:function(t){var e,o=document.createElement("div"),i=[],n=this.lineColors;for(e in n)"string"==typeof n[e]&&"#"===n[e].substring(0,1)&&i.push(e);i=i.sort(),o.style.width=10+20*i.length+"px",o.textAlign="center";for(var r=function(e){var i=window.event&&window.event.srcElement||e.target||e.srcElement,n=i.style;if("white"==n.borderColor){t.setStyle({color:n.backgroundColor,fillColor:n.backgroundColor}),t._colorName=i._colorName;for(var r=o.childNodes,a=0;a0){var e=t[0].boundingbox;this._map.fitBounds(L.latLngBounds([[e[0],e[2]],[e[1],e[3]]]))}this._collapse()},_callbackId:0,_doSearch:function(t){var e="_l_osmgeocoder_"+this._callbackId++;window[e]=L.Util.bind(this._nominatimCallback,this);var o={q:t,format:"json",limit:1,json_callback:e};this.options.email&&(o.email=this.options.email),this._map.getBounds()&&(o.viewbox=this._map.getBounds().toBBoxString());var i="http://nominatim.openstreetmap.org/search"+L.Util.getParamString(o),n=document.createElement("script");n.type="text/javascript",n.src=i,document.getElementsByTagName("head")[0].appendChild(n)},_icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAL/wAAC/8Bk9f7AQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAOnSURBVGiB7ZhPaBxVHMc/vxezuzlsQqQqFf+Af8CLoWgsNHjoYjazbrR4SsGbgkcPInooLb1YRdBDQRCtCp6E3NLDZmendRXpaiC1kXqwh17EixQsmxATk935edhJHELczbydskOZz+m937zf+73v/Gbe+82IqnI3YQa9gLhJBSWdVFDSSQUlnVRQ0kkFJZ174p6wXC5nVXXC9/2RXC53bWFhYS3uGN2QOIrTQqFwKJPJnAGeB54GhoNLCtwAlowxHywuLt7oO1gP+hbkOM4rwGfA/T2GbojIKdd1z+sdLPH7EuQ4zufAGyHTH8BPIrKsqn8Dk8BR4KmdAar63fb29ov1en3TOnAXrN8hx3Fe5z8x/4jI2dHR0Y/m5+fb+4w9KSKfqOohETmezWbPAW/bxu6GVYbK5fJD7Xb7V2AMWPd9/5jnedd7+NzXbrd/BB4HfBE5Xq1Wf7BadRestu1Wq3WejhiAd3uJAahUKrdE5DU6G4VR1S9tYvcisiDpUAy6S7Va7dOD+gYZ+SLoPuk4zsNR4/cisqBisfgEkAdQVTfqjqWqi6H2ZNT4vbDJ0DOh7tWo/qq662OMGbwg4IGdhoj8GdV5fX39Fp33CN/3D1vE70pkQar6S6h9JKp/Pp+fAARARK5F9e+FjaAVgjssIs9axNz1McYsW/h3JbIgz/OawM2ge7JYLD5yUN9CoZAD3gy67WazuRI1fi+sziER+ThojhpjLhzUb3h4+D2CMkhVLzQajQ2b+F3XZlMpiIg4juOp6guB6auhoaG3KpXK6n7j5+bmhprN5jvAOTo3sRVUClesV/5/a7MtTmdnZx9ttVrXCc4k4HcROWOMuVKpVG4ClEqlw8BRVT1Np1ANc1tEpqvV6s+2i9+PvqrtmZmZIyLyNTCx59JtYAN4cI99E8iF+n/5vj/teV5su11fn+C1Wm1lbGzsORF5HwhX2ePsESMi36jqYyLihsz3GmMul0ql8GHdF7F8sUKnAm+1WseMMZNBSTOiqldFZBlYcl33N+jsdJlMZgGYCbnH9vjFJigKgaiLQDFkjkXUQP761Ov1za2trROAFzKPq+qlfh+/gWRoh6mpqZF8Pn8RmA6Z+8rUQP/LNRqNjbW1tRPApZC5r0wN/EfjjigRuRwyjwNnbeYbuCDoiFpdXX0Z+DYwfa+qr9rMlQhBsJupl1T1w2w2W3Zdd91mnoFuCneCxGQoLlJBSScVlHRSQUknFZR0UkFJ564T9C+LGmRQ/iQvLwAAAABJRU5ErkJggg=="}),L.control.search=function(t){return new L.Control.Search(t)},L.Control.StandardAttribution=L.Control.Attribution,L.Control.PermalinkAttribution=L.Control.Attribution.extend({onAdd:function(t){var e=L.Control.StandardAttribution.prototype.onAdd.call(this,t);return t.on("moveend",this._update,this),e},onRemove:function(t){t.off("moveend",this._update),L.Control.StandardAttribution.prototype.onRemove.call(this,t)},_update:function(){if(this._map){var t=[];for(var e in this._attributions)if(this._attributions[e]){if(e.indexOf("/openstreetmap.org")>0||e.indexOf("/www.openstreetmap.org")>0){var o="http://www.openstreetmap.org/#map={zoom}/{lat}/{lon}";if(e=e.replace(/(['"])http[^'"]+openstreetmap.org[^'"]*(['"])/,"$1"+o+"$2"),this._map.options.attributionEditLink){var i=o.replace("#","edit#");e=e.replace(/(openstreetmap.org[^'"]*(['"])[^>]*>[^<]+<\/a>)/,"$1 (Edit)")}}var n=this._map.getCenter();e=e.replace(/\{zoom\}/g,this._map.getZoom()).replace(/\{lat\}/g,L.Util.formatNum(n.lat,4)).replace(/\{lon\}/g,L.Util.formatNum(n.lng,4)),t.push(e)}var r=[];this.options.prefix&&r.push(this.options.prefix),t.length&&r.push(t.join(", ")),this._container.innerHTML=r.join(" | ")}}}),L.control.permalinkAttribution=function(t){return new L.Control.PermalinkAttribution(t)},L.Map.mergeOptions({attributionEditLink:!1}),L.Control.Attribution=L.Control.PermalinkAttribution,L.control.standardAttribution=L.control.attribution,L.control.attribution=L.control.permalinkAttribution,L.ExportControl=L.Control.extend({includes:L.Mixin.Events,options:{position:"topleft",name:"Export",title:"",endpoint:"http://share.mapbbcode.org/",codeid:"",filter:[],types:!1,titles:!1},onAdd:function(){var t=L.DomUtil.create("div","leaflet-bar"),e=document.createElement("div");t.appendChild(e);var o=L.DomUtil.create("a","",e);o.href="#",o.innerHTML=this.options.name,o.title=this.options.title||"",o.style.height="26px",o.style.width="auto",o.style.padding="0 4px";var i=this._variants=document.createElement("div");i.style.display="none",i.style.position="absolute",i.style.left="50px",i.style.top="0px",i.style.width="200px",i.style.padding="0 6px",i.style.backgroundColor="white",i.style.zIndex=-10,t.appendChild(i);var n=L.DomEvent.stopPropagation;return L.DomEvent.on(o,"click",n).on(o,"mousedown",n).on(o,"dblclick",n).on(o,"click",L.DomEvent.preventDefault).on(o,"click",function(){i.style.display="block"==i.style.display?"none":"block"}),this.options.types&&this.options.titles?this._updateVariants():this._ajax(this.options.endpoint+"fmtlist",function(t){t&&t.types&&t.titles&&this._updateTypesAndTitles(t.types,t.titles)},this),t},_updateTypesAndTitles:function(t,e){if(t&&e&&t.length&&t.length==e.length){var o=this.options.filter;if(o&&o.length){var i,n,r=[],a=[];for(i=0;i0&&n.appendChild(document.createTextNode(" | "));var r=document.createElement("a");r.style.display="inline",r.style.width="auto",r.style.color="blue",r.style.border="none",r.style.textDecoration="none",r.innerHTML=o[t];var a=L.DomEvent.stopPropagation;i?(r.href=this.options.endpoint+i+"?format="+e[t],L.DomEvent.on(r,"click",a).on(r,"mousedown",a).on(r,"dblclick",a).on(r,"click",this._linkClick,this)):(r.href="#",r._etype=e[t],L.DomEvent.on(r,"click",a).on(r,"mousedown",a).on(r,"dblclick",a).on(r,"click",L.DomEvent.preventDefault).on(r,"click",this._linkClick,this)),n.appendChild(r)}},_linkClick:function(t){var e=window.event&&window.event.srcElement||t.target||t.srcElement;this._variants.style.display="none",this.fire("export",{fmt:e._etype})},_ajax:function(url,callback,context){function respond(){var st=http.status;if(!st&&http.responseText||st>=200&&300>st)try{var result=eval("("+http.responseText+")");callback.call(context,result)}catch(err){}}var http;if(window.XMLHttpRequest&&(http=new window.XMLHttpRequest),!window.XDomainRequest||http&&"withCredentials"in http||(http=new window.XDomainRequest),http){"onload"in http?http.onload=http.onerror=respond:http.onreadystatechange=function(){4==http.readyState&&respond()};try{http.open("GET",url,!0),http.send(null)}catch(err){}}}}),L.exportControl=function(t){return new L.ExportControl(t)},L.StaticLayerSwitcher=L.Control.extend({includes:L.Mixin.Events,options:{position:"topright",editable:!1,bgColor:"white",selectedColor:"#ddd",enforceOSM:!1,maxLayers:7},initialize:function(t,e){if(L.setOptions(this,e),this._layers=[],this._selected=0,this._layerList=window.layerList&&"isOpenStreetMapLayer"in window.layerList,t)if("push"in t&&"splice"in t)for(var o=0;o0&&this._selected0&&this._selected=0&&this._layers[o];if(i&&i.id!==e){if(i.id=e,i.fromList){var n=this._map&&this._map.hasLayer(t),r=this._layerList?window.layerList.getLeafletLayer(e):null;n&&this._map.removeLayer(t),r?(i.layer=r,n&&this._map.addLayer(r)):this._layers.splice(o,1)}return this._update(),t}return null},addLayer:function(t,e){if(!(this._layers.length>=this.options.maxLayers)){var o=e||this._layerList&&window.layerList.getLeafletLayer(t);if(o){this._layers.push({id:t,layer:o,fromList:!e});var i=this._findFirstOSMLayer();if(i>0){var n=this._layers[i];this._layers[i]=this._layers[0],this._layers[0]=n}return this._map&&this._addMandatoryOSMLayer(),this._update(),this.fire("layerschanged",{layers:this.getLayerIds()}),1==this._layers.length&&this.fire("selectionchanged",{selected:this.getSelectedLayer(),selectedId:this.getSelectedLayerId()}),e}return null}},removeLayer:function(t){var e=this._findLayer(t);if(e>=0){var o=this._selected==e;if(o&&this._map.removeLayer(t),this._layers.splice(e,1),0===e){var i=this._findFirstOSMLayer();if(i>0){var n=this._layers[i];this._layers[i]=this._layers[0],this._layers[0]=n}}return this._selected>=this._layers.length&&this._selected>0&&(this._selected=this._layers.length-1),this._addMandatoryOSMLayer(),this._update(),this.fire("layerschanged",{layers:this.getLayerIds()}),o&&this.fire("selectionchanged",{selected:this.getSelectedLayer(),selectedId:this.getSelectedLayerId()}),t}return null},moveLayer:function(t,e){var o=this._findLayer(t),i=e?o+1:o-1;if(o>=0&&i>=0&&i1))return;i=n}var r=this._layers[o];this._layers[o]=this._layers[i],this._layers[i]=r,o==this._selected?this._selected=i:i==this._selected&&(this._selected=o),this._update(),this.fire("layerschanged",{layers:this.getLayerIds()})}},_findFirstOSMLayer:function(t){if(!this._layerList||!this.options.enforceOSM)return t||0;for(var e=t||0;e=this._layers.length&&(e=-1),e},_addMandatoryOSMLayer:function(){if(this.options.enforceOSM&&this._layers.length>0&&this._findFirstOSMLayer()<0){var t=L.tileLayer("http://tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'Map © OpenStreetMap',minZoom:0,maxZoom:19});this._selectedPlease contact an administrator.",sharedFormInvalidCode:"Map code is invalid",sharedCodeLoading:'Downloading a map...',sharedCodeError:'Failed to download an external map

Open map in a new window',polylineTitle:"Draw a path",polygonTitle:"Draw a polygon",markerTitle:"Add a marker",drawCancelTitle:"Cancel drawing",undoPoint:"Delete last point",undoPointTitle:"Delete last point drawn",markerTooltip:"Click map to place marker",polylineStartTooltip:"Click to start drawing a line",polylineContinueTooltip:"Click to continue drawing line",polylineEndTooltip:"Click the last point to finish line",polygonStartTooltip:"Click to start drawing a polygon",polygonContinueTooltip:"Click to continue drawing polygon",polygonEndTooltip:"Click the last point to close this polygon",deleteLastPoint:"Delete last point",deleteLastPointTooltip:"Delete last point drawn",singleLength:"Length of this line",totalLength:"Total length",helpContents:'Map BBCode Editor\n\nSince you have already activated the editor, you know the drill. There are buttons for markers and geometry, you click the map and objects appear, they have popups activated by clicking, from which you can change some properties, like color. To save the drawing click "Apply", otherwise there is a "Cancel" button.\nWhat you should know is that you are editing not the map, but the underlying bbcode, with all restrictions it imposes. Map BBCode is a text string, which you can copy and paste to different services, and edit directly. The syntax of it is quite simple: [map]...[/map] tags with a list of objects as coordinate sequences and attributes. When a cursor is inside bbcode, the editor is opened with a drawing it represents, otherwise it will be empty.\nFor a complete manual see User\'s Guide on the official MapBBCode site.\n\n# Navigating the map\nHere are some hints for using map panels. Keyboard arrows work when a map is in focus. Shift+drag with a mouse to quickly zoom into an area, shift+zoom buttons to change zoom 3 steps at a time. Use the layer switcher at the top right corner to see the drawing on a different map. Mouse wheel is disabled in the viewer, but can be used in the editor to quickly zoom in or out. Use the button with a magnifier to navigate to a named place or a road.\n\n# External maps\nIf the feature is not disabled by an administrator, you can upload your maps to a server, share.mapbbcode.org by default, with an "Upload" button. If you click it not having drawn anything, it will ask for a map URL or identifier. Those are converted to [mapid]id[/mapid] bbcode, which looks like a regular map, but with an export button: users can download a drawing as GPX or CSV or in any other format. If you share an edit link for a map, others can join in, and changes will be reflected in embedded maps.\n\n# Plugin\nMapBBCode is an open source javascript library with plugins around it available for some forum and blog engines. Its goal is to make sharing maps easier. This is version {version}.\n'}})}(window,document); \ No newline at end of file +!function(window,document,undefined){var L=window.L;window.MapBBCodeProcessor={options:{decimalDigits:5,brackets:"[]",tagParams:!1,shareTag:"mapid"},setOptions:function(t){for(var e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e])},_getRegExp:function(){var t=this.options.brackets.substring(0,1).replace(/([\[\({])/,"\\$1"),e=this.options.brackets.substring(1,2).replace(/([\]\)}])/,"\\$1"),o="\\s*(-?\\d+(?:\\.\\d+)?)\\s*,\\s*(-?\\d+(?:\\.\\d+)?)",i="\\((?:([a-zA-Z0-9,]*)\\|)?(|[\\s\\S]*?[^\\\\])\\)",n=o+"(?:"+o+")*(?:\\s*"+i+")?",r=t+"map(?:"+(this.options.tagParams?"\\s+z=['\"]([12]?\\d)['\"](?:\\s+ll=['\"]"+o+"['\"])?":"=['\"]?([12]?\\d)(?:,"+o+")?")+")?['\"]?"+e,a=t+"map"+e+"\\s*"+t+"/map"+e,s=r+"("+n+"(?:\\s*;"+n+")*)?\\s*"+t+"/map"+e;return{coord:o,params:i,mapElement:n,map:s,mapEmptyCompiled:new RegExp(a,"i"),mapCompiled:new RegExp(s,"i")}},getOpenTagSubstring:function(){return this.options.brackets.substring(0,1)+"map"},getOpenTagWithPart:function(t){return this.options.brackets.substring(0,1)+"map"+(t&&t.length>0?(this.options.tagParams?" "==t.substring(0,1)?"":" ":"="==t.substring(0,1)?"":"=")+t:"")+this.options.brackets.substring(1,2)},getOpenTag:function(t,e){return this.options.brackets.substring(0,1)+"map"+(t||"0"===t?this.options.tagParams?' z="'+t+'"'+(e?' ll="'+e+'"':""):"="+t+(e?","+e:""):"")+this.options.brackets.substring(1,2)},getCloseTag:function(){return this.options.brackets.substring(0,1)+"/map"+this.options.brackets.substring(1,2)},getShareTag:function(t){var e=this.options.brackets.substring(0,1),o=this.options.brackets.substring(1,2),i=this.options.shareTag||"mapid";return t?e+i+o+t+e+"/"+i+o:e+i+o},getBBCodeRegExp:function(){return this._getRegExp().mapCompiled},isValid:function(t){return this._getRegExp().mapCompiled.test(t)},isEmpty:function(t){return this._getRegExp().mapEmptyCompiled.test(t)},stringToObjects:function(t){var e=this._getRegExp(),o=t.match(e.mapCompiled),i={objs:[]};if(o&&o[1]&&o[1].length&&+o[1]>0&&(i.zoom=+o[1],o[3]&&o[3].length>0))try{i.pos=L&&L.LatLng?new L.LatLng(o[2],o[3]):[+o[2],+o[3]]}catch(n){}if(o&&o[4]){var r,a=o[4],s=new RegExp("^\\s*(?:;\\s*)?("+e.mapElement+")"),l=new RegExp("^"+e.coord);for(r=a.match(s);r;){var d,p=r[1],c=[],h="",u=[];for(d=p.match(l);d;)c.push(L&&L.LatLng?new L.LatLng(d[1],d[2]):[+d[1],+d[2]]),p=p.substring(d[0].length),d=p.match(l);r[6]&&(u=r[6].split(",")),"string"==typeof r[7]&&r[7].length>0&&(h=r[7].replace(/\\\)/g,")").replace(/^\s+|\s+$/g,"")),i.objs.push({coords:c,text:h,params:u}),a=a.substring(r[0].length),r=a.match(s)}}return i},objectsToString:function(t){var e,o;t.zoom>0&&(e=t.zoom,t.pos&&(o=this._latLngToString(t.pos)));for(var i=[],n=[],r=t.objs||[],a=0;a0&&(l+=" "),l+=this._latLngToString(s[d]);var p=r[a].text||"",c=r[a].params||[];p.indexOf("|")>=0&&0===c.length&&(p="|"+p),(p.length>0||c.length>0)&&(l=l+"("+(c.length>0?c.join(",")+"|":"")+p.replace(/\)/g,"\\)")+")"),s.length&&(1==s.length?i.push(l):n.push(l))}return i.length||n.length||e?this.getOpenTag(e,o)+i.concat(n).join("; ")+this.getCloseTag():""},_latLngToString:function(t){var e=Math.pow(10,this.options.decimalDigits);return""+Math.round((t.lat||t[0])*e)/e+","+Math.round((t.lng||t[1])*e)/e}},window.MapBBCode=L.Class.extend({options:{createLayers:null,layers:null,maxInitialZoom:15,defaultPosition:[22,11],defaultZoom:2,leafletOptions:{},polygonOpacity:.1,editorHeight:400,viewWidth:600,viewHeight:300,fullViewHeight:600,fullScreenButton:!0,fullFromStart:!1,windowWidth:800,windowHeight:500,windowFeatures:"resizable,status,dialog",windowPath:"lib/mapbbcode-window.html",editorCloseButtons:!0,confirmFormSubmit:!0,outerLinkTemplate:!1,helpButton:!0,allowedHTML:"[auib]|span|br|em|strong|tt",letterIconLength:2,popupIconLength:30,enablePolygons:!0,preferStandardLayerSwitcher:!0,hideInsideClasses:[],watchResize:!1,panelHook:null,externalEndpoint:"http://share.mapbbcode.org/",exportTypes:"csv,geojson,gpx,plt,wpt,kml",uploadButton:!1},strings:{},initialize:function(t){L.setOptions(this,t),L.Browser.ie&&t&&t.defaultPosition&&"splice"in t.defaultPosition&&2==t.defaultPosition.length&&(this.options.defaultPosition=[t.defaultPosition[0],t.defaultPosition[1]])},setStrings:function(t){this.strings=L.extend({},this.strings,t)},_eachHandler:function(t,e,o){var i=window.mapBBCodeHandlers;if(i)for(var n=0;n2&&t.coords[0].equals(t.coords[t.coords.length-1])?(t.coords.splice(t.coords.length-1,1),e=L.polygon(t.coords,{weight:3,opacity:.7,fill:!0,fillOpacity:this.options.polygonOpacity})):e=L.polyline(t.coords,{weight:5,opacity:.7}),this._eachHandler(function(o){if("objectToLayer"in o){var i=[];if("reKeys"in o)for(var n=0;ne&&t.setZoom(e,{animate:!1})}},a=t.getBoundsZoom(n,!1);a?r.call(this):t.on("load",r,this)},createOpenStreetMapLayer:function(t){var e=t||L;return e.tileLayer("http://tile.openstreetmap.org/{z}/{x}/{y}.png",{name:"OpenStreetMap",attribution:'Map © OpenStreetMap',minZoom:2,maxZoom:18})},_addLayers:function(t){var e=this.options.createLayers?this.options.createLayers.call(this,L):null;if(e&&e.length||!window.layerList||!this.options.layers||(e=window.layerList.getLeafletLayers(this.options.layers,L)),e&&e.length||(e=[this.createOpenStreetMapLayer(L)]),t.addLayer(e[0]),e.length>1){var o,i;if(!this.options.preferStandardLayerSwitcher&&L.StaticLayerSwitcher)for(o=L.staticLayerSwitcher(null,{enforceOSM:!0}),i=0;iMapBBCode'),this._addLayers(i);var n=new L.FeatureGroup;n.addTo(i);for(var r=window.MapBBCodeProcessor.stringToObjects(e),a=r.objs,s=0;s0&&"position"in t[0]&&(e={position:t[0].position}),L.Control.prototype.initialize.call(this,e)},onAdd:function(t){this._map=t,this._links=[];for(var e=L.DomUtil.create("div","leaflet-bar"),o=0;o=this._buttons.length)){var e=this._buttons[t],o=e.link,i=e.content;if(o)if(i===undefined||i===!1||null===i||""===i)o.innerHTML=e.alt||" ";else if("string"==typeof i){var n=i.length<4?"":i.substring(i.length-4),r="data:image/"===i.substring(0,11);".png"===n||".gif"===n||".jpg"===n||r?(o.style.width=""+(e.imageSize||26)+"px",o.style.height=""+(e.imageSize||26)+"px",o.style.padding="0",o.style.backgroundImage="url("+i+")",o.style.backgroundRepeat="no-repeat",o.style.backgroundPosition=e.bgPos?-e.bgPos[0]+"px "+-e.bgPos[1]+"px":"0px 0px"):o.innerHTML=i}else{for(;o.firstChild;)o.removeChild(o.firstChild);o.appendChild(i)}}},setContent:function(t,e){e===undefined&&(e=t,t=0),t])","g"),"<"))}else t.options.clickable=!1},_getIcon:function(t,e,o){if(t instanceof L.Marker&&e.length>0){if(L.LetterIcon&&e.length<=o.options.letterIconLength)return new L.LetterIcon(e);if(L.PopupIcon&&e.length<=o.options.popupIconLength&&e.indexOf("<")<0)return new L.PopupIcon(e)}},layerToObject:function(t){return t.inputField?t.inputField.value.replace(/\\n/g,"\n").replace(/\\\n/g,"\\n"):t._text||""},createEditorPanel:function(t,e){if(t instanceof L.Marker){var o=document.createElement("div"),i=document.createTextNode(e.strings.title+": "),n=document.createElement("input");return n.type="text",n.size=20,t._text&&(n.value=t._text.replace(/\\n/g,"\\\\n").replace(/[\r\n]+/g,"\\n")),o.appendChild(i),o.appendChild(n),o.style.marginBottom="8px",t.inputField=n,t.options.draggable=!0,t.defaultIcon=new L.Icon.Default,n.onkeypress=function(e){var o=window.event?(e||window.event).which:e.keyCode;return 27==o||13==o?(t.closePopup(),e.preventDefault(),!1):void 0},t.on("popupopen",function(){n.focus()}),t.on("popupclose",function(){var o=t.inputField.value,i=this._getIcon(t,o,e)||t.defaultIcon;t.setIcon(i)},this),o}}}),window.MapBBCode.include({layerToObject:function(t){var e={};if(t instanceof L.Marker)e.coords=[t.getLatLng()];else if(t.getLatLngs){var o,i=t.getLatLngs(),n=i.length,r=[];for(o=0;n>o;o++)r.push(i[o]);t instanceof L.Polygon&&r.push(r[0]),e.coords=r}return e.params=t._objParams||[],this._eachHandler(function(o){if(o.text&&"layerToObject"in o){var i=o.layerToObject(t,"",this);i&&(e.text=i)}else if("layerToObject"in o){var n,r=[];if("reKeys"in o)for(n=e.params.length-1;n>=0;n--)o.reKeys.test(e.params[n])&&r.unshift(e.params.splice(n,1));var a=o.layerToObject(t,r,this);if(a&&a.length>0)for(n=0;n0&&(window.confirm(this.strings.submitWarning)||L.DomEvent.preventDefault(i))}},this)},_findMapInTextArea:function(t){var e=window.MapBBCodeProcessor.getOpenTagSubstring(),o=window.MapBBCodeProcessor.getCloseTag(),i=t.value,n="selectionStart"in t?t.selectionStart:i.indexOf(o);if(n>=i.length||i.length<10||i.indexOf(o)<0)return"";var r=i.lastIndexOf(e,n);if(r>=0){var a=i.indexOf(o,r);if(a+o.length>n){var s=i.substring(r,a+6);if(window.MapBBCodeProcessor.isValid(s))return s}}return""},_updateMapInTextArea:function(t,e,o){var i=t.selectionStart,n=t.value;t.value=e.length&&n.indexOf(e)>=0?n.replace(e,o):!("selectionStart"in t)||i>=n.length?n+o:n.substring(0,i)+o+n.substring(i)},_getBBCode:function(t,e){var o=[];e.eachLayer(function(t){o.push(this.layerToObject(t))},this);var i=!o.length||t.wasPositionSet;return window.MapBBCodeProcessor.objectsToString({objs:o,zoom:i?t.getZoom():0,pos:i?t.getCenter():0})},editor:function(t,e,o,i){var n=this._createMapPanel(t,!0);if(n){var r=this.strings,a=L.map(n,L.extend({},{zoomControl:!1},this.options.leafletOptions));a.addControl(new L.Control.Zoom({zoomInTitle:r.zoomInTitle,zoomOutTitle:r.zoomOutTitle})),a.attributionControl&&a.attributionControl.setPrefix('MapBBCode'),L.Control.Search&&a.addControl(new L.Control.Search({title:r.searchTitle})),this._addLayers(a);var s;"string"!=typeof e&&(s=e,e=this._findMapInTextArea(s));for(var l=new L.FeatureGroup,d=window.MapBBCodeProcessor.stringToObjects(e),p=d.objs,c=0;c0&&!!d.pos;var h=L.drawLocal.draw.toolbar,u=L.drawLocal.draw.handlers;h.actions.text=r.cancel,h.actions.title=r.drawCancelTitle,h.undo.text=r.undoPoint,h.undo.title=r.undoPointTitle,h.buttons.polyline=r.polylineTitle,h.buttons.polygon=r.polygonTitle,h.buttons.marker=r.markerTitle,u.marker.tooltip.start=r.markerTooltip,u.polyline.tooltip.start=r.polylineStartTooltip,u.polyline.tooltip.cont=r.polylineContinueTooltip,u.polyline.tooltip.end=r.polylineEndTooltip,u.polygon.tooltip.start=r.polygonStartTooltip,u.polygon.tooltip.cont=r.polygonContinueTooltip,u.polygon.tooltip.end=r.polygonEndTooltip;var g=new L.Control.Draw({position:"topleft",draw:{marker:!0,polyline:{showLength:!1,guidelineDistance:10,shapeOptions:{color:"#0033FF",weight:5,opacity:.7}},polygon:this.options.enablePolygons?{showArea:!1,guidelineDistance:10,shapeOptions:{color:"#0033FF",weight:3,opacity:.7,fillOpacity:this.options.polygonOpacity}}:!1,rectangle:!1,circle:!1},edit:{featureGroup:l,edit:!1,remove:!1}});if(this._eachHandler(function(t){"initDrawControl"in t&&t.initDrawControl(g)}),a.addControl(g),a.on("draw:created",function(t){var e=t.layer;this._eachHandler(function(t){"initLayer"in t&&t.initLayer(e)},this,e),this._makeEditable(e,l),l.addLayer(e),"marker"===t.layerType&&e.openPopup()},this),this.options.editorCloseButtons){var m=L.functionButtons([{content:""+r.apply+"",title:r.applyTitle}],{position:"topleft"});if(m.on("clicked",function(){var t=this._getBBCode(a,l);n.close(),s&&this._updateMapInTextArea(s,e,t),o&&o.call(i,t)},this),a.addControl(m),this.options.uploadButton&&this._upload){var f=L.functionButtons([{content:r.upload,title:r.uploadTitle}],{position:"topleft"});f.on("clicked",function(){this._upload(n,l.getLayers().length?this._getBBCode(a,l):!1,function(t){n.close();var r=window.MapBBCodeProcessor.getShareTag(t);s&&this._updateMapInTextArea(s,e,r),o&&o.call(i,r)})},this),a.addControl(f)}var y=L.functionButtons([{content:r.cancel,title:r.cancelTitle}],{position:"topright"});y.on("clicked",function(){n.close(),o&&o.call(i,null)},this),a.addControl(y)}if(this.options.helpButton){var v=L.functionButtons([{content:'?',title:r.helpTitle}],{position:"topright"});v.on("clicked",function(){for(var t="",e=r.helpContents.split(/\n+/),o="1.2.0-dev",i="resizable,dialog,scrollbars,height="+this.options.windowHeight+",width="+this.options.windowWidth,n=window.open("","mapbbcode_help",i),a=0;a"+e[a].replace(/^#\s*/,"")+"":"

"+e[a]+"

":"

"+e[0]+"

";t=t.replace("{version}",o),t+='
';var s="";n.document.open(),n.document.write(s),n.document.write(t),n.document.close(),n.onkeypress=function(t){var e=window.event?(t||window.event).which:t.keyCode;27==e&&n.close()}},this),a.addControl(v)}return this.options.confirmFormSubmit&&this._addSubmitHandler(a,l),this._createControlAndCallHooks(n,a,l,{editor:!0,close:function(){var t=this.getBBCode();this.map=this._ui=null,this.getBBCode=function(){return t},n.close()},getBBCode:function(){return this._ui._getBBCode(a,l)},updateBBCode:function(t,e){var o=window.MapBBCodeProcessor.stringToObjects(t),i=o.objs;l.clearLayers(),a.removeLayer(l);for(var n=0;n=200&&300>t?!1:t||499,r.responseText)}var r;if(window.XMLHttpRequest&&(r=new window.XMLHttpRequest),!window.XDomainRequest||r&&"withCredentials"in r||(r=new window.XDomainRequest),r){"onload"in r?r.onload=r.onerror=n:r.onreadystatechange=function(){4==r.readyState&&n()};try{i?(r.open("POST",t,!0),r.setRequestHeader("Content-type","application/x-www-form-urlencoded"),r.send(i)):(r.open("GET",t,!0),r.send(null))}catch(a){e.call(o,399)}}},showExternal:function(element,id,callback,context){var endpoint=this._getEndpoint();if(endpoint&&id){var errorDiv=this._createMapPanel(element);errorDiv.style.display="table";var cell=document.createElement("div");cell.style.display="table-cell",cell.style.width="100%",cell.style.backgroundColor="#ddd",cell.style.textAlign="center",cell.style.verticalAlign="middle",cell.innerHTML=this.strings.sharedCodeLoading.replace("{url}",endpoint+id),errorDiv.appendChild(cell);var showMap=function(error,content){var show,result,derror=!1;if(error?derror=!0:result=eval("("+content+")"),error||result.error||!result.bbcode)cell.innerHTML=this.strings.sharedCodeError.replace("{url}",endpoint+id),show={close:function(){errorDiv.close()}};else if(show=this.show(element,result.bbcode),result.title,show){var map=show.map;if(this.options.outerLinkTemplate||map.addControl(L.functionButtons([{content:window.MapBBCode.buttonsImage,bgPos:[52,0],href:endpoint+id,alt:"↷",title:this.strings.outerTitle}],{position:"topright"})),L.ExportControl){var ec=new L.ExportControl({name:this.strings.exportName,title:this.strings.exportTitle,filter:"string"==typeof this.options.exportTypes&&this.options.exportTypes.length>0?this.options.exportTypes.split(","):this.options.exportTypes,endpoint:endpoint,codeid:id});map.addControl(ec)}}callback&&callback.call(context||this,show)};this._ajax(endpoint+id+"?api=1",showMap,this)}},_upload:function(mapDiv,bbcode,callback){var outerDiv=document.createElement("div");outerDiv.style.display="table";try{outerDiv.style.backgroundColor="rgba(0, 0, 0, 0.8)"}catch(err){outerDiv.style.backgroundColor="black"}outerDiv.style.zIndex=2e3,outerDiv.style.position="absolute",outerDiv.style.left=outerDiv.style.right=outerDiv.style.top=outerDiv.style.bottom=0,outerDiv.style.width=outerDiv.style.height="100%",mapDiv.appendChild(outerDiv);var back=document.createElement("div");back.style.width=back.style.height="100%",back.style.textAlign="center",back.style.color="white",back.style.verticalAlign="middle",back.style.display="table-cell",back.style.cursor="default";var stop=L.DomEvent.stopPropagation;L.DomEvent.on(back,"click",stop).on(back,"mousedown",stop).on(back,"dblclick",stop),outerDiv.appendChild(back);var cancel=document.createElement("input"),endpoint=this._getEndpoint();if(bbcode){var message=document.createElement("div");message.innerHTML=this.strings.uploading+"...",back.appendChild(message),this._ajax(endpoint+"save?api=1",function(error,content){if(error)message.innerHTML=this.strings.uploadError+": "+error;else{var result=eval("("+content+")");if(result.error||!result.codeid)message.innerHTML=this.strings.uploadError+":
"+result.error;else{message.innerHTML=this.strings.uploadSuccess+':
'+result.editurl+"";var sthis=this;cancel.onclick=function(){mapDiv.removeChild(outerDiv),callback.call(sthis,result.codeid)}}}},this,"title=&bbcode="+encodeURIComponent(bbcode).replace(/%20/g,"+"))}else{var descDiv=document.createElement("div");descDiv.innerHTML=this.strings.sharedFormHeader,back.appendChild(descDiv);var inputDiv=document.createElement("div"),url=document.createElement("input");url.type="text",url.size=40,inputDiv.appendChild(url);var urlBtn=document.createElement("input");urlBtn.type="button",urlBtn.value=this.strings.apply,inputDiv.appendChild(urlBtn),back.appendChild(inputDiv),url.focus();var errorDiv=document.createElement("div");errorDiv.style.color="#fcc",errorDiv.style.display="none",back.appendChild(errorDiv);var checkCode=function(){errorDiv.style.display="none";var t=new RegExp("(?:/|^)([a-z]+)\\s*$").exec(url.value);if(t){var e=t[1];this._ajax(endpoint+e+"?api=1",function(t,o){t?(errorDiv.innerHTML=this.strings.sharedFormError,errorDiv.style.display="block"):o.substring(0,15).indexOf('"error"')>0?(url.value="",errorDiv.innerHTML=this.strings.sharedFormInvalidCode,errorDiv.style.display="block"):(mapDiv.removeChild(outerDiv),callback.call(this,e))},this)}};L.DomEvent.on(urlBtn,"click",checkCode,this),L.DomEvent.on(url,"keypress",function(t){var e=window.event?(t||window.event).which:t.keyCode;13==e?checkCode.call(this):27==e&&mapDiv.removeChild(outerDiv)},this)}cancel.type="button",cancel.value=this.strings.close,cancel.style.marginTop="30px",cancel.onclick=function(){mapDiv.removeChild(outerDiv)},back.appendChild(cancel)}}),"mapBBCodeHandlers"in window||(window.mapBBCodeHandlers=[]),window.mapBBCodeHandlers.push({lineColors:{def:"#0022dd",blue:"#0022dd",red:"#bb0000",green:"#007700",brown:"#964b00",purple:"#800080",black:"#000000"},reKeys:new RegExp("^(blue|red|green|brown|purple|black)$"),applicableTo:function(t){return t instanceof L.Polygon||t instanceof L.Polyline},objectToLayer:function(t,e){var o=this.lineColors,i=e.length>0&&e[0]in o?o[e[0]]:o.def;t.options.color=i,t instanceof L.Polygon&&(t.options.fillColor=i)},layerToObject:function(t,e){return t._colorName?this.lineColors[t._colorName]!==this.lineColors.def?[t._colorName]:[]:e},initLayer:function(){},initDrawControl:function(t){t.options.draw.polyline.shapeOptions.color=this.lineColors.def,t.options.draw.polygon&&(t.options.draw.polygon.shapeOptions.color=this.lineColors.def)},createEditorPanel:function(t){var e,o=document.createElement("div"),i=[],n=this.lineColors;for(e in n)"string"==typeof n[e]&&"#"===n[e].substring(0,1)&&i.push(e);i=i.sort(),o.style.width=10+20*i.length+"px",o.textAlign="center";for(var r=function(e){var i=window.event&&window.event.srcElement||e.target||e.srcElement,n=i.style;if("white"==n.borderColor){t.setStyle({color:n.backgroundColor,fillColor:n.backgroundColor}),t._colorName=i._colorName;for(var r=o.childNodes,a=0;a0){var e=t[0].boundingbox;this._map.fitBounds(L.latLngBounds([[e[0],e[2]],[e[1],e[3]]]))}this._collapse()},_callbackId:0,_doSearch:function(t){var e="_l_osmgeocoder_"+this._callbackId++;window[e]=L.Util.bind(this._nominatimCallback,this);var o={q:t,format:"json",limit:1,json_callback:e};this.options.email&&(o.email=this.options.email),this._map.getBounds()&&(o.viewbox=this._map.getBounds().toBBoxString());var i="http://nominatim.openstreetmap.org/search"+L.Util.getParamString(o),n=document.createElement("script");n.type="text/javascript",n.src=i,document.getElementsByTagName("head")[0].appendChild(n)},_icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAL/wAAC/8Bk9f7AQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAOnSURBVGiB7ZhPaBxVHMc/vxezuzlsQqQqFf+Af8CLoWgsNHjoYjazbrR4SsGbgkcPInooLb1YRdBDQRCtCp6E3NLDZmendRXpaiC1kXqwh17EixQsmxATk935edhJHELczbydskOZz+m937zf+73v/Gbe+82IqnI3YQa9gLhJBSWdVFDSSQUlnVRQ0kkFJZ174p6wXC5nVXXC9/2RXC53bWFhYS3uGN2QOIrTQqFwKJPJnAGeB54GhoNLCtwAlowxHywuLt7oO1gP+hbkOM4rwGfA/T2GbojIKdd1z+sdLPH7EuQ4zufAGyHTH8BPIrKsqn8Dk8BR4KmdAar63fb29ov1en3TOnAXrN8hx3Fe5z8x/4jI2dHR0Y/m5+fb+4w9KSKfqOohETmezWbPAW/bxu6GVYbK5fJD7Xb7V2AMWPd9/5jnedd7+NzXbrd/BB4HfBE5Xq1Wf7BadRestu1Wq3WejhiAd3uJAahUKrdE5DU6G4VR1S9tYvcisiDpUAy6S7Va7dOD+gYZ+SLoPuk4zsNR4/cisqBisfgEkAdQVTfqjqWqi6H2ZNT4vbDJ0DOh7tWo/qq662OMGbwg4IGdhoj8GdV5fX39Fp33CN/3D1vE70pkQar6S6h9JKp/Pp+fAARARK5F9e+FjaAVgjssIs9axNz1McYsW/h3JbIgz/OawM2ge7JYLD5yUN9CoZAD3gy67WazuRI1fi+sziER+ThojhpjLhzUb3h4+D2CMkhVLzQajQ2b+F3XZlMpiIg4juOp6guB6auhoaG3KpXK6n7j5+bmhprN5jvAOTo3sRVUClesV/5/a7MtTmdnZx9ttVrXCc4k4HcROWOMuVKpVG4ClEqlw8BRVT1Np1ANc1tEpqvV6s+2i9+PvqrtmZmZIyLyNTCx59JtYAN4cI99E8iF+n/5vj/teV5su11fn+C1Wm1lbGzsORF5HwhX2ePsESMi36jqYyLihsz3GmMul0ql8GHdF7F8sUKnAm+1WseMMZNBSTOiqldFZBlYcl33N+jsdJlMZgGYCbnH9vjFJigKgaiLQDFkjkXUQP761Ov1za2trROAFzKPq+qlfh+/gWRoh6mpqZF8Pn8RmA6Z+8rUQP/LNRqNjbW1tRPApZC5r0wN/EfjjigRuRwyjwNnbeYbuCDoiFpdXX0Z+DYwfa+qr9rMlQhBsJupl1T1w2w2W3Zdd91mnoFuCneCxGQoLlJBSScVlHRSQUknFZR0UkFJ564T9C+LGmRQ/iQvLwAAAABJRU5ErkJggg=="}),L.control.search=function(t){return new L.Control.Search(t)},L.Control.StandardAttribution=L.Control.Attribution,L.Control.PermalinkAttribution=L.Control.Attribution.extend({onAdd:function(t){var e=L.Control.StandardAttribution.prototype.onAdd.call(this,t);return t.on("moveend",this._update,this),e},onRemove:function(t){t.off("moveend",this._update),L.Control.StandardAttribution.prototype.onRemove.call(this,t)},_update:function(){if(this._map){var t=[];for(var e in this._attributions)if(this._attributions[e]){if(e.indexOf("/openstreetmap.org")>0||e.indexOf("/www.openstreetmap.org")>0){var o="http://www.openstreetmap.org/#map={zoom}/{lat}/{lon}";if(e=e.replace(/(['"])http[^'"]+openstreetmap.org[^'"]*(['"])/,"$1"+o+"$2"),this._map.options.attributionEditLink){var i=o.replace("#","edit#");e=e.replace(/(openstreetmap.org[^'"]*(['"])[^>]*>[^<]+<\/a>)/,"$1 (Edit)")}}var n=this._map.getCenter();e=e.replace(/\{zoom\}/g,this._map.getZoom()).replace(/\{lat\}/g,L.Util.formatNum(n.lat,4)).replace(/\{lon\}/g,L.Util.formatNum(n.lng,4)),t.push(e)}var r=[];this.options.prefix&&r.push(this.options.prefix),t.length&&r.push(t.join(", ")),this._container.innerHTML=r.join(" | ")}}}),L.control.permalinkAttribution=function(t){return new L.Control.PermalinkAttribution(t)},L.Map.mergeOptions({attributionEditLink:!1}),L.Control.Attribution=L.Control.PermalinkAttribution,L.control.standardAttribution=L.control.attribution,L.control.attribution=L.control.permalinkAttribution,L.ExportControl=L.Control.extend({includes:L.Mixin.Events,options:{position:"topleft",name:"Export",title:"",endpoint:"http://share.mapbbcode.org/",codeid:"",filter:[],types:!1,titles:!1},onAdd:function(){var t=L.DomUtil.create("div","leaflet-bar"),e=document.createElement("div");t.appendChild(e);var o=L.DomUtil.create("a","",e);o.href="#",o.innerHTML=this.options.name,o.title=this.options.title||"",o.style.height="26px",o.style.width="auto",o.style.padding="0 4px";var i=this._variants=document.createElement("div");i.style.display="none",i.style.position="absolute",i.style.left="50px",i.style.top="0px",i.style.width="200px",i.style.padding="0 6px",i.style.backgroundColor="white",i.style.zIndex=-10,t.appendChild(i);var n=L.DomEvent.stopPropagation;return L.DomEvent.on(o,"click",n).on(o,"mousedown",n).on(o,"dblclick",n).on(o,"click",L.DomEvent.preventDefault).on(o,"click",function(){i.style.display="block"==i.style.display?"none":"block"}),this.options.types&&this.options.titles?this._updateVariants():this._ajax(this.options.endpoint+"fmtlist",function(t){t&&t.types&&t.titles&&this._updateTypesAndTitles(t.types,t.titles)},this),t},_updateTypesAndTitles:function(t,e){if(t&&e&&t.length&&t.length==e.length){var o=this.options.filter;if(o&&o.length){var i,n,r=[],a=[];for(i=0;i0&&n.appendChild(document.createTextNode(" | "));var r=document.createElement("a");r.style.display="inline",r.style.width="auto",r.style.color="blue",r.style.border="none",r.style.textDecoration="none",r.innerHTML=o[t];var a=L.DomEvent.stopPropagation;i?(r.href=this.options.endpoint+i+"?format="+e[t],L.DomEvent.on(r,"click",a).on(r,"mousedown",a).on(r,"dblclick",a).on(r,"click",this._linkClick,this)):(r.href="#",r._etype=e[t],L.DomEvent.on(r,"click",a).on(r,"mousedown",a).on(r,"dblclick",a).on(r,"click",L.DomEvent.preventDefault).on(r,"click",this._linkClick,this)),n.appendChild(r)}},_linkClick:function(t){var e=window.event&&window.event.srcElement||t.target||t.srcElement;this._variants.style.display="none",this.fire("export",{fmt:e._etype})},_ajax:function(url,callback,context){function respond(){var st=http.status;if(!st&&http.responseText||st>=200&&300>st)try{var result=eval("("+http.responseText+")");callback.call(context,result)}catch(err){}}var http;if(window.XMLHttpRequest&&(http=new window.XMLHttpRequest),!window.XDomainRequest||http&&"withCredentials"in http||(http=new window.XDomainRequest),http){"onload"in http?http.onload=http.onerror=respond:http.onreadystatechange=function(){4==http.readyState&&respond()};try{http.open("GET",url,!0),http.send(null)}catch(err){}}}}),L.exportControl=function(t){return new L.ExportControl(t)},L.StaticLayerSwitcher=L.Control.extend({includes:L.Mixin.Events,options:{position:"topright",editable:!1,bgColor:"white",selectedColor:"#ddd",enforceOSM:!1,maxLayers:7},initialize:function(t,e){if(L.setOptions(this,e),this._layers=[],this._selected=0,this._layerList=window.layerList&&"isOpenStreetMapLayer"in window.layerList,t)if("push"in t&&"splice"in t)for(var o=0;o0&&this._selected0&&this._selected=0&&this._layers[o];if(i&&i.id!==e){if(i.id=e,i.fromList){var n=this._map&&this._map.hasLayer(t),r=this._layerList?window.layerList.getLeafletLayer(e):null;n&&this._map.removeLayer(t),r?(i.layer=r,n&&this._map.addLayer(r)):this._layers.splice(o,1)}return this._update(),t}return null},addLayer:function(t,e){if(!(this._layers.length>=this.options.maxLayers)){var o=e||this._layerList&&window.layerList.getLeafletLayer(t);if(o){this._layers.push({id:t,layer:o,fromList:!e});var i=this._findFirstOSMLayer();if(i>0){var n=this._layers[i];this._layers[i]=this._layers[0],this._layers[0]=n}return this._map&&this._addMandatoryOSMLayer(),this._update(),this.fire("layerschanged",{layers:this.getLayerIds()}),1==this._layers.length&&this.fire("selectionchanged",{selected:this.getSelectedLayer(),selectedId:this.getSelectedLayerId()}),e}return null}},removeLayer:function(t){var e=this._findLayer(t);if(e>=0){var o=this._selected==e;if(o&&this._map.removeLayer(t),this._layers.splice(e,1),0===e){var i=this._findFirstOSMLayer();if(i>0){var n=this._layers[i];this._layers[i]=this._layers[0],this._layers[0]=n}}return this._selected>=this._layers.length&&this._selected>0&&(this._selected=this._layers.length-1),this._addMandatoryOSMLayer(),this._update(),this.fire("layerschanged",{layers:this.getLayerIds()}),o&&this.fire("selectionchanged",{selected:this.getSelectedLayer(),selectedId:this.getSelectedLayerId()}),t}return null},moveLayer:function(t,e){var o=this._findLayer(t),i=e?o+1:o-1;if(o>=0&&i>=0&&i1))return;i=n}var r=this._layers[o];this._layers[o]=this._layers[i],this._layers[i]=r,o==this._selected?this._selected=i:i==this._selected&&(this._selected=o),this._update(),this.fire("layerschanged",{layers:this.getLayerIds()})}},_findFirstOSMLayer:function(t){if(!this._layerList||!this.options.enforceOSM)return t||0;for(var e=t||0;e=this._layers.length&&(e=-1),e},_addMandatoryOSMLayer:function(){if(this.options.enforceOSM&&this._layers.length>0&&this._findFirstOSMLayer()<0){var t=L.tileLayer("http://tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'Map © OpenStreetMap',minZoom:0,maxZoom:19});this._selectedPlease contact an administrator.",sharedFormInvalidCode:"Map code is invalid",sharedCodeLoading:'Downloading a map...',sharedCodeError:'Failed to download an external map

Open map in a new window',polylineTitle:"Draw a path",polygonTitle:"Draw a polygon",markerTitle:"Add a marker",drawCancelTitle:"Cancel drawing",undoPoint:"Delete last point",undoPointTitle:"Delete last point drawn",markerTooltip:"Click map to place marker",polylineStartTooltip:"Click to start drawing a line",polylineContinueTooltip:"Click to continue drawing line",polylineEndTooltip:"Click the last point to finish line",polygonStartTooltip:"Click to start drawing a polygon",polygonContinueTooltip:"Click to continue drawing polygon",polygonEndTooltip:"Click the last point to close this polygon",deleteLastPoint:"Delete last point",deleteLastPointTooltip:"Delete last point drawn",singleLength:"Length of this line",totalLength:"Total length",helpContents:'Map BBCode Editor\n\nSince you have already activated the editor, you know the drill. There are buttons for markers and geometry, you click the map and objects appear, they have popups activated by clicking, from which you can change some properties, like color. To save the drawing click "Apply", otherwise there is a "Cancel" button.\nWhat you should know is that you are editing not the map, but the underlying bbcode, with all restrictions it imposes. Map BBCode is a text string, which you can copy and paste to different services, and edit directly. The syntax of it is quite simple: [map]...[/map] tags with a list of objects as coordinate sequences and attributes. When a cursor is inside bbcode, the editor is opened with a drawing it represents, otherwise it will be empty.\nFor a complete manual see User\'s Guide on the official MapBBCode site.\n\n# Navigating the map\nHere are some hints for using map panels. Keyboard arrows work when a map is in focus. Shift+drag with a mouse to quickly zoom into an area, shift+zoom buttons to change zoom 3 steps at a time. Use the layer switcher at the top right corner to see the drawing on a different map. Mouse wheel is disabled in the viewer, but can be used in the editor to quickly zoom in or out. Use the button with a magnifier to navigate to a named place or a road.\n\n# External maps\nIf the feature is not disabled by an administrator, you can upload your maps to a server, share.mapbbcode.org by default, with an "Upload" button. If you click it not having drawn anything, it will ask for a map URL or identifier. Those are converted to [mapid]id[/mapid] bbcode, which looks like a regular map, but with an export button: users can download a drawing as GPX or CSV or in any other format. If you share an edit link for a map, others can join in, and changes will be reflected in embedded maps.\n\n# Plugin\nMapBBCode is an open source javascript library with plugins around it available for some forum and blog engines. Its goal is to make sharing maps easier. This is version {version}.\n'}})}(window,document); \ No newline at end of file