Permalink
Browse files

3.0.2

  • Loading branch information...
1 parent 749cd88 commit f3dc3a4a543fe271109e39720fb369de3155353d @yhahn yhahn committed Jul 14, 2011
Showing with 21 additions and 17 deletions.
  1. +4 −0 CHANGELOG.md
  2. +2 −2 dist/wax.g.js
  3. +2 −2 dist/wax.g.min.js
  4. +2 −2 dist/wax.leaf.js
  5. +2 −2 dist/wax.leaf.min.js
  6. +2 −2 dist/wax.mm.js
  7. +2 −2 dist/wax.mm.min.js
  8. +2 −2 dist/wax.ol.js
  9. +2 −2 dist/wax.ol.min.js
  10. +1 −1 package.json
View
4 CHANGELOG.md
@@ -1,5 +1,9 @@
## Changelog
+### 3.0.2
+
+* Fixes `xyzFinder` in `wax.GridManager` to handle URLs with query strings.
+
### 3.0.1
* Expose `#full` and `#original` methods on `wax.mm.fullscreen` allowing API
View
4 dist/wax.g.js
@@ -1,4 +1,4 @@
-/* wax - 3.0.1 - 1.0.4-321-g053540e */
+/* wax - 3.0.2 - 1.0.4-322-g6189bf0 */
/*!
@@ -336,7 +336,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
- xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
+ xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;
var formatterUrl = function(url) {
View
4 dist/wax.g.min.js
@@ -1,6 +1,6 @@
-/* wax - 3.0.1 - 1.0.4-321-g053540e *//*!
+/* wax - 3.0.2 - 1.0.4-322-g6189bf0 *//*!
* Reqwest! A x-browser general purpose XHR connection manager
* copyright Dustin Diaz 2011
* https://github.com/ded/reqwest
* license MIT
- */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}}},wax=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)}},wax.tooltip.prototype.click=function(a,b,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}},wax=wax||{},wax.g=wax.g||{},wax.g.attribution=function(a,b){b=b||{};var c,d={};d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this},d.init=function(){c=wax.attribution(),c.set(b.attribution),c.element().className="wax-attribution wax-g";return this};return d.init()},wax=wax||{},wax.g=wax.g||{},wax.g.interaction=function(a,b,c){b=b||{},c=c||{};var d={modifyingEvents:["dragstart","dragend","drag","zoom_changed","resize","center_changed","bounds_changed"],waxGM:new wax.GridManager(b),callbacks:c.callbacks||new wax.tooltip,clickAction:c.clickAction||"full",add:function(){for(var b=0;b<this.modifyingEvents.length;b++)google.maps.event.addListener(a,this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));google.maps.event.addListener(a,"mousemove",this.onMove()),google.maps.event.addListener(a,"click",this.click());return this},getTileGrid:function(){if(!this._getTileGrid){this._getTileGrid=[];var b=a.getZoom(),c=wax.util.offset(a.getDiv()),d=wax.util.bind(function(a){if(!!a.interactive)for(var d in a.cache){if(d.split("/")[0]!=b)continue;var e=wax.util.offset(a.cache[d]);this._getTileGrid.push([e.top-c.top,e.left-c.left,a.cache[d]])}},this);for(var e in a.mapTypes)d(a.mapTypes[e]);a.overlayMapTypes.forEach(d)}return this._getTileGrid},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.pixel.y&&c[d][0]+256>a.pixel.y&&c[d][1]<a.pixel.x&&c[d][1]+256>a.pixel.x){b=c[d][2];break}return b||!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d,e){if(!d&&!!e){var f=e.getFeature(b.pixel.x+wax.util.offset(a.getDiv()).left,b.pixel.y+wax.util.offset(a.getDiv()).top,c,{format:"teaser"});f&&this.feature!==f?(this.feature=f,this.callbacks.out(a.getDiv()),this.callbacks.over(f,a.getDiv(),0,b)):f||(this.feature=null,this.callbacks.out(a.getDiv()))}},this))},this));return this._onMove},click:function(b){this._onClick||(this._onClick=wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d,e){if(!d&&!!e){var f=e.getFeature(b.pixel.x+wax.util.offset(a.getDiv()).left,b.pixel.y+wax.util.offset(a.getDiv()).top,c,{format:this.clickAction});if(f)switch(this.clickAction){case"full":this.callbacks.click(f,a.getDiv(),0,b);break;case"location":window.location=f}}},this))},this));return this._onClick}};return d.add(a)},wax=wax||{},wax.g=wax.g||{},wax.g.legend=function(a,b){b=b||{};var c,d={};d.add=function(){c=wax.legend().content(b.legend||"");return this},d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this};return d.add()};var wax=wax||{};wax.g=wax.g||{},wax.g.connector=function(a){a=a||{},this.options={tiles:a.tiles,scheme:a.scheme||"xyz",blankImage:a.blankImage},this.minZoom=a.minzoom||0,this.maxZoom=a.maxzoom||22,this.name=a.name||"",this.description=a.description||"",this.interactive=!0,this.tileSize=new google.maps.Size(256,256),this.cache={}},wax.g.connector.prototype.getTile=function(a,b,c){var d=b+"/"+a.x+"/"+a.y;if(!this.cache[d]){var e=this.cache[d]=new Image(256,256);this.cache[d].src=this.getTileUrl(a,b),this.cache[d].setAttribute("gTileKey",d),this.cache[d].onerror=function(){e.style.display="none"}}return this.cache[d]},wax.g.connector.prototype.releaseTile=function(a){var b=a.getAttribute("gTileKey");this.cache[b]&&delete this.cache[b],a.parentNode&&a.parentNode.removeChild(a)},wax.g.connector.prototype.getTileUrl=function(a,b){var c=Math.pow(2,b),d=this.options.scheme==="tms"?c-1-a.y:d,e=a.x%c;e=e<0?a.x%c+c:e;return d<0?this.options.blankImage:this.options.tiles[parseInt(e+d,10)%this.options.tiles.length].replace("{z}",b).replace("{x}",e).replace("{y}",d)}
+ */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}}},wax=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)}},wax.tooltip.prototype.click=function(a,b,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}},wax=wax||{},wax.g=wax.g||{},wax.g.attribution=function(a,b){b=b||{};var c,d={};d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this},d.init=function(){c=wax.attribution(),c.set(b.attribution),c.element().className="wax-attribution wax-g";return this};return d.init()},wax=wax||{},wax.g=wax.g||{},wax.g.interaction=function(a,b,c){b=b||{},c=c||{};var d={modifyingEvents:["dragstart","dragend","drag","zoom_changed","resize","center_changed","bounds_changed"],waxGM:new wax.GridManager(b),callbacks:c.callbacks||new wax.tooltip,clickAction:c.clickAction||"full",add:function(){for(var b=0;b<this.modifyingEvents.length;b++)google.maps.event.addListener(a,this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));google.maps.event.addListener(a,"mousemove",this.onMove()),google.maps.event.addListener(a,"click",this.click());return this},getTileGrid:function(){if(!this._getTileGrid){this._getTileGrid=[];var b=a.getZoom(),c=wax.util.offset(a.getDiv()),d=wax.util.bind(function(a){if(!!a.interactive)for(var d in a.cache){if(d.split("/")[0]!=b)continue;var e=wax.util.offset(a.cache[d]);this._getTileGrid.push([e.top-c.top,e.left-c.left,a.cache[d]])}},this);for(var e in a.mapTypes)d(a.mapTypes[e]);a.overlayMapTypes.forEach(d)}return this._getTileGrid},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.pixel.y&&c[d][0]+256>a.pixel.y&&c[d][1]<a.pixel.x&&c[d][1]+256>a.pixel.x){b=c[d][2];break}return b||!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d,e){if(!d&&!!e){var f=e.getFeature(b.pixel.x+wax.util.offset(a.getDiv()).left,b.pixel.y+wax.util.offset(a.getDiv()).top,c,{format:"teaser"});f&&this.feature!==f?(this.feature=f,this.callbacks.out(a.getDiv()),this.callbacks.over(f,a.getDiv(),0,b)):f||(this.feature=null,this.callbacks.out(a.getDiv()))}},this))},this));return this._onMove},click:function(b){this._onClick||(this._onClick=wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d,e){if(!d&&!!e){var f=e.getFeature(b.pixel.x+wax.util.offset(a.getDiv()).left,b.pixel.y+wax.util.offset(a.getDiv()).top,c,{format:this.clickAction});if(f)switch(this.clickAction){case"full":this.callbacks.click(f,a.getDiv(),0,b);break;case"location":window.location=f}}},this))},this));return this._onClick}};return d.add(a)},wax=wax||{},wax.g=wax.g||{},wax.g.legend=function(a,b){b=b||{};var c,d={};d.add=function(){c=wax.legend().content(b.legend||"");return this},d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this};return d.add()};var wax=wax||{};wax.g=wax.g||{},wax.g.connector=function(a){a=a||{},this.options={tiles:a.tiles,scheme:a.scheme||"xyz",blankImage:a.blankImage},this.minZoom=a.minzoom||0,this.maxZoom=a.maxzoom||22,this.name=a.name||"",this.description=a.description||"",this.interactive=!0,this.tileSize=new google.maps.Size(256,256),this.cache={}},wax.g.connector.prototype.getTile=function(a,b,c){var d=b+"/"+a.x+"/"+a.y;if(!this.cache[d]){var e=this.cache[d]=new Image(256,256);this.cache[d].src=this.getTileUrl(a,b),this.cache[d].setAttribute("gTileKey",d),this.cache[d].onerror=function(){e.style.display="none"}}return this.cache[d]},wax.g.connector.prototype.releaseTile=function(a){var b=a.getAttribute("gTileKey");this.cache[b]&&delete this.cache[b],a.parentNode&&a.parentNode.removeChild(a)},wax.g.connector.prototype.getTileUrl=function(a,b){var c=Math.pow(2,b),d=this.options.scheme==="tms"?c-1-a.y:d,e=a.x%c;e=e<0?a.x%c+c:e;return d<0?this.options.blankImage:this.options.tiles[parseInt(e+d,10)%this.options.tiles.length].replace("{z}",b).replace("{x}",e).replace("{y}",d)}
View
4 dist/wax.leaf.js
@@ -1,4 +1,4 @@
-/* wax - 3.0.1 - 1.0.4-321-g053540e */
+/* wax - 3.0.2 - 1.0.4-322-g6189bf0 */
/*!
@@ -336,7 +336,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
- xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
+ xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;
var formatterUrl = function(url) {
View
4 dist/wax.leaf.min.js
@@ -1,6 +1,6 @@
-/* wax - 3.0.1 - 1.0.4-321-g053540e *//*!
+/* wax - 3.0.2 - 1.0.4-322-g6189bf0 *//*!
* Reqwest! A x-browser general purpose XHR connection manager
* copyright Dustin Diaz 2011
* https://github.com/ded/reqwest
* license MIT
- */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}}},wax=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)}},wax.tooltip.prototype.click=function(a,b,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.interaction=function(a,b,c){b=b||{},c=c||{};var d={modifyingEvents:["move"],waxGM:new wax.GridManager(b),callbacks:c.callbacks||new wax.tooltip,clickAction:c.clickAction||"full",add:function(){for(var b=0;b<this.modifyingEvents.length;b++)a.on(this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));L.DomEvent.addListener(a._container,"mousemove",this.onMove(),this),L.DomEvent.addListener(a._container,"mousemove",this.mouseDown(),this);return this},getTileGrid:function(){return this._getTileGrid||(this._getTileGrid=function(a){var b=[];for(var c in a)if(a[c]._tiles)for(var d in a[c]._tiles){var e=wax.util.offset(a[c]._tiles[d]);b.push([e.top,e.left,a[c]._tiles[d]])}return b}(a._layers))},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.y&&c[d][0]+256>a.y&&c[d][1]<a.x&&c[d][1]+256>a.x){b=c[d][2];break}return b||!1},clearTimeout:function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){var c=wax.util.eventoffset(b),d=this.getTile(c);d&&this.waxGM.getGrid(d.src,wax.util.bind(function(e,f){if(!e&&f){var g=f.getFeature(c.x,c.y,d,{format:"teaser"});g?g&&this.feature!==g?(this.feature=g,this.callbacks.out(a._container),this.callbacks.over(g,a._container,0,b)):g||(this.feature=null,this.callbacks.out(a._container)):(this.feature=null,this.callbacks.out(a._container))}},this))},this));return this._onMove},mouseDown:function(b){this._mouseDown||(this._mouseDown=wax.util.bind(function(b){this.clearTimeout()||(this.downEvent=b,L.DomEvent.addListener(a._container,"mouseup",this.mouseUp(),this))},this));return this._mouseDown},mouseUp:function(){this._mouseUp||(this._mouseUp=wax.util.bind(function(b){L.DomEvent.removeListener(a._container,"mouseup",this.mouseUp(),this);var c=4;Math.round(b.pageY/c)===Math.round(this.downEvent.pageY/c)&&Math.round(b.pageX/c)===Math.round(this.downEvent.pageX/c)&&(this.clickTimeout=window.setTimeout(wax.util.bind(function(){this.click()(b)},this),300))},this));return this._mouseUp},click:function(a){this._onClick||(this._onClick=wax.util.bind(function(a){var b=this.getTile(a);b&&this.waxGM.getGrid(b.src,wax.util.bind(function(c,d){if(d){var e=d.getFeature(a.pageX,a.pageY,b,{format:this.clickAction});if(e)switch(this.clickAction){case"full":this.callbacks.click(e,this.parent,0,a);break;case"location":window.location=e}}},this))},this));return this._onClick}};return d.add(a)},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.connector=L.TileLayer.extend({initialize:function(a){a=a||{},a.minZoom=a.minzoom||0,a.maxZoom=a.maxzoom||22,L.TileLayer.prototype.initialize.call(this,a.tiles[0],a)}})
+ */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}}},wax=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)}},wax.tooltip.prototype.click=function(a,b,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.interaction=function(a,b,c){b=b||{},c=c||{};var d={modifyingEvents:["move"],waxGM:new wax.GridManager(b),callbacks:c.callbacks||new wax.tooltip,clickAction:c.clickAction||"full",add:function(){for(var b=0;b<this.modifyingEvents.length;b++)a.on(this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));L.DomEvent.addListener(a._container,"mousemove",this.onMove(),this),L.DomEvent.addListener(a._container,"mousemove",this.mouseDown(),this);return this},getTileGrid:function(){return this._getTileGrid||(this._getTileGrid=function(a){var b=[];for(var c in a)if(a[c]._tiles)for(var d in a[c]._tiles){var e=wax.util.offset(a[c]._tiles[d]);b.push([e.top,e.left,a[c]._tiles[d]])}return b}(a._layers))},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.y&&c[d][0]+256>a.y&&c[d][1]<a.x&&c[d][1]+256>a.x){b=c[d][2];break}return b||!1},clearTimeout:function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){var c=wax.util.eventoffset(b),d=this.getTile(c);d&&this.waxGM.getGrid(d.src,wax.util.bind(function(e,f){if(!e&&f){var g=f.getFeature(c.x,c.y,d,{format:"teaser"});g?g&&this.feature!==g?(this.feature=g,this.callbacks.out(a._container),this.callbacks.over(g,a._container,0,b)):g||(this.feature=null,this.callbacks.out(a._container)):(this.feature=null,this.callbacks.out(a._container))}},this))},this));return this._onMove},mouseDown:function(b){this._mouseDown||(this._mouseDown=wax.util.bind(function(b){this.clearTimeout()||(this.downEvent=b,L.DomEvent.addListener(a._container,"mouseup",this.mouseUp(),this))},this));return this._mouseDown},mouseUp:function(){this._mouseUp||(this._mouseUp=wax.util.bind(function(b){L.DomEvent.removeListener(a._container,"mouseup",this.mouseUp(),this);var c=4;Math.round(b.pageY/c)===Math.round(this.downEvent.pageY/c)&&Math.round(b.pageX/c)===Math.round(this.downEvent.pageX/c)&&(this.clickTimeout=window.setTimeout(wax.util.bind(function(){this.click()(b)},this),300))},this));return this._mouseUp},click:function(a){this._onClick||(this._onClick=wax.util.bind(function(a){var b=this.getTile(a);b&&this.waxGM.getGrid(b.src,wax.util.bind(function(c,d){if(d){var e=d.getFeature(a.pageX,a.pageY,b,{format:this.clickAction});if(e)switch(this.clickAction){case"full":this.callbacks.click(e,this.parent,0,a);break;case"location":window.location=e}}},this))},this));return this._onClick}};return d.add(a)},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.connector=L.TileLayer.extend({initialize:function(a){a=a||{},a.minZoom=a.minzoom||0,a.maxZoom=a.maxzoom||22,L.TileLayer.prototype.initialize.call(this,a.tiles[0],a)}})
View
4 dist/wax.mm.js
@@ -1,4 +1,4 @@
-/* wax - 3.0.1 - 1.0.4-321-g053540e */
+/* wax - 3.0.2 - 1.0.4-322-g6189bf0 */
/*!
@@ -336,7 +336,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
- xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
+ xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;
var formatterUrl = function(url) {
View
4 dist/wax.mm.min.js
@@ -1,6 +1,6 @@
-/* wax - 3.0.1 - 1.0.4-321-g053540e *//*!
+/* wax - 3.0.2 - 1.0.4-322-g6189bf0 *//*!
* Reqwest! A x-browser general purpose XHR connection manager
* copyright Dustin Diaz 2011
* https://github.com/ded/reqwest
* license MIT
- */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}}},wax=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)}},wax.tooltip.prototype.click=function(a,b,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}},wax=wax||{},wax.mm=wax.mm||{},wax.mm.attribution=function(a,b){b=b||{};var c,d={};d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this},d.init=function(){c=wax.attribution(),c.set(b.attribution),c.element().className="wax-attribution wax-mm";return this};return d.init()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.boxselector=function(a,b,c){function n(a,b){if(!!g&&!!h){var c=a.locationPoint(h[0]),d=a.locationPoint(h[1]);g.style.display="block",g.style.height="auto",g.style.width="auto",g.style.left=Math.max(0,d.x)+"px",g.style.top=Math.max(0,d.y)+"px",g.style.right=Math.max(0,a.dimensions.x-c.x)+"px",g.style.bottom=Math.max(0,a.dimensions.y-c.y)+"px"}}function m(b){var c=j(b),g=a.pointLocation(c),i=a.pointLocation(d),k=[new e.Location(Math.max(g.lat,i.lat),Math.min(g.lon,i.lon)),new e.Location(Math.min(g.lat,i.lat),Math.max(g.lon,i.lon))];h=[g,i],f(k),e.removeEvent(a.parent,"mousemove",l),e.removeEvent(a.parent,"mouseup",m),a.parent.style.cursor="auto"}function l(a){var b=j(a);g.style.display="block",b.x<d.x?g.style.left=b.x+"px":g.style.left=d.x+"px",b.y<d.y?g.style.top=b.y+"px":g.style.top=d.y+"px",g.style.width=Math.abs(b.x-d.x)+"px",g.style.height=Math.abs(b.y-d.y)+"px";return e.cancelEvent(a)}function k(b){if(!!b.shiftKey){d=j(b),g.style.left=d.x+"px",g.style.top=d.y+"px",e.addEvent(a.parent,"mousemove",l),e.addEvent(a.parent,"mouseup",m),a.parent.style.cursor="crosshair";return e.cancelEvent(b)}}function j(b){var c=new e.Point(b.clientX,b.clientY);c.x+=document.body.scrollLeft+document.documentElement.scrollLeft,c.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var d=a.parent;d;d=d.offsetParent)c.x-=d.offsetLeft,c.y-=d.offsetTop;return c}var d=null,e=com.modestmaps,f=typeof c=="function"?c:c.callback,g,h,i={};i.add=function(a){g=g||document.createElement("div"),g.id=a.parent.id+"-boxselector-box",g.className="boxselector-box",a.parent.appendChild(g),e.addEvent(a.parent,"mousedown",k),a.addCallback("drawn",n);return this},i.remove=function(){a.parent.removeChild(g),e.removeEvent(a.parent,"mousedown",k),a.removeCallback("drawn",n)};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.fullscreen=function(a){function f(a){a&&com.modestmaps.cancelEvent(a),(b=!b)?c.original():c.full()}var b=1,c={},d,e;c.add=function(a){d=document.createElement("a"),d.className="wax-fullscreen",d.href="#fullscreen",d.innerHTML="fullscreen",com.modestmaps.addEvent(d,"click",f);return this},c.full=function(){e=[a.parent.offsetWidth,a.parent.offsetHeight],a.parent.className+=" wax-fullscreen-map",a.setSize(a.parent.offsetWidth,a.parent.offsetHeight)},c.original=function(){a.parent.className=a.parent.className.replace("wax-fullscreen-map",""),a.setSize(e[0],e[1])},c.appendTo=function(a){wax.util.$(a).appendChild(d);return this};return c.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.locationHash={stateChange:function(a){com.modestmaps.addEvent(window,"hashchange",function(){a(location.hash)},!1)},getState:function(){return location.hash.substring(1)},pushState:function(a){location.hash="#"+a}},wax.mm.pushState={stateChange:function(a){com.modestmaps.addEvent(window,"popstate",function(b){b.state&&b.state.map_location&&a(b.state.map_location)},!1)},getState:function(){if(!!window.history&&!!window.history.state)return history.state&&history.state.map_location},pushState:function(a){!!window.history&&!!window.history.pushState&&window.history.pushState({map_location:a},document.title,window.location.href)}},wax.mm.hash=function(a,b,c){function l(a){a!==d&&i(d=a)&&e.move()}function k(){var a=j();d!==a&&(d=a,c.manager.pushState(d))}function h(a,b){return g(a,b,!1)}function g(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}}c=c||{};var d,e={},f=90-1e-8;c.manager=c.manager||wax.mm.pushState;var i=function(b){var c=b.split("/");for(var d=0;d<c.length;d++){c[d]=Number(c[d]);if(isNaN(c[d]))return!0}if(c.length<3)return!0;c.length==3&&a.setCenterZoom(new com.modestmaps.Location(c[1],c[2]),c[0])},j=function(){var b=a.getCenter(),c=a.getZoom(),d=Math.max(0,Math.ceil(Math.log(c)/Math.LN2));return[c.toFixed(2),b.lat.toFixed(d),b.lon.toFixed(d)].join("/")},m=function(){c.defaultCenter&&a.setCenter(c.defaultCenter),c.defaultZoom&&a.setZoom(c.defaultZoom)};e.add=function(a){c.manager.getState()?e.stateChange(c.manager.getState()):(m(),k()),a.addCallback("drawn",h(k,500)),c.manager.stateChange(l);return this};return e.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.interaction=function(a,b,c){function y(b,c){var d=s(c),i;d&&e.getGrid(d.src,function(e,j){for(var k=0;j&&k<g.length;k++)if(i=j.getFeature(c.x,c.y,d,{format:g[k]}))switch(g[k]){case"full":case"teaser":return f.click(i,a.parent,0,b);case"location":return h(i)}})}function x(b){var c=wax.util.eventoffset(b);d.removeEvent(a.parent,"mouseup",x),a.parent.ontouchend&&(d.removeEvent(a.parent,"touchend",x),d.removeEvent(a.parent,"touchmove",_touchCancel)),j=!1,b.type==="touchend"?y(n):Math.round(c.y/o)===Math.round(n.y/o)&&Math.round(c.x/o)===Math.round(n.x/o)&&(k=window.setTimeout(function(a){return function(b){y(b,a)}}(c)));return x}function w(){d.removeEvent(a.parent,"touchend",x),d.removeEvent(a.parent,"touchmove",x),j=!1}function v(b){t()||(j=!0,n=wax.util.eventoffset(b),b.type==="mousedown"?d.addEvent(a.parent,"mouseup",x):b.type==="touchstart"&&b.touches.length===1&&(this.clickAction=["full","teaser"],f._currentTooltip&&f.hideTooltip(f._currentTooltip),d.addEvent(a.parent,"touchend",x),d.addEvent(a.parent,"touchmove",w)))}function u(b){if(!j){var c=wax.util.eventoffset(b),d=s(c),g;d&&e.getGrid(d.src,function(e,h){!e&&!!h&&((g=h.getFeature(c.x,c.y,d,{format:"teaser"}))?g&&m!==g?(m=g,f.out(a.parent),f.over(g,a.parent,0,b)):g||(m=null,f.out(a.parent)):(m=null,f.out(a.parent)))})}}function t(){if(k){window.clearTimeout(k),k=null;return!0}return!1}function s(a){for(var b=0,c=q();b<c.length;b++)if(c[b][0]<a.y&&c[b][0]+256>a.y&&c[b][1]<a.x&&c[b][1]+256>a.x)return c[b][2];return!1}function r(a,b){p=null}function q(){var b=a.createOrGetLayer(Math.round(a.getZoom()));return p||(p=function(a){var c=[];for(var d in a)if(a[d].parentNode===b){var e=wax.util.offset(a[d]);c.push([e.top,e.left,a[d]])}return c}(a.tiles))}c=c||{},b=b||{};var d=com.modestmaps,e=wax.GridManager(b),f=c.callbacks||new wax.tooltip,g=c.clickAction||["full"],h=c.clickHandler||function(a){window.location=a},i={},j=!1,k=!1,l="ontouchstart"in document.documentElement,m,n,o=4,p;i.add=function(){var b=["zoomed","panned","centered","extentset","resized","drawn"];for(var c=0;c<b.length;c++)a.addCallback(b[c],r);d.addEvent(a.parent,"mousemove",u),d.addEvent(a.parent,"mousedown",v),l&&d.addEvent(a.parent,"touchstart",v);return this};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.legend=function(a,b){b=b||{};var c,d={};d.add=function(){c=wax.legend().content(b.legend||"");return this},d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this};return d.add()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.mobile=function(a,b,c){c=c||{};var d=com.modestmaps,e=navigator.userAgent.toLowerCase(),f=e.indexOf("webkit")!=-1,g=e.indexOf("mobile")!=-1,h=g&&f,i=function(a){var b=document.createElement("canvas"),c=parseInt(a.style.width,10),d=parseInt(a.style.height,10),e=c/2,f=d/2,g=Math.min(c,d)/4,h=b.getContext("2d");b.setAttribute("width",c),b.setAttribute("height",d),h.globalAlpha=.5;var i=h.createLinearGradient(0,0,300,225);i.addColorStop(0,"black"),i.addColorStop(1,"rgb(200, 200, 200)"),h.fillStyle=i,h.fillRect(0,0,c,d),h.fillStyle="rgb(255, 255, 255)",h.beginPath(),h.moveTo(e-g*.6,f-g),h.lineTo(e-g*.6,f+g),h.lineTo(e+g*.6,f),h.fill(),a.appendChild(b)},j=function(a){a.style.position="absolute",a.style.height="50px",a.style.left=a.style.right="0";var b=document.createElement("canvas");b.setAttribute("width",a.offsetWidth),b.setAttribute("height",a.offsetHeight);var c=b.getContext("2d");c.globalAlpha=1,c.fillStyle="rgba(255, 255, 255, 0.5)",c.fillRect(0,0,a.offsetWidth,a.offsetHeight),c.fillStyle="rgb(0, 0, 0)",c.font="bold 20px sans-serif",c.fillText("back",20,30),a.appendChild(b)},k=function(a){a.style.position="absolute",a.style.width=a.style.height="auto",a.style.top=window.pageYOffset+"px",a.style.left=a.style.right="0px"},l=function(a){a.style.position="relative",a.style.width=a.style.height=a.style.top=a.style.left=a.style.right="auto"},m,n,o,p,q=c.overlayDraw||i,r=c.backDraw||j;bodyDraw=c.bodyDraw||function(){};var s={add:function(a){h&&(p=document.createElement("meta"),p.id="wax-touch",p.setAttribute("name","viewport"),m=document.createElement("div"),m.id=a.parent.id+"-mobileoverlay",m.className="wax-mobileoverlay",m.style.position="absolute",m.style.width=a.dimensions.x+"px",m.style.height=a.dimensions.y+"px",a.parent.appendChild(m),q(m),o=document.createElement("div"),backDiv=document.createElement("div"),n=document.body,newBody=document.createElement("body"),newBody.className="wax-mobile-body",newBody.appendChild(backDiv),d.addEvent(m,"touchstart",this.toTouch),d.addEvent(backDiv,"touchstart",this.toPage));return this},toTouch:function(){a.parent.parentNode.replaceChild(o,a.parent),newBody.insertBefore(a.parent,backDiv),document.body=newBody,bodyDraw(newBody),r(backDiv),p.setAttribute("content","initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"),document.head.appendChild(p),a._smallSize=[a.parent.clientWidth,a.parent.clientHeight],k(a.parent),a.setSize(a.parent.offsetWidth,window.innerHeight),backDiv.style.display="block",m.style.display="none"},toPage:function(){document.body=n,o.parentNode.replaceChild(a.parent,o),l(a.parent),a.setSize(a._smallSize[0],a._smallSize[1]),backDiv.style.display="none",m.style.display="block"}};return s.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.pointselector=function(a,b,c){function p(b){!d||(e=l(b),h.Point.distance(d,e)<f&&(i.addLocation(a.pointLocation(d)),k(m(j))),d=null)}function o(b){d=l(b),h.addEvent(a.parent,"mouseup",p)}function n(){var b=new h.Point(0,0);for(var c=0;c<j.length;c++){var d=a.locationPoint(j[c]);j[c].pointDiv||(j[c].pointDiv=document.createElement("div"),j[c].pointDiv.className="wax-point-div",j[c].pointDiv.style.position="absolute",j[c].pointDiv.style.display="block",j[c].pointDiv.location=j[c],h.addEvent(j[c].pointDiv,"mouseup",function(b){var d=j[c];return function(b){h.removeEvent(a.parent,"mouseup",p),i.deletePoint(d,b)}}()),a.parent.appendChild(j[c].pointDiv)),j[c].pointDiv.style.left=d.x+"px",j[c].pointDiv.style.top=d.y+"px"}}function m(a){var b=[];for(var c=0;c<a.length;c++)b.push(new h.Location(a[c].lat,a[c].lon));return b}function l(b){var c=wax.util.eventoffset(b),d=new h.Point(c.x,c.y),e={x:parseFloat(h.getStyle(document.documentElement,"margin-left")),y:parseFloat(h.getStyle(document.documentElement,"margin-top"))};isNaN(e.x)||(d.x-=e.x),isNaN(e.y)||(d.y-=e.y);for(var f=a.parent;f;f=f.offsetParent)d.x-=f.offsetLeft,d.y-=f.offsetTop;return d}var d=null,e=null,f=5,g,h=com.modestmaps,i={},j=[],k=typeof c=="function"?c:c.callback;i.addLocation=function(a){j.push(a),n(),k(m(j))},i.add=function(a){h.addEvent(a.parent,"mousedown",o),a.addCallback("drawn",n());return this},i.deletePoint=function(a,b){confirm("Delete this point?")&&(a.pointDiv.parentNode.removeChild(a.pointDiv),j.splice(wax.util.indexOf(j,a),1),k(m(j)))};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoombox=function(a){function j(a){if(!!d){var b=g(a);e.style.display="block",b.x<f.x?e.style.left=b.x+"px":e.style.left=f.x+"px",e.style.width=Math.abs(b.x-f.x)+"px",b.y<f.y?e.style.top=b.y+"px":e.style.top=f.y+"px",e.style.height=Math.abs(b.y-f.y)+"px";return c.cancelEvent(a)}}function i(b){if(!!b.shiftKey&&!this.drawing){d=!0,f=g(b),e.style.left=f.x+"px",e.style.top=f.y+"px",c.addEvent(a.parent,"mousemove",j),c.addEvent(a.parent,"mouseup",h),a.parent.style.cursor="crosshair";return c.cancelEvent(b)}}function h(b){if(!!d){d=!1;var i=g(b),k=a.pointLocation(i),l=a.pointLocation(f);a.setExtent([k,l]),e.style.display="none",c.removeEvent(a.parent,"mousemove",j),c.removeEvent(a.parent,"mouseup",h),a.parent.style.cursor="auto"}}function g(b){var d=new c.Point(b.clientX,b.clientY);d.x+=document.body.scrollLeft+document.documentElement.scrollLeft,d.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var e=a.parent;e;e=e.offsetParent)d.x-=e.offsetLeft,d.y-=e.offsetTop;return d}var b={},c=com.modestmaps,d=!1,e,f=null;b.add=function(a){e=e||document.createElement("div"),e.id=a.parent.id+"-zoombox-box",e.className="zoombox-box",a.parent.appendChild(e),c.addEvent(a.parent,"mousedown",i);return this},b.remove=function(){a.parent.removeChild(e),c.removeEvent(a.parent,"mousedown",i)};return b.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoomer=function(a){var b=com.modestmaps,c=document.createElement("a");c.innerHTML="+",c.href="#",c.className="zoomer zoomin",b.addEvent(c,"mousedown",function(a){b.cancelEvent(a)}),b.addEvent(c,"dblclick",function(a){b.cancelEvent(a)}),b.addEvent(c,"click",function(c){b.cancelEvent(c),a.zoomIn()},!1);var d=document.createElement("a");d.innerHTML="-",d.href="#",d.className="zoomer zoomout",b.addEvent(d,"mousedown",function(a){b.cancelEvent(a)}),b.addEvent(d,"dblclick",function(a){b.cancelEvent(a)}),b.addEvent(d,"click",function(c){b.cancelEvent(c),a.zoomOut()},!1);var e={add:function(a){a.addCallback("drawn",function(a,b){a.coordinate.zoom===a.provider.outerLimits()[0].zoom?d.className="zoomer zoomout zoomdisabled":a.coordinate.zoom===a.provider.outerLimits()[1].zoom?c.className="zoomer zoomin zoomdisabled":(c.className="zoomer zoomin",d.className="zoomer zoomout")});return this},appendTo:function(a){wax.util.$(a).appendChild(c),wax.util.$(a).appendChild(d);return this}};return e.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.connector=function(a){this.options={tiles:a.tiles,scheme:a.scheme||"xyz",minzoom:a.minzoom||0,maxzoom:a.maxzoom||22}},wax.mm.connector.prototype={outerLimits:function(){return[(new com.modestmaps.Coordinate(0,0,0)).zoomTo(this.options.minzoom),(new com.modestmaps.Coordinate(1,1,0)).zoomTo(this.options.maxzoom)]},getTileUrl:function(a){if(!(coord=this.sourceCoordinate(a)))return null;coord.row=this.options.scheme==="tms"?Math.pow(2,coord.zoom)-coord.row-1:coord.row;return this.options.tiles[parseInt(Math.pow(2,coord.zoom)*coord.row+coord.column,10)%this.options.tiles.length].replace("{z}",coord.zoom.toFixed(0)).replace("{x}",coord.column.toFixed(0)).replace("{y}",coord.row.toFixed(0))}},com&&com.modestmaps&&com.modestmaps.extend(wax.mm.connector,com.modestmaps.MapProvider)
+ */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}}},wax=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)}},wax.tooltip.prototype.click=function(a,b,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}},wax=wax||{},wax.mm=wax.mm||{},wax.mm.attribution=function(a,b){b=b||{};var c,d={};d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this},d.init=function(){c=wax.attribution(),c.set(b.attribution),c.element().className="wax-attribution wax-mm";return this};return d.init()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.boxselector=function(a,b,c){function n(a,b){if(!!g&&!!h){var c=a.locationPoint(h[0]),d=a.locationPoint(h[1]);g.style.display="block",g.style.height="auto",g.style.width="auto",g.style.left=Math.max(0,d.x)+"px",g.style.top=Math.max(0,d.y)+"px",g.style.right=Math.max(0,a.dimensions.x-c.x)+"px",g.style.bottom=Math.max(0,a.dimensions.y-c.y)+"px"}}function m(b){var c=j(b),g=a.pointLocation(c),i=a.pointLocation(d),k=[new e.Location(Math.max(g.lat,i.lat),Math.min(g.lon,i.lon)),new e.Location(Math.min(g.lat,i.lat),Math.max(g.lon,i.lon))];h=[g,i],f(k),e.removeEvent(a.parent,"mousemove",l),e.removeEvent(a.parent,"mouseup",m),a.parent.style.cursor="auto"}function l(a){var b=j(a);g.style.display="block",b.x<d.x?g.style.left=b.x+"px":g.style.left=d.x+"px",b.y<d.y?g.style.top=b.y+"px":g.style.top=d.y+"px",g.style.width=Math.abs(b.x-d.x)+"px",g.style.height=Math.abs(b.y-d.y)+"px";return e.cancelEvent(a)}function k(b){if(!!b.shiftKey){d=j(b),g.style.left=d.x+"px",g.style.top=d.y+"px",e.addEvent(a.parent,"mousemove",l),e.addEvent(a.parent,"mouseup",m),a.parent.style.cursor="crosshair";return e.cancelEvent(b)}}function j(b){var c=new e.Point(b.clientX,b.clientY);c.x+=document.body.scrollLeft+document.documentElement.scrollLeft,c.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var d=a.parent;d;d=d.offsetParent)c.x-=d.offsetLeft,c.y-=d.offsetTop;return c}var d=null,e=com.modestmaps,f=typeof c=="function"?c:c.callback,g,h,i={};i.add=function(a){g=g||document.createElement("div"),g.id=a.parent.id+"-boxselector-box",g.className="boxselector-box",a.parent.appendChild(g),e.addEvent(a.parent,"mousedown",k),a.addCallback("drawn",n);return this},i.remove=function(){a.parent.removeChild(g),e.removeEvent(a.parent,"mousedown",k),a.removeCallback("drawn",n)};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.fullscreen=function(a){function f(a){a&&com.modestmaps.cancelEvent(a),(b=!b)?c.original():c.full()}var b=1,c={},d,e;c.add=function(a){d=document.createElement("a"),d.className="wax-fullscreen",d.href="#fullscreen",d.innerHTML="fullscreen",com.modestmaps.addEvent(d,"click",f);return this},c.full=function(){e=[a.parent.offsetWidth,a.parent.offsetHeight],a.parent.className+=" wax-fullscreen-map",a.setSize(a.parent.offsetWidth,a.parent.offsetHeight)},c.original=function(){a.parent.className=a.parent.className.replace("wax-fullscreen-map",""),a.setSize(e[0],e[1])},c.appendTo=function(a){wax.util.$(a).appendChild(d);return this};return c.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.locationHash={stateChange:function(a){com.modestmaps.addEvent(window,"hashchange",function(){a(location.hash)},!1)},getState:function(){return location.hash.substring(1)},pushState:function(a){location.hash="#"+a}},wax.mm.pushState={stateChange:function(a){com.modestmaps.addEvent(window,"popstate",function(b){b.state&&b.state.map_location&&a(b.state.map_location)},!1)},getState:function(){if(!!window.history&&!!window.history.state)return history.state&&history.state.map_location},pushState:function(a){!!window.history&&!!window.history.pushState&&window.history.pushState({map_location:a},document.title,window.location.href)}},wax.mm.hash=function(a,b,c){function l(a){a!==d&&i(d=a)&&e.move()}function k(){var a=j();d!==a&&(d=a,c.manager.pushState(d))}function h(a,b){return g(a,b,!1)}function g(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}}c=c||{};var d,e={},f=90-1e-8;c.manager=c.manager||wax.mm.pushState;var i=function(b){var c=b.split("/");for(var d=0;d<c.length;d++){c[d]=Number(c[d]);if(isNaN(c[d]))return!0}if(c.length<3)return!0;c.length==3&&a.setCenterZoom(new com.modestmaps.Location(c[1],c[2]),c[0])},j=function(){var b=a.getCenter(),c=a.getZoom(),d=Math.max(0,Math.ceil(Math.log(c)/Math.LN2));return[c.toFixed(2),b.lat.toFixed(d),b.lon.toFixed(d)].join("/")},m=function(){c.defaultCenter&&a.setCenter(c.defaultCenter),c.defaultZoom&&a.setZoom(c.defaultZoom)};e.add=function(a){c.manager.getState()?e.stateChange(c.manager.getState()):(m(),k()),a.addCallback("drawn",h(k,500)),c.manager.stateChange(l);return this};return e.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.interaction=function(a,b,c){function y(b,c){var d=s(c),i;d&&e.getGrid(d.src,function(e,j){for(var k=0;j&&k<g.length;k++)if(i=j.getFeature(c.x,c.y,d,{format:g[k]}))switch(g[k]){case"full":case"teaser":return f.click(i,a.parent,0,b);case"location":return h(i)}})}function x(b){var c=wax.util.eventoffset(b);d.removeEvent(a.parent,"mouseup",x),a.parent.ontouchend&&(d.removeEvent(a.parent,"touchend",x),d.removeEvent(a.parent,"touchmove",_touchCancel)),j=!1,b.type==="touchend"?y(n):Math.round(c.y/o)===Math.round(n.y/o)&&Math.round(c.x/o)===Math.round(n.x/o)&&(k=window.setTimeout(function(a){return function(b){y(b,a)}}(c)));return x}function w(){d.removeEvent(a.parent,"touchend",x),d.removeEvent(a.parent,"touchmove",x),j=!1}function v(b){t()||(j=!0,n=wax.util.eventoffset(b),b.type==="mousedown"?d.addEvent(a.parent,"mouseup",x):b.type==="touchstart"&&b.touches.length===1&&(this.clickAction=["full","teaser"],f._currentTooltip&&f.hideTooltip(f._currentTooltip),d.addEvent(a.parent,"touchend",x),d.addEvent(a.parent,"touchmove",w)))}function u(b){if(!j){var c=wax.util.eventoffset(b),d=s(c),g;d&&e.getGrid(d.src,function(e,h){!e&&!!h&&((g=h.getFeature(c.x,c.y,d,{format:"teaser"}))?g&&m!==g?(m=g,f.out(a.parent),f.over(g,a.parent,0,b)):g||(m=null,f.out(a.parent)):(m=null,f.out(a.parent)))})}}function t(){if(k){window.clearTimeout(k),k=null;return!0}return!1}function s(a){for(var b=0,c=q();b<c.length;b++)if(c[b][0]<a.y&&c[b][0]+256>a.y&&c[b][1]<a.x&&c[b][1]+256>a.x)return c[b][2];return!1}function r(a,b){p=null}function q(){var b=a.createOrGetLayer(Math.round(a.getZoom()));return p||(p=function(a){var c=[];for(var d in a)if(a[d].parentNode===b){var e=wax.util.offset(a[d]);c.push([e.top,e.left,a[d]])}return c}(a.tiles))}c=c||{},b=b||{};var d=com.modestmaps,e=wax.GridManager(b),f=c.callbacks||new wax.tooltip,g=c.clickAction||["full"],h=c.clickHandler||function(a){window.location=a},i={},j=!1,k=!1,l="ontouchstart"in document.documentElement,m,n,o=4,p;i.add=function(){var b=["zoomed","panned","centered","extentset","resized","drawn"];for(var c=0;c<b.length;c++)a.addCallback(b[c],r);d.addEvent(a.parent,"mousemove",u),d.addEvent(a.parent,"mousedown",v),l&&d.addEvent(a.parent,"touchstart",v);return this};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.legend=function(a,b){b=b||{};var c,d={};d.add=function(){c=wax.legend().content(b.legend||"");return this},d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this};return d.add()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.mobile=function(a,b,c){c=c||{};var d=com.modestmaps,e=navigator.userAgent.toLowerCase(),f=e.indexOf("webkit")!=-1,g=e.indexOf("mobile")!=-1,h=g&&f,i=function(a){var b=document.createElement("canvas"),c=parseInt(a.style.width,10),d=parseInt(a.style.height,10),e=c/2,f=d/2,g=Math.min(c,d)/4,h=b.getContext("2d");b.setAttribute("width",c),b.setAttribute("height",d),h.globalAlpha=.5;var i=h.createLinearGradient(0,0,300,225);i.addColorStop(0,"black"),i.addColorStop(1,"rgb(200, 200, 200)"),h.fillStyle=i,h.fillRect(0,0,c,d),h.fillStyle="rgb(255, 255, 255)",h.beginPath(),h.moveTo(e-g*.6,f-g),h.lineTo(e-g*.6,f+g),h.lineTo(e+g*.6,f),h.fill(),a.appendChild(b)},j=function(a){a.style.position="absolute",a.style.height="50px",a.style.left=a.style.right="0";var b=document.createElement("canvas");b.setAttribute("width",a.offsetWidth),b.setAttribute("height",a.offsetHeight);var c=b.getContext("2d");c.globalAlpha=1,c.fillStyle="rgba(255, 255, 255, 0.5)",c.fillRect(0,0,a.offsetWidth,a.offsetHeight),c.fillStyle="rgb(0, 0, 0)",c.font="bold 20px sans-serif",c.fillText("back",20,30),a.appendChild(b)},k=function(a){a.style.position="absolute",a.style.width=a.style.height="auto",a.style.top=window.pageYOffset+"px",a.style.left=a.style.right="0px"},l=function(a){a.style.position="relative",a.style.width=a.style.height=a.style.top=a.style.left=a.style.right="auto"},m,n,o,p,q=c.overlayDraw||i,r=c.backDraw||j;bodyDraw=c.bodyDraw||function(){};var s={add:function(a){h&&(p=document.createElement("meta"),p.id="wax-touch",p.setAttribute("name","viewport"),m=document.createElement("div"),m.id=a.parent.id+"-mobileoverlay",m.className="wax-mobileoverlay",m.style.position="absolute",m.style.width=a.dimensions.x+"px",m.style.height=a.dimensions.y+"px",a.parent.appendChild(m),q(m),o=document.createElement("div"),backDiv=document.createElement("div"),n=document.body,newBody=document.createElement("body"),newBody.className="wax-mobile-body",newBody.appendChild(backDiv),d.addEvent(m,"touchstart",this.toTouch),d.addEvent(backDiv,"touchstart",this.toPage));return this},toTouch:function(){a.parent.parentNode.replaceChild(o,a.parent),newBody.insertBefore(a.parent,backDiv),document.body=newBody,bodyDraw(newBody),r(backDiv),p.setAttribute("content","initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"),document.head.appendChild(p),a._smallSize=[a.parent.clientWidth,a.parent.clientHeight],k(a.parent),a.setSize(a.parent.offsetWidth,window.innerHeight),backDiv.style.display="block",m.style.display="none"},toPage:function(){document.body=n,o.parentNode.replaceChild(a.parent,o),l(a.parent),a.setSize(a._smallSize[0],a._smallSize[1]),backDiv.style.display="none",m.style.display="block"}};return s.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.pointselector=function(a,b,c){function p(b){!d||(e=l(b),h.Point.distance(d,e)<f&&(i.addLocation(a.pointLocation(d)),k(m(j))),d=null)}function o(b){d=l(b),h.addEvent(a.parent,"mouseup",p)}function n(){var b=new h.Point(0,0);for(var c=0;c<j.length;c++){var d=a.locationPoint(j[c]);j[c].pointDiv||(j[c].pointDiv=document.createElement("div"),j[c].pointDiv.className="wax-point-div",j[c].pointDiv.style.position="absolute",j[c].pointDiv.style.display="block",j[c].pointDiv.location=j[c],h.addEvent(j[c].pointDiv,"mouseup",function(b){var d=j[c];return function(b){h.removeEvent(a.parent,"mouseup",p),i.deletePoint(d,b)}}()),a.parent.appendChild(j[c].pointDiv)),j[c].pointDiv.style.left=d.x+"px",j[c].pointDiv.style.top=d.y+"px"}}function m(a){var b=[];for(var c=0;c<a.length;c++)b.push(new h.Location(a[c].lat,a[c].lon));return b}function l(b){var c=wax.util.eventoffset(b),d=new h.Point(c.x,c.y),e={x:parseFloat(h.getStyle(document.documentElement,"margin-left")),y:parseFloat(h.getStyle(document.documentElement,"margin-top"))};isNaN(e.x)||(d.x-=e.x),isNaN(e.y)||(d.y-=e.y);for(var f=a.parent;f;f=f.offsetParent)d.x-=f.offsetLeft,d.y-=f.offsetTop;return d}var d=null,e=null,f=5,g,h=com.modestmaps,i={},j=[],k=typeof c=="function"?c:c.callback;i.addLocation=function(a){j.push(a),n(),k(m(j))},i.add=function(a){h.addEvent(a.parent,"mousedown",o),a.addCallback("drawn",n());return this},i.deletePoint=function(a,b){confirm("Delete this point?")&&(a.pointDiv.parentNode.removeChild(a.pointDiv),j.splice(wax.util.indexOf(j,a),1),k(m(j)))};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoombox=function(a){function j(a){if(!!d){var b=g(a);e.style.display="block",b.x<f.x?e.style.left=b.x+"px":e.style.left=f.x+"px",e.style.width=Math.abs(b.x-f.x)+"px",b.y<f.y?e.style.top=b.y+"px":e.style.top=f.y+"px",e.style.height=Math.abs(b.y-f.y)+"px";return c.cancelEvent(a)}}function i(b){if(!!b.shiftKey&&!this.drawing){d=!0,f=g(b),e.style.left=f.x+"px",e.style.top=f.y+"px",c.addEvent(a.parent,"mousemove",j),c.addEvent(a.parent,"mouseup",h),a.parent.style.cursor="crosshair";return c.cancelEvent(b)}}function h(b){if(!!d){d=!1;var i=g(b),k=a.pointLocation(i),l=a.pointLocation(f);a.setExtent([k,l]),e.style.display="none",c.removeEvent(a.parent,"mousemove",j),c.removeEvent(a.parent,"mouseup",h),a.parent.style.cursor="auto"}}function g(b){var d=new c.Point(b.clientX,b.clientY);d.x+=document.body.scrollLeft+document.documentElement.scrollLeft,d.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var e=a.parent;e;e=e.offsetParent)d.x-=e.offsetLeft,d.y-=e.offsetTop;return d}var b={},c=com.modestmaps,d=!1,e,f=null;b.add=function(a){e=e||document.createElement("div"),e.id=a.parent.id+"-zoombox-box",e.className="zoombox-box",a.parent.appendChild(e),c.addEvent(a.parent,"mousedown",i);return this},b.remove=function(){a.parent.removeChild(e),c.removeEvent(a.parent,"mousedown",i)};return b.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoomer=function(a){var b=com.modestmaps,c=document.createElement("a");c.innerHTML="+",c.href="#",c.className="zoomer zoomin",b.addEvent(c,"mousedown",function(a){b.cancelEvent(a)}),b.addEvent(c,"dblclick",function(a){b.cancelEvent(a)}),b.addEvent(c,"click",function(c){b.cancelEvent(c),a.zoomIn()},!1);var d=document.createElement("a");d.innerHTML="-",d.href="#",d.className="zoomer zoomout",b.addEvent(d,"mousedown",function(a){b.cancelEvent(a)}),b.addEvent(d,"dblclick",function(a){b.cancelEvent(a)}),b.addEvent(d,"click",function(c){b.cancelEvent(c),a.zoomOut()},!1);var e={add:function(a){a.addCallback("drawn",function(a,b){a.coordinate.zoom===a.provider.outerLimits()[0].zoom?d.className="zoomer zoomout zoomdisabled":a.coordinate.zoom===a.provider.outerLimits()[1].zoom?c.className="zoomer zoomin zoomdisabled":(c.className="zoomer zoomin",d.className="zoomer zoomout")});return this},appendTo:function(a){wax.util.$(a).appendChild(c),wax.util.$(a).appendChild(d);return this}};return e.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.connector=function(a){this.options={tiles:a.tiles,scheme:a.scheme||"xyz",minzoom:a.minzoom||0,maxzoom:a.maxzoom||22}},wax.mm.connector.prototype={outerLimits:function(){return[(new com.modestmaps.Coordinate(0,0,0)).zoomTo(this.options.minzoom),(new com.modestmaps.Coordinate(1,1,0)).zoomTo(this.options.maxzoom)]},getTileUrl:function(a){if(!(coord=this.sourceCoordinate(a)))return null;coord.row=this.options.scheme==="tms"?Math.pow(2,coord.zoom)-coord.row-1:coord.row;return this.options.tiles[parseInt(Math.pow(2,coord.zoom)*coord.row+coord.column,10)%this.options.tiles.length].replace("{z}",coord.zoom.toFixed(0)).replace("{x}",coord.column.toFixed(0)).replace("{y}",coord.row.toFixed(0))}},com&&com.modestmaps&&com.modestmaps.extend(wax.mm.connector,com.modestmaps.MapProvider)
View
4 dist/wax.ol.js
@@ -1,4 +1,4 @@
-/* wax - 3.0.1 - 1.0.4-321-g053540e */
+/* wax - 3.0.2 - 1.0.4-322-g6189bf0 */
/*!
@@ -336,7 +336,7 @@ wax.GridManager = function(options) {
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
- xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
+ xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),
formatter;
var formatterUrl = function(url) {
View
4 dist/wax.ol.min.js
@@ -1,6 +1,6 @@
-/* wax - 3.0.1 - 1.0.4-321-g053540e *//*!
+/* wax - 3.0.2 - 1.0.4-322-g6189bf0 *//*!
* Reqwest! A x-browser general purpose XHR connection manager
* copyright Dustin Diaz 2011
* https://github.com/ded/reqwest
* license MIT
- */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}}},wax=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)}},wax.tooltip.prototype.click=function(a,b,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}};var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Embedder=OpenLayers.Class(OpenLayers.Control,{initialize:function(a){a=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){$("#"+this.el+"-script").length&&(OpenLayers.Control.prototype.setMap.apply(this,arguments),$(a.div).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"))),this.activate()},CLASS_NAME:"wax.ol.Embedder"});var wax=wax||{};wax.ol=wax.ol||{};var addEv=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)};wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a,b){this.options=b||{},this.clickAction=this.options.clickAction||"full",this.gm=new wax.GridManager(a),OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks=this.options.callbacks||new wax.tooltip},setMap:function(a){addEv(a.viewPortDiv,"mousemove",wax.util.bind(this.getInfoForHover,this)),addEv(a.viewPortDiv,"mouseout",wax.util.bind(this.resetLayers,this)),this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.getInfoForClick}),this.clickHandler.setMap(a),this.clickHandler.activate(),a.events.on({addlayer:this.resetLayers,changelayer:this.resetLayers,removelayer:this.resetLayers,changebaselayer:this.resetLayers,scope:this}),OpenLayers.Control.prototype.setMap.apply(this,arguments)},getTileStack:function(a,b){if(!a||!b)return[];var c=[];layerfound:for(var d=0;d<a.length;d++)for(var e=0;e<a[d].grid.length;e++)for(var f=0;f<a[d].grid[e].length;f++){if(a[d].grid[e][f].imgDiv)var g=wax.util.offset(a[d].grid[e][f].imgDiv);else var g=wax.util.offset(a[d].grid[e][f].frame);if(g&&g.top<b.y&&g.top+256>b.y&&g.left<b.x&&g.left+256>b.x){c.push(a[d].grid[e][f]);continue layerfound}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;this._viableLayers=[];for(var a in this.map.layers)this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"&&this._viableLayers.push(this.map.layers[a]);return this._viableLayers},resetLayers:function(a){this._viableLayers=null;var b=a.relatedTarget||a.toElement;b&&b.className!=="olTileImage"&&this.callbacks.out(this.map.viewPortDiv)},getInfoForClick:function(a){if(!!a){var b=this.viableLayers(),c=wax.util.eventoffset(a),d=this.getTileStack(this.viableLayers(),c),e=null,f=null,g=this;for(var h=0;h<d.length;h++){if(!d[h].url)continue;this.gm.getGrid(d[h].url,function(a,b){if(!!b){var e=b.getFeature(c.x,c.y,d[h].frame,{format:g.clickAction});if(e)switch(g.clickAction){case"full":g.callbacks.click(e,d[h].layer.map.viewPortDiv,h);break;case"location":window.location=e}}})}}},getInfoForHover:function(a){if(!!a){var b={format:"teaser"},c=this.viableLayers(),d=wax.util.eventoffset(a),e=this.getTileStack(this.viableLayers(),d),f=null,g=null,h=this;for(var i=0;i<e.length;i++){if(!e[i].url)continue;this.gm.getGrid(e[i].url,function(c,f){if(f&&e[i]){var g=f.getFeature(d.x,d.y,e[i].frame,b);if(g){if(!e[i])return;g&&h.feature[i]!==g?(h.feature[i]=g,h.callbacks.out(e[i].layer.map.div),h.callbacks.over(g,e[i].layer.map.div,i,a)):g||(h.feature[i]=null,h.callbacks.out(e[i].layer.map.div))}else h.feature[i]&&h.callbacks.out(e[i].layer.map.div),h.feature[i]=null}})}}},CLASS_NAME:"wax.ol.Interaction"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Legend=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Legend",legend:null,options:null,initialize:function(a){this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},activate:function(){this.legend=new wax.Legend(this.map.viewPortDiv,this.options.container);return OpenLayers.Control.prototype.activate.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate(),this.map.events.on({addlayer:this.setLegend,changelayer:this.setLegend,removelayer:this.setLegend,changebaselayer:this.setLegend,scope:this})},setLegend:function(){var a=[];for(var b=0;b<this.map.layers.length;b++){var c=this.map.layers[b];c&&c.getURL&&c.visibility&&a.push(c.getURL(new OpenLayers.Bounds))}this.legend.render(a)}});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Switcher=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Switcher",initialize:function(a){this.$element=$(a.e),this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this}),this.redraw()},layerClick:function(a){var b=a.currentTarget,c=$(b).data("layer");$("a.active",this.$element).removeClass("active"),$.each(this.map.getLayersBy("isBaseLayer",!1),function(){this.CLASS_NAME!=="OpenLayers.Layer.Vector.RootContainer"&&this.displayInLayerSwitcher&&this.setVisibility(!1)}),c.setVisibility(!0),$(b).addClass("active")},needsRedraw:function(){if(!this.layerStates||this.layerStates.length||this.map.layers.length!=this.layerStates.length)return!0;for(var a=0,b=this.layerStates.length;a<b;a++){var c=this.layerStates[a],d=this.map.layers[a];if(c.name!=d.name||c.inRange!=d.inRange||c.id!=d.id||c.visibility!=d.visibility)return!0}return!1},redraw:function(){if(this.needsRedraw()){this.$element.html("");var a=this.map.layers.length;this.layerStates=[];for(var b=0;b<a;b++){var c=this.map.layers[b];this.layerStates[b]={name:c.name,visibility:c.visibility,inRange:c.inRange,id:c.id}}var d=this.map.layers.slice();for(b=0,a=d.length;b<a;b++){var e=d[b];if(e.displayInLayerSwitcher){var f=e.isBaseLayer?e===this.map.baseLayer:e.getVisibility(),g=$.proxy(function(a){this.layerClick(a);return!1},this),h=$("<a></a>");h.click(g).attr("href","#").text(e.name).addClass("layer-toggle").data("layer",e).attr("disabled",!e.inRange),f&&h.addClass("active")}this.$element.append(h),this.$element.trigger("layeradded",h)}}}})
+ */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}}},wax=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)}},wax.tooltip.prototype.click=function(a,b,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}}};var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Embedder=OpenLayers.Class(OpenLayers.Control,{initialize:function(a){a=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){$("#"+this.el+"-script").length&&(OpenLayers.Control.prototype.setMap.apply(this,arguments),$(a.div).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"))),this.activate()},CLASS_NAME:"wax.ol.Embedder"});var wax=wax||{};wax.ol=wax.ol||{};var addEv=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)};wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a,b){this.options=b||{},this.clickAction=this.options.clickAction||"full",this.gm=new wax.GridManager(a),OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks=this.options.callbacks||new wax.tooltip},setMap:function(a){addEv(a.viewPortDiv,"mousemove",wax.util.bind(this.getInfoForHover,this)),addEv(a.viewPortDiv,"mouseout",wax.util.bind(this.resetLayers,this)),this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.getInfoForClick}),this.clickHandler.setMap(a),this.clickHandler.activate(),a.events.on({addlayer:this.resetLayers,changelayer:this.resetLayers,removelayer:this.resetLayers,changebaselayer:this.resetLayers,scope:this}),OpenLayers.Control.prototype.setMap.apply(this,arguments)},getTileStack:function(a,b){if(!a||!b)return[];var c=[];layerfound:for(var d=0;d<a.length;d++)for(var e=0;e<a[d].grid.length;e++)for(var f=0;f<a[d].grid[e].length;f++){if(a[d].grid[e][f].imgDiv)var g=wax.util.offset(a[d].grid[e][f].imgDiv);else var g=wax.util.offset(a[d].grid[e][f].frame);if(g&&g.top<b.y&&g.top+256>b.y&&g.left<b.x&&g.left+256>b.x){c.push(a[d].grid[e][f]);continue layerfound}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;this._viableLayers=[];for(var a in this.map.layers)this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"&&this._viableLayers.push(this.map.layers[a]);return this._viableLayers},resetLayers:function(a){this._viableLayers=null;var b=a.relatedTarget||a.toElement;b&&b.className!=="olTileImage"&&this.callbacks.out(this.map.viewPortDiv)},getInfoForClick:function(a){if(!!a){var b=this.viableLayers(),c=wax.util.eventoffset(a),d=this.getTileStack(this.viableLayers(),c),e=null,f=null,g=this;for(var h=0;h<d.length;h++){if(!d[h].url)continue;this.gm.getGrid(d[h].url,function(a,b){if(!!b){var e=b.getFeature(c.x,c.y,d[h].frame,{format:g.clickAction});if(e)switch(g.clickAction){case"full":g.callbacks.click(e,d[h].layer.map.viewPortDiv,h);break;case"location":window.location=e}}})}}},getInfoForHover:function(a){if(!!a){var b={format:"teaser"},c=this.viableLayers(),d=wax.util.eventoffset(a),e=this.getTileStack(this.viableLayers(),d),f=null,g=null,h=this;for(var i=0;i<e.length;i++){if(!e[i].url)continue;this.gm.getGrid(e[i].url,function(c,f){if(f&&e[i]){var g=f.getFeature(d.x,d.y,e[i].frame,b);if(g){if(!e[i])return;g&&h.feature[i]!==g?(h.feature[i]=g,h.callbacks.out(e[i].layer.map.div),h.callbacks.over(g,e[i].layer.map.div,i,a)):g||(h.feature[i]=null,h.callbacks.out(e[i].layer.map.div))}else h.feature[i]&&h.callbacks.out(e[i].layer.map.div),h.feature[i]=null}})}}},CLASS_NAME:"wax.ol.Interaction"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Legend=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Legend",legend:null,options:null,initialize:function(a){this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},activate:function(){this.legend=new wax.Legend(this.map.viewPortDiv,this.options.container);return OpenLayers.Control.prototype.activate.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate(),this.map.events.on({addlayer:this.setLegend,changelayer:this.setLegend,removelayer:this.setLegend,changebaselayer:this.setLegend,scope:this})},setLegend:function(){var a=[];for(var b=0;b<this.map.layers.length;b++){var c=this.map.layers[b];c&&c.getURL&&c.visibility&&a.push(c.getURL(new OpenLayers.Bounds))}this.legend.render(a)}});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Switcher=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Switcher",initialize:function(a){this.$element=$(a.e),this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this}),this.redraw()},layerClick:function(a){var b=a.currentTarget,c=$(b).data("layer");$("a.active",this.$element).removeClass("active"),$.each(this.map.getLayersBy("isBaseLayer",!1),function(){this.CLASS_NAME!=="OpenLayers.Layer.Vector.RootContainer"&&this.displayInLayerSwitcher&&this.setVisibility(!1)}),c.setVisibility(!0),$(b).addClass("active")},needsRedraw:function(){if(!this.layerStates||this.layerStates.length||this.map.layers.length!=this.layerStates.length)return!0;for(var a=0,b=this.layerStates.length;a<b;a++){var c=this.layerStates[a],d=this.map.layers[a];if(c.name!=d.name||c.inRange!=d.inRange||c.id!=d.id||c.visibility!=d.visibility)return!0}return!1},redraw:function(){if(this.needsRedraw()){this.$element.html("");var a=this.map.layers.length;this.layerStates=[];for(var b=0;b<a;b++){var c=this.map.layers[b];this.layerStates[b]={name:c.name,visibility:c.visibility,inRange:c.inRange,id:c.id}}var d=this.map.layers.slice();for(b=0,a=d.length;b<a;b++){var e=d[b];if(e.displayInLayerSwitcher){var f=e.isBaseLayer?e===this.map.baseLayer:e.getVisibility(),g=$.proxy(function(a){this.layerClick(a);return!1},this),h=$("<a></a>");h.click(g).attr("href","#").text(e.name).addClass("layer-toggle").data("layer",e).attr("disabled",!e.inRange),f&&h.addClass("active")}this.$element.append(h),this.$element.trigger("layeradded",h)}}}})
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "wax",
- "version": "3.0.1",
+ "version": "3.0.2",
"description": "Tools for improving web maps.",
"author": {
"name": "MapBox",

0 comments on commit f3dc3a4

Please sign in to comment.