Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding new controls and Modest Maps code for 1.1.0

  • Loading branch information...
commit 046add470ca68cc6bf385ff34315cd9aa2ff9814 1 parent f22a88e
Tom MacWright authored
View
26 README.md
@@ -12,6 +12,8 @@ implementation of the [MBTiles interaction specification](https://github.com/map
* `wax.ol.Interaction`
* `wax.ol.Legend`
+* `wax.ol.Embedder`
+* `wax.ol.Switcher`
#### Google Maps API v3
@@ -19,13 +21,19 @@ implementation of the [MBTiles interaction specification](https://github.com/map
* `wax.g.MapType`
* `wax.g.mapBoxLogo`
+#### Modest Maps
+
+* `.interaction()`
+* `.zoomer()`
+* `.legend()`
+
#### Lib
* `jquery.jsonp-2.1.4.js`, [from jquery-jsonp](http://code.google.com/p/jquery-jsonp/)
#### Records
-The main usage of mapping frameworks through Wax is via records. Records are pure JSON objects that have a 1:1 representation with function Javascript code, but, unlike imperative code, can be stored and manipulated as configuration. Records are tested with [polymaps](http://polymaps.org), [openlayers](http://openlayers.org/) and Google Maps API v3, but the system (`/lib/record.js`) is generalized beyond mapping tools of any sort, to exist as a basic Javascript AST interpreter.
+The main usage of mapping frameworks through Wax is via records. Records are pure JSON objects that have a 1:1 representation with function Javascript code, but, unlike imperative code, can be stored and manipulated as configuration. Records are tested with [polymaps](http://polymaps.org), [openlayers](http://openlayers.org/), [Modest Maps](https://github.com/stamen/modestmaps-js) and Google Maps API v3, but the system (`/lib/record.js`) is generalized beyond mapping tools of any sort, to exist as a basic Javascript AST interpreter.
Currently records support several control techniques:
@@ -93,29 +101,35 @@ Wax includes two libraries in `/lib` which are included in builds
## Changelog
+#### 1.1.0
+
+* connector/mm: Added [Modest Maps](https://github.com/stamen/modestmaps-js) connector.
+* control/mm: Added `.legend()`, `.interaction()`, and `.zoomer()` controls for Modest Maps.
+* control/lib: Added `addedTooltip` event to `tooltip.js` to allow for external styling code.
+
#### 1.0.4
* connector/g: Hide error tiles and wrap on dateline.
* connector/g: Performance improvements.
-* control/legend: Fix rerender bug
+* control/legend: Fix rerender bug.
* control/tooltip: `addedtooltip` event for binding/extending tooltip behavior. Subject to change.
#### 1.0.3
-* Embedder functionality for Google Maps and OpenLayers
+* Embedder functionality for Google Maps and OpenLayers.
#### 1.0.2
-* Bug fixes for Firefox 3
+* Bug fixes for Firefox 3.
#### 1.0.1
* `make ext` added for downloading and installing external libraries needed to use examples.
-* Bug fixes for legend, IE compatibility
+* Bug fixes for legend, IE compatibility.
#### 1.0.0
-* Initial release
+* Initial release.
## Authors
View
43 build/wax.g.js
@@ -1186,6 +1186,29 @@ wax.Record = function(obj, context) {
// Wax header
var wax = wax || {};
+// Nondrag
+// -------
+// A simple abstraction from the `mousemove` handler that doesn't
+// trigger mousemove events while dragging.
+(function($) {
+ $.fn.extend({
+ nondrag: function(callback) {
+ $(this).bind('mousedown mouseup mousemove', function(evt) {
+ var down = false;
+ if (evt.type === 'mouseup') {
+ down = false;
+ } else if (down || evt.type === 'mousedown') {
+ down = true;
+ // Don't trigger the callback if this is a drag.
+ return;
+ }
+ callback(evt);
+ });
+ return this;
+ }
+ });
+})(jQuery);
+
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
@@ -1228,21 +1251,21 @@ wax.request = {
});
}
}
-}
+};
// GridInstance
// ------------
// GridInstances are queryable, fully-formed
// objects for acquiring features from events.
-wax.GridInstance = function (grid_tile, formatter) {
+wax.GridInstance = function(grid_tile, formatter) {
this.grid_tile = grid_tile;
this.formatter = formatter;
this.tileRes = 4;
-}
+};
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
-// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
wax.GridInstance.prototype.resolveCode = function(key) {
(key >= 93) && key--;
@@ -1285,12 +1308,12 @@ wax.GridInstance.prototype.getFeature = function(x, y, tile_element, options) {
// GridManager
// -----------
// Generally one GridManager will be used per map.
-wax.GridManager = function () {
+wax.GridManager = function() {
this.grid_tiles = {};
this.key_maps = {};
this.formatters = {};
this.locks = {};
-}
+};
// Get a grid - calls `callback` with either a `GridInstance`
// object or false. Behind the scenes, this calls `getFormatter`
@@ -1360,7 +1383,7 @@ wax.Formatter = function(obj) {
} else {
this.f = function() {};
}
-}
+};
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
@@ -1426,7 +1449,7 @@ wax.tooltip.getToolTip = function(feature, context, index, evt) {
tooltip = $("<div class='wax-tooltip wax-tooltip-" +
index +
"'>" +
- "</div>").html(feature);
+ '</div>').html(feature);
if (!$(context).triggerHandler('addedtooltip', [tooltip, context, evt])) {
$(context).append(tooltip);
}
@@ -1470,7 +1493,7 @@ wax.tooltip.select = function(feature, context, layer_id, evt) {
// highest layer underneath if found.
wax.tooltip.unselect = function(feature, context, layer_id, evt) {
$(context)
- .css('cursor', 'default')
+ .css('cursor', 'default');
if (layer_id) {
$('div.wax-tooltip-' + layer_id + ':not(.wax-popup)')
.remove();
@@ -1613,7 +1636,7 @@ wax.g.Controls.prototype.Embedder = function(script_id) {
'z-index': '9999999999',
'position': 'relative'
})
- .val("<div id='" + script_id + "'>" + $('#' + script_id).html() + "</div>"));
+ .val("<div id='" + script_id + "'>" + $('#' + script_id).html() + '</div>'));
return this;
};
// Wax for Google Maps API v3
View
2  build/wax.g.min.js
@@ -7,4 +7,4 @@
*
* This document is licensed as free software under the terms of the
* MIT License: http://www.opensource.org/licenses/mit-license.php
- */(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),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 _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.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)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(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)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){if(c.left&&c.top)var e=c.left,f=c.top;else{var g=$(c),e=g.offset().left;f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a){a?this.legends[d]?this.legends[d].show():(this.legends[d]=$("<div class='wax-legend'></div>").append(a),this.container.append(this.legends[d])):this.legends[d]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show()};var wax=wax||{};wax.g=wax.g||{},wax.g.Controls=function(a){this.map=a,this.mapDiv=!1;for(var b in a)if(a[b]&&a[b].nodeType>0){this.mapDiv=a[b];break}},wax.g.Controls.prototype.calculateGrid=function(){if(!this.map.interaction_grid){var a=$("div.interactive-div-"+this.map.getZoom()+" img",this.mapDiv),b=$(this.mapDiv).offset(),c=$(a).map(function(c){var d=$(a[c]).offset();return{xy:{left:d.left-b.left,top:d.top-b.top},tile:a[c]}});return c}},wax.g.Controls.prototype.inTile=function(a,b){if(b.top<a.y&&b.top+256>a.y&&b.left<a.x&&b.left+256>a.x)return!0},wax.g.Controls.prototype.Interaction=function(){var a=this,b=new wax.GridManager,c=null,d=function(b,c){var d=!1,e=a.calculateGrid();for(var f=0;f<e.length&&!d;f++)if(a.inTile(c.pixel,e[f].xy))var d=e[f];return d};google.maps.event.addListener(this.map,"mousemove",function(e){var g={format:"teaser"},h=d(this.map,e);!h||b.getGrid($(h.tile).attr("src"),function(b){if(!!b){var d=b.getFeature(e.pixel.x+$(a.mapDiv).offset().left,e.pixel.y+$(a.mapDiv).offset().top,h.tile,g);d!==c&&(wax.tooltip.unselect(d,$(a.mapDiv),0),wax.tooltip.select(d,$(a.mapDiv),0),c=d)}})}),google.maps.event.addListener(this.map,"click",function(c){var e={format:"full"},f=d(this.map,c);!f||b.getGrid($(f.tile).attr("src"),function(b){if(!!b){var d=b.getFeature(c.pixel.x+$(a.mapDiv).offset().left,c.pixel.y+$(a.mapDiv).offset().top,f.tile,e);d&&wax.tooltip.click(d,$(a.mapDiv),0)}})});return this},wax.g.Controls.prototype.Legend=function(){var a=this,b=new wax.Legend($(this.mapDiv)),c=null;google.maps.event.addListener(this.map,"idle",function(){if(!c){var d=$("div.interactive-div-"+a.map.getZoom()+" img:first",a.mapDiv);d&&(c=d.attr("src"))&&b.render([c])}});return this},wax.g.Controls.prototype.Embedder=function(a){$(this.mapDiv).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+a+"'>"+$("#"+a).html()+"</div>"));return this};var wax=wax||{};wax.g=wax.g||{},wax.g.MapType=function(a){a=a||{},this.name=a.name||"",this.alt=a.alt||"",this.maxZoom=a.maxZoom||18,this.minZoom=a.minZoom||0,this.baseUrl=a.baseUrl||"http://a.tile.mapbox.com/1.0.0/world-light",this.blankImage=a.blankImage||"",this.interactive=!0,this.tileSize=new google.maps.Size(256,256),this.cache={}},wax.g.MapType.prototype.getTile=function(a,b,c){var d=b+"/"+a.x+"/"+a.y;this.cache[d]=this.cache[d]||$("<div></div>").addClass("interactive-div-"+b).width(256).height(256).data("gTileKey",d).append($("<img />").width(256).height(256).attr("src",this.getTileUrl(a,b)).error(function(){$(this).hide()}))[0];return this.cache[d]},wax.g.MapType.prototype.releaseTile=function(a){var b=$(a).data("gTileKey");this.cache[b]&&delete this.cache[b],$(a).remove()},wax.g.MapType.prototype.getTileUrl=function(a,b){var c=Math.pow(2,b),d=c-1-a.y,e=a.x%c;e=e<0?a.x%c+c:e;return d>=0?this.baseUrl+"/"+b+"/"+e+"/"+d+".png":this.blankImage}
+ */(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),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 _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.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)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(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)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){if(c.left&&c.top)var e=c.left,f=c.top;else{var g=$(c),e=g.offset().left;f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a){a?this.legends[d]?this.legends[d].show():(this.legends[d]=$("<div class='wax-legend'></div>").append(a),this.container.append(this.legends[d])):this.legends[d]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show()};var wax=wax||{};wax.g=wax.g||{},wax.g.Controls=function(a){this.map=a,this.mapDiv=!1;for(var b in a)if(a[b]&&a[b].nodeType>0){this.mapDiv=a[b];break}},wax.g.Controls.prototype.calculateGrid=function(){if(!this.map.interaction_grid){var a=$("div.interactive-div-"+this.map.getZoom()+" img",this.mapDiv),b=$(this.mapDiv).offset(),c=$(a).map(function(c){var d=$(a[c]).offset();return{xy:{left:d.left-b.left,top:d.top-b.top},tile:a[c]}});return c}},wax.g.Controls.prototype.inTile=function(a,b){if(b.top<a.y&&b.top+256>a.y&&b.left<a.x&&b.left+256>a.x)return!0},wax.g.Controls.prototype.Interaction=function(){var a=this,b=new wax.GridManager,c=null,d=function(b,c){var d=!1,e=a.calculateGrid();for(var f=0;f<e.length&&!d;f++)if(a.inTile(c.pixel,e[f].xy))var d=e[f];return d};google.maps.event.addListener(this.map,"mousemove",function(e){var g={format:"teaser"},h=d(this.map,e);!h||b.getGrid($(h.tile).attr("src"),function(b){if(!!b){var d=b.getFeature(e.pixel.x+$(a.mapDiv).offset().left,e.pixel.y+$(a.mapDiv).offset().top,h.tile,g);d!==c&&(wax.tooltip.unselect(d,$(a.mapDiv),0),wax.tooltip.select(d,$(a.mapDiv),0),c=d)}})}),google.maps.event.addListener(this.map,"click",function(c){var e={format:"full"},f=d(this.map,c);!f||b.getGrid($(f.tile).attr("src"),function(b){if(!!b){var d=b.getFeature(c.pixel.x+$(a.mapDiv).offset().left,c.pixel.y+$(a.mapDiv).offset().top,f.tile,e);d&&wax.tooltip.click(d,$(a.mapDiv),0)}})});return this},wax.g.Controls.prototype.Legend=function(){var a=this,b=new wax.Legend($(this.mapDiv)),c=null;google.maps.event.addListener(this.map,"idle",function(){if(!c){var d=$("div.interactive-div-"+a.map.getZoom()+" img:first",a.mapDiv);d&&(c=d.attr("src"))&&b.render([c])}});return this},wax.g.Controls.prototype.Embedder=function(a){$(this.mapDiv).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+a+"'>"+$("#"+a).html()+"</div>"));return this};var wax=wax||{};wax.g=wax.g||{},wax.g.MapType=function(a){a=a||{},this.name=a.name||"",this.alt=a.alt||"",this.maxZoom=a.maxZoom||18,this.minZoom=a.minZoom||0,this.baseUrl=a.baseUrl||"http://a.tile.mapbox.com/1.0.0/world-light",this.blankImage=a.blankImage||"",this.interactive=!0,this.tileSize=new google.maps.Size(256,256),this.cache={}},wax.g.MapType.prototype.getTile=function(a,b,c){var d=b+"/"+a.x+"/"+a.y;this.cache[d]=this.cache[d]||$("<div></div>").addClass("interactive-div-"+b).width(256).height(256).data("gTileKey",d).append($("<img />").width(256).height(256).attr("src",this.getTileUrl(a,b)).error(function(){$(this).hide()}))[0];return this.cache[d]},wax.g.MapType.prototype.releaseTile=function(a){var b=$(a).data("gTileKey");this.cache[b]&&delete this.cache[b],$(a).remove()},wax.g.MapType.prototype.getTileUrl=function(a,b){var c=Math.pow(2,b),d=c-1-a.y,e=a.x%c;e=e<0?a.x%c+c:e;return d>=0?this.baseUrl+"/"+b+"/"+e+"/"+d+".png":this.blankImage}
View
77 build/wax.mm.js
@@ -1186,6 +1186,29 @@ wax.Record = function(obj, context) {
// Wax header
var wax = wax || {};
+// Nondrag
+// -------
+// A simple abstraction from the `mousemove` handler that doesn't
+// trigger mousemove events while dragging.
+(function($) {
+ $.fn.extend({
+ nondrag: function(callback) {
+ $(this).bind('mousedown mouseup mousemove', function(evt) {
+ var down = false;
+ if (evt.type === 'mouseup') {
+ down = false;
+ } else if (down || evt.type === 'mousedown') {
+ down = true;
+ // Don't trigger the callback if this is a drag.
+ return;
+ }
+ callback(evt);
+ });
+ return this;
+ }
+ });
+})(jQuery);
+
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
@@ -1228,21 +1251,21 @@ wax.request = {
});
}
}
-}
+};
// GridInstance
// ------------
// GridInstances are queryable, fully-formed
// objects for acquiring features from events.
-wax.GridInstance = function (grid_tile, formatter) {
+wax.GridInstance = function(grid_tile, formatter) {
this.grid_tile = grid_tile;
this.formatter = formatter;
this.tileRes = 4;
-}
+};
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
-// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
wax.GridInstance.prototype.resolveCode = function(key) {
(key >= 93) && key--;
@@ -1285,12 +1308,12 @@ wax.GridInstance.prototype.getFeature = function(x, y, tile_element, options) {
// GridManager
// -----------
// Generally one GridManager will be used per map.
-wax.GridManager = function () {
+wax.GridManager = function() {
this.grid_tiles = {};
this.key_maps = {};
this.formatters = {};
this.locks = {};
-}
+};
// Get a grid - calls `callback` with either a `GridInstance`
// object or false. Behind the scenes, this calls `getFormatter`
@@ -1360,7 +1383,7 @@ wax.Formatter = function(obj) {
} else {
this.f = function() {};
}
-}
+};
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
@@ -1426,7 +1449,7 @@ wax.tooltip.getToolTip = function(feature, context, index, evt) {
tooltip = $("<div class='wax-tooltip wax-tooltip-" +
index +
"'>" +
- "</div>").html(feature);
+ '</div>').html(feature);
if (!$(context).triggerHandler('addedtooltip', [tooltip, context, evt])) {
$(context).append(tooltip);
}
@@ -1470,7 +1493,7 @@ wax.tooltip.select = function(feature, context, layer_id, evt) {
// highest layer underneath if found.
wax.tooltip.unselect = function(feature, context, layer_id, evt) {
$(context)
- .css('cursor', 'default')
+ .css('cursor', 'default');
if (layer_id) {
$('div.wax-tooltip-' + layer_id + ':not(.wax-popup)')
.remove();
@@ -1486,6 +1509,29 @@ wax.tooltip.unselect = function(feature, context, layer_id, evt) {
.removeClass('hidden')
.show();
};
+// Wax: Fullscreen
+// -----------------
+
+// namespacing!
+if (!com) {
+ var com = { };
+ if (!com.modestmaps) {
+ com.modestmaps = { };
+ }
+}
+
+// Add zoom links, which can be styled as buttons, to a `modestmaps.Map`
+// control. This function can be used chaining-style with other
+// chaining-style controls.
+com.modestmaps.Map.prototype.fullscreen = function() {
+ $('<a class="fullscreen" href="#fullscreen">fullscreen</a>')
+ .click($.proxy(function() {
+ this.parent.toggleClass('fullscreen');
+ return false;
+ }, this))
+ .prependTo(this.parent);
+ return this;
+};
// namespacing!
if (!com) {
var com = { };
@@ -1525,16 +1571,7 @@ com.modestmaps.Map.prototype.interaction = function(options) {
})(this.tiles));
};
- // TODO: don't track on drag
- $(this.parent).bind('mousedown mouseup mousemove', $.proxy(function(evt) {
- var down = false;
- if (evt.type === 'mouseup') {
- down = false;
- } else if (down || evt.type === 'mousedown') {
- down = true;
- return;
- }
-
+ $(this.parent).nondrag($.proxy(function(evt) {
var grid = this.waxGetTileGrid();
for (var i = 0; i < grid.length; i++) {
if ((grid[i][0] < evt.pageY) &&
@@ -1584,7 +1621,7 @@ com.modestmaps.Map.prototype.interaction = function(options) {
// Wax: Legend Control
// -------------------
// Requires:
-//
+//
// * modestmaps
// * wax.Legend
View
2  build/wax.mm.min.js
@@ -7,4 +7,4 @@
*
* This document is licensed as free software under the terms of the
* MIT License: http://www.opensource.org/licenses/mit-license.php
- */(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),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 _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.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)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(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)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){if(c.left&&c.top)var e=c.left,f=c.top;else{var g=$(c),e=g.offset().left;f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a){a?this.legends[d]?this.legends[d].show():(this.legends[d]=$("<div class='wax-legend'></div>").append(a),this.container.append(this.legends[d])):this.legends[d]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show()};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.interaction=function(a){this.waxGM=new wax.GridManager,this.callbacks={out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click},this.waxGetTileGrid=function(){var a=this.getZoom();return this._waxGetTileGrid||(this._waxGetTileGrid=function(b){var c=[];$.each(b,function(b,d){if(b.split(",")[0]==a){var e=$(d),f=e.offset();c.push([f.top,f.left,e])}});return c}(this.tiles))},$(this.parent).bind("mousedown mouseup mousemove",$.proxy(function(a){var b=!1;if(a.type==="mouseup")b=!1;else if(b||a.type==="mousedown"){b=!0;return}var c=this.waxGetTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.pageY&&c[d][0]+256>a.pageY&&c[d][1]<a.pageX&&c[d][1]+256>a.pageX){var e=c[d][2];break}e&&this.waxGM.getGrid(e.attr("src"),$.proxy(function(b){if(b){var c=b.getFeature(a.pageX,a.pageY,e,{format:"teaser"});c?c&&this.feature!==c?(this.feature=c,this.callbacks.out(c,this.parent,0,a),this.callbacks.over(c,this.parent,0,a)):c||(this.feature=null,this.callbacks.out(c,this.parent,0,a)):(this.feature=null,this.callbacks.out({},this.parent,0,a))}},this))},this));var b=["zoomed","panned","centered","extentset","resized","drawn"];for(var c=0;c<b.length;c++)this.addCallback(b[c],function(a,b){a._waxGetTileGrid=null});return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.legend=function(a){a=a||{},this.legend=new wax.Legend(this.parent,a.container),this.legend.render([this.provider.getTileUrl({zoom:0,column:0,row:0})]);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.zoomer=function(){$('<a class="zoomer zoomin" href="#zoomin">+</a>').click($.proxy(function(){this.zoomIn();return!1},this)).prependTo(this.parent),$('<a class="zoomer zoomout" href="#zoomout">-</a>').click($.proxy(function(){this.zoomOut();return!1},this)).prependTo(this.parent);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.WaxProvider=function(a,b){this.layername=b,this.base_url=a},com.modestmaps.WaxProvider.prototype={key:null,style:null,getTileUrl:function(a){a=this.sourceCoordinate(a);var b=Math.pow(2,a.zoom);a.row=Math.pow(2,a.zoom)-a.row-1;var c=["1.0.0",this.layername,a.zoom,a.column,a.row].join("/");return this.base_url+c+".png"}},com.modestmaps.extend(com.modestmaps.WaxProvider,com.modestmaps.MapProvider)
+ */(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),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 _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.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)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(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)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){if(c.left&&c.top)var e=c.left,f=c.top;else{var g=$(c),e=g.offset().left;f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a){a?this.legends[d]?this.legends[d].show():(this.legends[d]=$("<div class='wax-legend'></div>").append(a),this.container.append(this.legends[d])):this.legends[d]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show()};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.fullscreen=function(){$('<a class="fullscreen" href="#fullscreen">fullscreen</a>').click($.proxy(function(){this.parent.toggleClass("fullscreen");return!1},this)).prependTo(this.parent);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.interaction=function(a){this.waxGM=new wax.GridManager,this.callbacks={out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click},this.waxGetTileGrid=function(){var a=this.getZoom();return this._waxGetTileGrid||(this._waxGetTileGrid=function(b){var c=[];$.each(b,function(b,d){if(b.split(",")[0]==a){var e=$(d),f=e.offset();c.push([f.top,f.left,e])}});return c}(this.tiles))},$(this.parent).nondrag($.proxy(function(a){var b=this.waxGetTileGrid();for(var c=0;c<b.length;c++)if(b[c][0]<a.pageY&&b[c][0]+256>a.pageY&&b[c][1]<a.pageX&&b[c][1]+256>a.pageX){var d=b[c][2];break}d&&this.waxGM.getGrid(d.attr("src"),$.proxy(function(b){if(b){var c=b.getFeature(a.pageX,a.pageY,d,{format:"teaser"});c?c&&this.feature!==c?(this.feature=c,this.callbacks.out(c,this.parent,0,a),this.callbacks.over(c,this.parent,0,a)):c||(this.feature=null,this.callbacks.out(c,this.parent,0,a)):(this.feature=null,this.callbacks.out({},this.parent,0,a))}},this))},this));var b=["zoomed","panned","centered","extentset","resized","drawn"];for(var c=0;c<b.length;c++)this.addCallback(b[c],function(a,b){a._waxGetTileGrid=null});return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.legend=function(a){a=a||{},this.legend=new wax.Legend(this.parent,a.container),this.legend.render([this.provider.getTileUrl({zoom:0,column:0,row:0})]);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.zoomer=function(){$('<a class="zoomer zoomin" href="#zoomin">+</a>').click($.proxy(function(){this.zoomIn();return!1},this)).prependTo(this.parent),$('<a class="zoomer zoomout" href="#zoomout">-</a>').click($.proxy(function(){this.zoomOut();return!1},this)).prependTo(this.parent);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.WaxProvider=function(a,b){this.layername=b,this.base_url=a},com.modestmaps.WaxProvider.prototype={key:null,style:null,getTileUrl:function(a){a=this.sourceCoordinate(a);var b=Math.pow(2,a.zoom);a.row=Math.pow(2,a.zoom)-a.row-1;var c=["1.0.0",this.layername,a.zoom,a.column,a.row].join("/");return this.base_url+c+".png"}},com.modestmaps.extend(com.modestmaps.WaxProvider,com.modestmaps.MapProvider)
View
65 build/wax.ol.js
@@ -1186,6 +1186,29 @@ wax.Record = function(obj, context) {
// Wax header
var wax = wax || {};
+// Nondrag
+// -------
+// A simple abstraction from the `mousemove` handler that doesn't
+// trigger mousemove events while dragging.
+(function($) {
+ $.fn.extend({
+ nondrag: function(callback) {
+ $(this).bind('mousedown mouseup mousemove', function(evt) {
+ var down = false;
+ if (evt.type === 'mouseup') {
+ down = false;
+ } else if (down || evt.type === 'mousedown') {
+ down = true;
+ // Don't trigger the callback if this is a drag.
+ return;
+ }
+ callback(evt);
+ });
+ return this;
+ }
+ });
+})(jQuery);
+
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
@@ -1228,21 +1251,21 @@ wax.request = {
});
}
}
-}
+};
// GridInstance
// ------------
// GridInstances are queryable, fully-formed
// objects for acquiring features from events.
-wax.GridInstance = function (grid_tile, formatter) {
+wax.GridInstance = function(grid_tile, formatter) {
this.grid_tile = grid_tile;
this.formatter = formatter;
this.tileRes = 4;
-}
+};
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
-// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
wax.GridInstance.prototype.resolveCode = function(key) {
(key >= 93) && key--;
@@ -1285,12 +1308,12 @@ wax.GridInstance.prototype.getFeature = function(x, y, tile_element, options) {
// GridManager
// -----------
// Generally one GridManager will be used per map.
-wax.GridManager = function () {
+wax.GridManager = function() {
this.grid_tiles = {};
this.key_maps = {};
this.formatters = {};
this.locks = {};
-}
+};
// Get a grid - calls `callback` with either a `GridInstance`
// object or false. Behind the scenes, this calls `getFormatter`
@@ -1360,7 +1383,7 @@ wax.Formatter = function(obj) {
} else {
this.f = function() {};
}
-}
+};
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
@@ -1426,7 +1449,7 @@ wax.tooltip.getToolTip = function(feature, context, index, evt) {
tooltip = $("<div class='wax-tooltip wax-tooltip-" +
index +
"'>" +
- "</div>").html(feature);
+ '</div>').html(feature);
if (!$(context).triggerHandler('addedtooltip', [tooltip, context, evt])) {
$(context).append(tooltip);
}
@@ -1470,7 +1493,7 @@ wax.tooltip.select = function(feature, context, layer_id, evt) {
// highest layer underneath if found.
wax.tooltip.unselect = function(feature, context, layer_id, evt) {
$(context)
- .css('cursor', 'default')
+ .css('cursor', 'default');
if (layer_id) {
$('div.wax-tooltip-' + layer_id + ':not(.wax-popup)')
.remove();
@@ -1508,7 +1531,7 @@ wax.ol.Embedder =
'z-index': '9999999999',
'position': 'relative'
})
- .val("<div id='" + this.el + "-script'>" + $('#' + this.el + '-script').html() + "</div>"));
+ .val("<div id='" + this.el + "-script'>" + $('#' + this.el + '-script').html() + '</div>'));
}
this.activate();
},
@@ -1535,12 +1558,12 @@ wax.ol.Interaction =
OpenLayers.Control.prototype.initialize.apply(this, [this.options || {}]);
this.callbacks = {
- out: wax.tooltip.unselect,
- over: wax.tooltip.select,
+ out: wax.tooltip.unselect,
+ over: wax.tooltip.select,
click: wax.tooltip.click
};
},
-
+
setMap: function(map) {
$(map.div).bind('mousemove', $.proxy(this.getInfoForHover, this));
this.clickHandler = new OpenLayers.Handler.Click(
@@ -1553,10 +1576,10 @@ wax.ol.Interaction =
this.clickHandler.activate();
map.events.on({
- "addlayer": this.resetLayers,
- "changelayer": this.resetLayers,
- "removelayer": this.resetLayers,
- "changebaselayer": this.resetLayers,
+ 'addlayer': this.resetLayers,
+ 'changelayer': this.resetLayers,
+ 'removelayer': this.resetLayers,
+ 'changebaselayer': this.resetLayers,
scope: this
});
@@ -1705,10 +1728,10 @@ wax.ol.Legend = OpenLayers.Class(OpenLayers.Control, {
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,
+ 'addlayer': this.setLegend,
+ 'changelayer': this.setLegend,
+ 'removelayer': this.setLegend,
+ 'changebaselayer': this.setLegend,
scope: this
});
},
View
2  build/wax.ol.min.js
@@ -7,4 +7,4 @@
*
* This document is licensed as free software under the terms of the
* MIT License: http://www.opensource.org/licenses/mit-license.php
- */(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),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 _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.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)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(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)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){if(c.left&&c.top)var e=c.left,f=c.top;else{var g=$(c),e=g.offset().left;f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a){a?this.legends[d]?this.legends[d].show():(this.legends[d]=$("<div class='wax-legend'></div>").append(a),this.container.append(this.legends[d])):this.legends[d]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show()};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||{},wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a){this.options=a||{},this.clickAction=this.options.clickAction||"full",OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks={out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click}},setMap:function(a){$(a.div).bind("mousemove",$.proxy(this.getInfoForHover,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){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++){var g=$(a[d].grid[e][f].imgDiv).offset();if(g&&g.top<b.pageY&&g.top+256>b.pageY&&g.left<b.pageX&&g.left+256>b.pageX){c.push(a[d].grid[e][f]);continue layerfound}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;return this._viableLayers=$(this.map.layers).filter(function(a){return this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"})},resetLayers:function(){this._viableLayers=null,this.callbacks.out()},getInfoForClick:function(a){var b=this.viableLayers(),c=this.getTileStack(this.viableLayers(),a),d=null,e=null,f=this;for(var g=0;g<c.length;g++)this.gm.getGrid(c[g].url,function(b){if(!!b){var d=b.getFeature(a.pageX,a.pageY,c[g].imgDiv,{format:f.clickAction});if(d)switch(f.clickAction){case"full":f.callbacks.click(d,c[g].layer.map.viewPortDiv,g);break;case"location":window.location=d}}})},getInfoForHover:function(a){var b={format:"teaser"},c=this.viableLayers(),d=this.getTileStack(this.viableLayers(),a),e=null,f=null,g=this;for(var h=0;h<d.length;h++)this.gm.getGrid(d[h].url,function(c){if(c&&d[h]){var e=c.getFeature(a.pageX,a.pageY,d[h].imgDiv,b);if(e){if(!d[h])return;e&&g.feature[h]!==e?(g.feature[h]=e,g.callbacks.out(e,d[h].layer.map.div,h,a),g.callbacks.over(e,d[h].layer.map.div,h,a)):e||(g.feature[h]=null,g.callbacks.out(e,d[h].layer.map.div,h,a))}else g.feature[h]=null,d[h]?g.callbacks.out({},d[h].layer.map.div,h,a):g.callbacks.out({},!1,h)}})},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||{}])},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)}}},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()}})
+ */(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),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 _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.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)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(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)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){if(c.left&&c.top)var e=c.left,f=c.top;else{var g=$(c),e=g.offset().left;f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a){a?this.legends[d]?this.legends[d].show():(this.legends[d]=$("<div class='wax-legend'></div>").append(a),this.container.append(this.legends[d])):this.legends[d]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show()};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||{},wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a){this.options=a||{},this.clickAction=this.options.clickAction||"full",OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks={out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click}},setMap:function(a){$(a.div).bind("mousemove",$.proxy(this.getInfoForHover,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){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++){var g=$(a[d].grid[e][f].imgDiv).offset();if(g&&g.top<b.pageY&&g.top+256>b.pageY&&g.left<b.pageX&&g.left+256>b.pageX){c.push(a[d].grid[e][f]);continue layerfound}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;return this._viableLayers=$(this.map.layers).filter(function(a){return this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"})},resetLayers:function(){this._viableLayers=null,this.callbacks.out()},getInfoForClick:function(a){var b=this.viableLayers(),c=this.getTileStack(this.viableLayers(),a),d=null,e=null,f=this;for(var g=0;g<c.length;g++)this.gm.getGrid(c[g].url,function(b){if(!!b){var d=b.getFeature(a.pageX,a.pageY,c[g].imgDiv,{format:f.clickAction});if(d)switch(f.clickAction){case"full":f.callbacks.click(d,c[g].layer.map.viewPortDiv,g);break;case"location":window.location=d}}})},getInfoForHover:function(a){var b={format:"teaser"},c=this.viableLayers(),d=this.getTileStack(this.viableLayers(),a),e=null,f=null,g=this;for(var h=0;h<d.length;h++)this.gm.getGrid(d[h].url,function(c){if(c&&d[h]){var e=c.getFeature(a.pageX,a.pageY,d[h].imgDiv,b);if(e){if(!d[h])return;e&&g.feature[h]!==e?(g.feature[h]=e,g.callbacks.out(e,d[h].layer.map.div,h,a),g.callbacks.over(e,d[h].layer.map.div,h,a)):e||(g.feature[h]=null,g.callbacks.out(e,d[h].layer.map.div,h,a))}else g.feature[h]=null,d[h]?g.callbacks.out({},d[h].layer.map.div,h,a):g.callbacks.out({},!1,h)}})},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||{}])},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)}}},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()}})
View
2  control/g/interaction.js
@@ -125,6 +125,6 @@ wax.g.Controls.prototype.Embedder = function(script_id) {
'z-index': '9999999999',
'position': 'relative'
})
- .val("<div id='" + script_id + "'>" + $('#' + script_id).html() + "</div>"));
+ .val("<div id='" + script_id + "'>" + $('#' + script_id).html() + '</div>'));
return this;
};
View
37 control/lib/gridutil.js
@@ -4,6 +4,29 @@
// Wax header
var wax = wax || {};
+// Nondrag
+// -------
+// A simple abstraction from the `mousemove` handler that doesn't
+// trigger mousemove events while dragging.
+(function($) {
+ $.fn.extend({
+ nondrag: function(callback) {
+ $(this).bind('mousedown mouseup mousemove', function(evt) {
+ var down = false;
+ if (evt.type === 'mouseup') {
+ down = false;
+ } else if (down || evt.type === 'mousedown') {
+ down = true;
+ // Don't trigger the callback if this is a drag.
+ return;
+ }
+ callback(evt);
+ });
+ return this;
+ }
+ });
+})(jQuery);
+
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
@@ -46,21 +69,21 @@ wax.request = {
});
}
}
-}
+};
// GridInstance
// ------------
// GridInstances are queryable, fully-formed
// objects for acquiring features from events.
-wax.GridInstance = function (grid_tile, formatter) {
+wax.GridInstance = function(grid_tile, formatter) {
this.grid_tile = grid_tile;
this.formatter = formatter;
this.tileRes = 4;
-}
+};
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
-// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
wax.GridInstance.prototype.resolveCode = function(key) {
(key >= 93) && key--;
@@ -103,12 +126,12 @@ wax.GridInstance.prototype.getFeature = function(x, y, tile_element, options) {
// GridManager
// -----------
// Generally one GridManager will be used per map.
-wax.GridManager = function () {
+wax.GridManager = function() {
this.grid_tiles = {};
this.key_maps = {};
this.formatters = {};
this.locks = {};
-}
+};
// Get a grid - calls `callback` with either a `GridInstance`
// object or false. Behind the scenes, this calls `getFormatter`
@@ -178,7 +201,7 @@ wax.Formatter = function(obj) {
} else {
this.f = function() {};
}
-}
+};
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
View
4 control/lib/tooltip.js
@@ -15,7 +15,7 @@ wax.tooltip.getToolTip = function(feature, context, index, evt) {
tooltip = $("<div class='wax-tooltip wax-tooltip-" +
index +
"'>" +
- "</div>").html(feature);
+ '</div>').html(feature);
if (!$(context).triggerHandler('addedtooltip', [tooltip, context, evt])) {
$(context).append(tooltip);
}
@@ -59,7 +59,7 @@ wax.tooltip.select = function(feature, context, layer_id, evt) {
// highest layer underneath if found.
wax.tooltip.unselect = function(feature, context, layer_id, evt) {
$(context)
- .css('cursor', 'default')
+ .css('cursor', 'default');
if (layer_id) {
$('div.wax-tooltip-' + layer_id + ':not(.wax-popup)')
.remove();
View
23 control/mm/fullscreen.js
@@ -0,0 +1,23 @@
+// Wax: Fullscreen
+// -----------------
+
+// namespacing!
+if (!com) {
+ var com = { };
+ if (!com.modestmaps) {
+ com.modestmaps = { };
+ }
+}
+
+// Add zoom links, which can be styled as buttons, to a `modestmaps.Map`
+// control. This function can be used chaining-style with other
+// chaining-style controls.
+com.modestmaps.Map.prototype.fullscreen = function() {
+ $('<a class="fullscreen" href="#fullscreen">fullscreen</a>')
+ .click($.proxy(function() {
+ this.parent.toggleClass('fullscreen');
+ return false;
+ }, this))
+ .prependTo(this.parent);
+ return this;
+};
View
11 control/mm/interaction.js
@@ -37,16 +37,7 @@ com.modestmaps.Map.prototype.interaction = function(options) {
})(this.tiles));
};
- // TODO: don't track on drag
- $(this.parent).bind('mousedown mouseup mousemove', $.proxy(function(evt) {
- var down = false;
- if (evt.type === 'mouseup') {
- down = false;
- } else if (down || evt.type === 'mousedown') {
- down = true;
- return;
- }
-
+ $(this.parent).nondrag($.proxy(function(evt) {
var grid = this.waxGetTileGrid();
for (var i = 0; i < grid.length; i++) {
if ((grid[i][0] < evt.pageY) &&
View
2  control/mm/legend.js
@@ -1,7 +1,7 @@
// Wax: Legend Control
// -------------------
// Requires:
-//
+//
// * modestmaps
// * wax.Legend
View
2  control/ol/embedder.js
@@ -20,7 +20,7 @@ wax.ol.Embedder =
'z-index': '9999999999',
'position': 'relative'
})
- .val("<div id='" + this.el + "-script'>" + $('#' + this.el + '-script').html() + "</div>"));
+ .val("<div id='" + this.el + "-script'>" + $('#' + this.el + '-script').html() + '</div>'));
}
this.activate();
},
View
14 control/ol/interaction.js
@@ -18,12 +18,12 @@ wax.ol.Interaction =
OpenLayers.Control.prototype.initialize.apply(this, [this.options || {}]);
this.callbacks = {
- out: wax.tooltip.unselect,
- over: wax.tooltip.select,
+ out: wax.tooltip.unselect,
+ over: wax.tooltip.select,
click: wax.tooltip.click
};
},
-
+
setMap: function(map) {
$(map.div).bind('mousemove', $.proxy(this.getInfoForHover, this));
this.clickHandler = new OpenLayers.Handler.Click(
@@ -36,10 +36,10 @@ wax.ol.Interaction =
this.clickHandler.activate();
map.events.on({
- "addlayer": this.resetLayers,
- "changelayer": this.resetLayers,
- "removelayer": this.resetLayers,
- "changebaselayer": this.resetLayers,
+ 'addlayer': this.resetLayers,
+ 'changelayer': this.resetLayers,
+ 'removelayer': this.resetLayers,
+ 'changebaselayer': this.resetLayers,
scope: this
});
View
8 control/ol/legend.js
@@ -24,10 +24,10 @@ wax.ol.Legend = OpenLayers.Class(OpenLayers.Control, {
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,
+ 'addlayer': this.setLegend,
+ 'changelayer': this.setLegend,
+ 'removelayer': this.setLegend,
+ 'changebaselayer': this.setLegend,
scope: this
});
},
Please sign in to comment.
Something went wrong with that request. Please try again.