Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing nitpicky bugs, updating builds

  • Loading branch information...
commit e508cf27f9f87e14e2b498199230d94f46a6a566 1 parent 792337b
Tom MacWright authored
View
11 build/wax.mm.js
@@ -1542,11 +1542,9 @@ com.modestmaps.Map.prototype.boxselector = function(opts) {
var mouseDownPoint = null;
var map = this;
- if (typeof opts === 'function') {
- var callback = opts;
- } else {
- var callback = opts.callback;
- }
+ var callback = (typeof opts === 'function') ?
+ opts :
+ opts.callback;
var boxselector = this.boxselector;
this.boxselector.getMousePoint = function(e) {
@@ -1646,8 +1644,7 @@ com.modestmaps.Map.prototype.boxselector = function(opts) {
this.boxselector.remove = function() {
boxDiv.parentNode.removeChild(boxDiv);
map.removeCallback('mousedown', drawbox);
- delete box;
- }
+ };
return this;
};
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||{};(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){var e,f;if(c.left&&c.top)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,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("<div class='wax-legend'></div>").append(b),this.container.append(this.legends[a])):this.legends[a]=!1},this),c=function(a){a&&a.legend&&b(e,a.legend)};for(var d=0;d<a.length;d++){var e=this.legendUrl(a[d]);wax.request.get(e,c)}},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(),$(b).triggerHandler("removedtooltip",[a,b,d])};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.boxselector=function(a){var b=document.createElement("div");b.id=this.parent.id+"-boxselector",b.className="boxselector-box-container",b.style.width=this.dimensions.x+"px",b.style.height=this.dimensions.y+"px",this.parent.appendChild(b);var c=document.createElement("div");c.id=this.parent.id+"-boxselector-box",c.className="boxselector-box",b.appendChild(c);var d=null,e=this;if(typeof a=="function")var f=a;else var f=a.callback;var g=this.boxselector;this.boxselector.getMousePoint=function(a){var b=new com.modestmaps.Point(a.clientX,a.clientY);b.x+=document.body.scrollLeft+document.documentElement.scrollLeft,b.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var c=e.parent;c;c=c.offsetParent)b.x-=c.offsetLeft,b.y-=c.offsetTop;return b},this.boxselector.mouseDown=function(a){if(a.shiftKey){d=g.getMousePoint(a),c.style.left=d.x+"px",c.style.top=d.y+"px",c.style.height="auto",c.style.width="auto",com.modestmaps.addEvent(e.parent,"mousemove",g.mouseMove),com.modestmaps.addEvent(e.parent,"mouseup",g.mouseUp),e.parent.style.cursor="crosshair";return com.modestmaps.cancelEvent(a)}},this.boxselector.mouseMove=function(a){var b=g.getMousePoint(a);c.style.display="block",b.x<d.x?(c.style.left=b.x+"px",c.style.right=e.dimensions.x-d.x+"px"):(c.style.left=d.x+"px",c.style.right=e.dimensions.x-b.x+"px"),b.y<d.y?c.style.top=b.y+"px":c.style.bottom=e.dimensions.y-b.y+"px";return com.modestmaps.cancelEvent(a)},this.boxselector.mouseUp=function(a){var b=g.getMousePoint(a),c=e.pointLocation(b),h=e.pointLocation(d),i=[];i.push(new com.modestmaps.Location(Math.max(c.lat,h.lat),Math.min(c.lon,h.lon))),i.push(new com.modestmaps.Location(Math.min(c.lat,h.lat),Math.max(c.lon,h.lon))),g.box=[c,h],f(i),com.modestmaps.removeEvent(e.parent,"mousemove",g.mouseMove),com.modestmaps.removeEvent(e.parent,"mouseup",g.mouseUp),e.parent.style.cursor="auto";return com.modestmaps.cancelEvent(a)},com.modestmaps.addEvent(b,"mousedown",g.mouseDown);var h=function(a,b){if(a.boxselector.box){c.style.display="block",c.style.height="auto",c.style.width="auto";var d=a.locationPoint(a.boxselector.box[0]),e=a.locationPoint(a.boxselector.box[1]);c.style.left=Math.max(0,e.x)+"px",c.style.top=Math.max(0,e.y)+"px",c.style.right=Math.max(0,a.dimensions.x-d.x)+"px",c.style.bottom=Math.max(0,a.dimensions.y-d.y)+"px"}};this.addCallback("drawn",h),this.boxselector.remove=function(){b.parentNode.removeChild(b),e.removeCallback("mousedown",h),delete c};return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.embedder=function(a){a=a||{},$("#"+this.el+"-script").length&&$(this.parent).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"));return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.fullscreen=function(){$('<a class="wax-fullscreen" href="#fullscreen">fullscreen</a>').toggle($.proxy(this.maximize,this),$.proxy(this.minimize,this)).appendTo(this.parent);return this},com.modestmaps.Map.prototype.maximize=function(a){a&&a.preventDefault(),this.smallSize=[$(this.parent).width(),$(this.parent).height()],$(this.parent).addClass("wax-fullscreen-map"),this.setSize($(this.parent).outerWidth(),$(this.parent).outerHeight())},com.modestmaps.Map.prototype.minimize=function(a){a&&a.preventDefault(),$(this.parent).removeClass("wax-fullscreen-map"),this.setSize(this.smallSize[0],this.smallSize[1])};if(!com){var com={};com.modestmaps||(com.modestmaps={})}var limit=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)}},throttle=function(a,b){return limit(a,b,!1)};com.modestmaps.Map.prototype.hash=function(a){var b,c=90-1e-8,d,e={map:this,parser:function(a){var b=a.split("/").map(Number);if(b.length<3||b.some(isNaN))return!0;b.length==3&&this.map.setCenterZoom(new com.modestmaps.Location(b[1],b[2]),b[0])},formatter:function(){var a=this.map.getCenter(),b=this.map.getZoom(),c=Math.max(0,Math.ceil(Math.log(b)/Math.LN2));return"#"+[b.toFixed(2),a.lat.toFixed(c),a.lon.toFixed(c)].join("/")},move:function(){var a=e.formatter();b!==a&&location.replace(b=a)},hashchange:function(){location.hash!==b&&e.parser((b=location.hash).substring(1))&&move()}};location.hash?e.hashchange():e.move(),this.addCallback("drawn",throttle(e.move,500)),window.addEventListener("hashchange",e.hashchange,!1);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.interaction=function(a){a=a||{},this.waxGM=new wax.GridManager,this.callbacks=a.callbacks||{out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click},this.clickAction=a.clickAction||"full",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.waxClearTimeout=function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},$(this.parent).mousedown($.proxy(function(a){if(!this.waxClearTimeout()){var b=4;this.downEvent=a,$(this.parent).one("mouseup",$.proxy(function(a){Math.round(a.pageY/b)===Math.round(this.downEvent.pageY/b)&&Math.round(a.pageX/b)===Math.round(this.downEvent.pageX/b)&&(this.clickTimeout=window.setTimeout($.proxy(function(){this.waxHandleClick(a)},this),300))},this))}},this)),this.waxHandleClick=function(a){var b=this.waxGetTile(a);b&&this.waxGM.getGrid(b.attr("src"),$.proxy(function(c){if(c){var d=c.getFeature(a.pageX,a.pageY,b,{format:this.clickAction});if(d)switch(this.clickAction){case"full":this.callbacks.click(d,this.parent,0,a);break;case"location":window.location=d}}},this))},this.waxGetTile=function(a){var b,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){b=c[d][2];break}return b||!1},$(this.parent).nondrag($.proxy(function(a){var b=this.waxGetTile(a);b&&this.waxGM.getGrid(b.attr("src"),$.proxy(function(c){if(c){var d=c.getFeature(a.pageX,a.pageY,b,{format:"teaser"});d?d&&this.feature!==d?(this.feature=d,this.callbacks.out(d,this.parent,0,a),this.callbacks.over(d,this.parent,0,a)):d||(this.feature=null,this.callbacks.out(d,this.parent,0,a)):(this.feature=null,this.callbacks.out({},this.parent,0,a))}},this))},this));var b=["zoomed","panned","centered","extentset","resized","drawn"],c=function(a,b){a._waxGetTileGrid=null};for(var d=0;d<b.length;d++)this.addCallback(b[d],c);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.zoombox=function(a){var b=document.createElement("div");b.id=this.parent.id+"-zoombox",b.className="zoombox-box-container",b.style.width=this.dimensions.x+"px",b.style.height=this.dimensions.y+"px",this.parent.appendChild(b);var c=document.createElement("div");c.id=this.parent.id+"-zoombox-box",c.className="zoombox-box",b.appendChild(c);var d=null,e=this,f={map:this,getMousePoint:function(a){var b=new com.modestmaps.Point(a.clientX,a.clientY);b.x+=document.body.scrollLeft+document.documentElement.scrollLeft,b.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var c=this.map.parent;c;c=c.offsetParent)b.x-=c.offsetLeft,b.y-=c.offsetTop;return b},mouseDown:function(a){if(a.shiftKey){d=f.getMousePoint(a),c.style.left=d.x+"px",c.style.top=d.y+"px",com.modestmaps.addEvent(e.parent,"mousemove",f.mouseMove),com.modestmaps.addEvent(e.parent,"mouseup",f.mouseUp),e.parent.style.cursor="crosshair";return com.modestmaps.cancelEvent(a)}},mouseMove:function(a){var b=f.getMousePoint(a);c.style.display="block",b.x<d.x?c.style.left=b.x+"px":c.style.left=d.x+"px",c.style.width=Math.abs(b.x-d.x)+"px",b.y<d.y?c.style.top=b.y+"px":c.style.top=d.y+"px",c.style.height=Math.abs(b.y-d.y)+"px";return com.modestmaps.cancelEvent(a)},mouseUp:function(a){var b=f.getMousePoint(a),g=e.pointLocation(b),h=e.pointLocation(d);e.setExtent([g,h]),c.style.display="none",com.modestmaps.removeEvent(e.parent,"mousemove",f.mouseMove),com.modestmaps.removeEvent(e.parent,"mouseup",f.mouseUp),e.parent.style.cursor="auto";return com.modestmaps.cancelEvent(a)}};com.modestmaps.addEvent(b,"mousedown",f.mouseDown);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.zoomer=function(){var a=$('<a class="zoomer zoomin" href="#zoomin">+</a>').click($.proxy(function(a){a.preventDefault(),this.zoomIn()},this)).appendTo(this.parent),b=$('<a class="zoomer zoomout" href="#zoomout">-</a>').click($.proxy(function(a){a.preventDefault(),this.zoomOut()},this)).appendTo(this.parent);this.addCallback("drawn",function(c,d){c.coordinate.zoom===c.provider.outerLimits()[0].zoom?b.addClass("zoomdisabled"):c.coordinate.zoom===c.provider.outerLimits()[1].zoom?a.addClass("zoomdisabled"):(a.removeClass("zoomdisabled"),b.removeClass("zoomdisabled"))});return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.WaxProvider=function(a){this.layerName=a.layerName,this.baseUrls=typeof a.baseUrl=="string"?[a.baseUrl]:a.baseUrl,this.n_urls=this.baseUrls.length,this.filetype=a.filetype||".png",this.zoomRange=a.zoomRange||[0,18]},com.modestmaps.WaxProvider.prototype={outerLimits:function(){return[(new com.modestmaps.Coordinate(0,0,0)).zoomTo(this.zoomRange[0]),(new com.modestmaps.Coordinate(1,1,0)).zoomTo(this.zoomRange[1])]},getTileUrl:function(a){var b;a=this.sourceCoordinate(a);if(!a)return null;var c=Math.pow(2,a.zoom);a.row=Math.pow(2,a.zoom)-a.row-1,this.n_urls===1?b=this.baseUrls[0]:b=this.baseUrls[parseInt(c*a.row+a.column,10)%this.n_urls];var d=["1.0.0",this.layerName,a.zoom,a.column,a.row].join("/");return b+d+this.filetype}},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){var e,f;if(c.left&&c.top)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,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("<div class='wax-legend'></div>").append(b),this.container.append(this.legends[a])):this.legends[a]=!1},this),c=function(a){a&&a.legend&&b(e,a.legend)};for(var d=0;d<a.length;d++){var e=this.legendUrl(a[d]);wax.request.get(e,c)}},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(),$(b).triggerHandler("removedtooltip",[a,b,d])};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.boxselector=function(a){var b=document.createElement("div");b.id=this.parent.id+"-boxselector",b.className="boxselector-box-container",b.style.width=this.dimensions.x+"px",b.style.height=this.dimensions.y+"px",this.parent.appendChild(b);var c=document.createElement("div");c.id=this.parent.id+"-boxselector-box",c.className="boxselector-box",b.appendChild(c);var d=null,e=this,f=typeof a=="function"?a:a.callback,g=this.boxselector;this.boxselector.getMousePoint=function(a){var b=new com.modestmaps.Point(a.clientX,a.clientY);b.x+=document.body.scrollLeft+document.documentElement.scrollLeft,b.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var c=e.parent;c;c=c.offsetParent)b.x-=c.offsetLeft,b.y-=c.offsetTop;return b},this.boxselector.mouseDown=function(a){if(a.shiftKey){d=g.getMousePoint(a),c.style.left=d.x+"px",c.style.top=d.y+"px",c.style.height="auto",c.style.width="auto",com.modestmaps.addEvent(e.parent,"mousemove",g.mouseMove),com.modestmaps.addEvent(e.parent,"mouseup",g.mouseUp),e.parent.style.cursor="crosshair";return com.modestmaps.cancelEvent(a)}},this.boxselector.mouseMove=function(a){var b=g.getMousePoint(a);c.style.display="block",b.x<d.x?(c.style.left=b.x+"px",c.style.right=e.dimensions.x-d.x+"px"):(c.style.left=d.x+"px",c.style.right=e.dimensions.x-b.x+"px"),b.y<d.y?c.style.top=b.y+"px":c.style.bottom=e.dimensions.y-b.y+"px";return com.modestmaps.cancelEvent(a)},this.boxselector.mouseUp=function(a){var b=g.getMousePoint(a),c=e.pointLocation(b),h=e.pointLocation(d),i=[];i.push(new com.modestmaps.Location(Math.max(c.lat,h.lat),Math.min(c.lon,h.lon))),i.push(new com.modestmaps.Location(Math.min(c.lat,h.lat),Math.max(c.lon,h.lon))),g.box=[c,h],f(i),com.modestmaps.removeEvent(e.parent,"mousemove",g.mouseMove),com.modestmaps.removeEvent(e.parent,"mouseup",g.mouseUp),e.parent.style.cursor="auto";return com.modestmaps.cancelEvent(a)},com.modestmaps.addEvent(b,"mousedown",g.mouseDown);var h=function(a,b){if(a.boxselector.box){c.style.display="block",c.style.height="auto",c.style.width="auto";var d=a.locationPoint(a.boxselector.box[0]),e=a.locationPoint(a.boxselector.box[1]);c.style.left=Math.max(0,e.x)+"px",c.style.top=Math.max(0,e.y)+"px",c.style.right=Math.max(0,a.dimensions.x-d.x)+"px",c.style.bottom=Math.max(0,a.dimensions.y-d.y)+"px"}};this.addCallback("drawn",h),this.boxselector.remove=function(){b.parentNode.removeChild(b),e.removeCallback("mousedown",h)};return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.embedder=function(a){a=a||{},$("#"+this.el+"-script").length&&$(this.parent).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"));return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.fullscreen=function(){$('<a class="wax-fullscreen" href="#fullscreen">fullscreen</a>').toggle($.proxy(this.maximize,this),$.proxy(this.minimize,this)).appendTo(this.parent);return this},com.modestmaps.Map.prototype.maximize=function(a){a&&a.preventDefault(),this.smallSize=[$(this.parent).width(),$(this.parent).height()],$(this.parent).addClass("wax-fullscreen-map"),this.setSize($(this.parent).outerWidth(),$(this.parent).outerHeight())},com.modestmaps.Map.prototype.minimize=function(a){a&&a.preventDefault(),$(this.parent).removeClass("wax-fullscreen-map"),this.setSize(this.smallSize[0],this.smallSize[1])};if(!com){var com={};com.modestmaps||(com.modestmaps={})}var limit=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)}},throttle=function(a,b){return limit(a,b,!1)};com.modestmaps.Map.prototype.hash=function(a){var b,c=90-1e-8,d,e={map:this,parser:function(a){var b=a.split("/").map(Number);if(b.length<3||b.some(isNaN))return!0;b.length==3&&this.map.setCenterZoom(new com.modestmaps.Location(b[1],b[2]),b[0])},formatter:function(){var a=this.map.getCenter(),b=this.map.getZoom(),c=Math.max(0,Math.ceil(Math.log(b)/Math.LN2));return"#"+[b.toFixed(2),a.lat.toFixed(c),a.lon.toFixed(c)].join("/")},move:function(){var a=e.formatter();b!==a&&location.replace(b=a)},hashchange:function(){location.hash!==b&&e.parser((b=location.hash).substring(1))&&move()}};location.hash?e.hashchange():e.move(),this.addCallback("drawn",throttle(e.move,500)),window.addEventListener("hashchange",e.hashchange,!1);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.interaction=function(a){a=a||{},this.waxGM=new wax.GridManager,this.callbacks=a.callbacks||{out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click},this.clickAction=a.clickAction||"full",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.waxClearTimeout=function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},$(this.parent).mousedown($.proxy(function(a){if(!this.waxClearTimeout()){var b=4;this.downEvent=a,$(this.parent).one("mouseup",$.proxy(function(a){Math.round(a.pageY/b)===Math.round(this.downEvent.pageY/b)&&Math.round(a.pageX/b)===Math.round(this.downEvent.pageX/b)&&(this.clickTimeout=window.setTimeout($.proxy(function(){this.waxHandleClick(a)},this),300))},this))}},this)),this.waxHandleClick=function(a){var b=this.waxGetTile(a);b&&this.waxGM.getGrid(b.attr("src"),$.proxy(function(c){if(c){var d=c.getFeature(a.pageX,a.pageY,b,{format:this.clickAction});if(d)switch(this.clickAction){case"full":this.callbacks.click(d,this.parent,0,a);break;case"location":window.location=d}}},this))},this.waxGetTile=function(a){var b,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){b=c[d][2];break}return b||!1},$(this.parent).nondrag($.proxy(function(a){var b=this.waxGetTile(a);b&&this.waxGM.getGrid(b.attr("src"),$.proxy(function(c){if(c){var d=c.getFeature(a.pageX,a.pageY,b,{format:"teaser"});d?d&&this.feature!==d?(this.feature=d,this.callbacks.out(d,this.parent,0,a),this.callbacks.over(d,this.parent,0,a)):d||(this.feature=null,this.callbacks.out(d,this.parent,0,a)):(this.feature=null,this.callbacks.out({},this.parent,0,a))}},this))},this));var b=["zoomed","panned","centered","extentset","resized","drawn"],c=function(a,b){a._waxGetTileGrid=null};for(var d=0;d<b.length;d++)this.addCallback(b[d],c);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.zoombox=function(a){var b=document.createElement("div");b.id=this.parent.id+"-zoombox",b.className="zoombox-box-container",b.style.width=this.dimensions.x+"px",b.style.height=this.dimensions.y+"px",this.parent.appendChild(b);var c=document.createElement("div");c.id=this.parent.id+"-zoombox-box",c.className="zoombox-box",b.appendChild(c);var d=null,e=this,f={map:this,getMousePoint:function(a){var b=new com.modestmaps.Point(a.clientX,a.clientY);b.x+=document.body.scrollLeft+document.documentElement.scrollLeft,b.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var c=this.map.parent;c;c=c.offsetParent)b.x-=c.offsetLeft,b.y-=c.offsetTop;return b},mouseDown:function(a){if(a.shiftKey){d=f.getMousePoint(a),c.style.left=d.x+"px",c.style.top=d.y+"px",com.modestmaps.addEvent(e.parent,"mousemove",f.mouseMove),com.modestmaps.addEvent(e.parent,"mouseup",f.mouseUp),e.parent.style.cursor="crosshair";return com.modestmaps.cancelEvent(a)}},mouseMove:function(a){var b=f.getMousePoint(a);c.style.display="block",b.x<d.x?c.style.left=b.x+"px":c.style.left=d.x+"px",c.style.width=Math.abs(b.x-d.x)+"px",b.y<d.y?c.style.top=b.y+"px":c.style.top=d.y+"px",c.style.height=Math.abs(b.y-d.y)+"px";return com.modestmaps.cancelEvent(a)},mouseUp:function(a){var b=f.getMousePoint(a),g=e.pointLocation(b),h=e.pointLocation(d);e.setExtent([g,h]),c.style.display="none",com.modestmaps.removeEvent(e.parent,"mousemove",f.mouseMove),com.modestmaps.removeEvent(e.parent,"mouseup",f.mouseUp),e.parent.style.cursor="auto";return com.modestmaps.cancelEvent(a)}};com.modestmaps.addEvent(b,"mousedown",f.mouseDown);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.zoomer=function(){var a=$('<a class="zoomer zoomin" href="#zoomin">+</a>').click($.proxy(function(a){a.preventDefault(),this.zoomIn()},this)).appendTo(this.parent),b=$('<a class="zoomer zoomout" href="#zoomout">-</a>').click($.proxy(function(a){a.preventDefault(),this.zoomOut()},this)).appendTo(this.parent);this.addCallback("drawn",function(c,d){c.coordinate.zoom===c.provider.outerLimits()[0].zoom?b.addClass("zoomdisabled"):c.coordinate.zoom===c.provider.outerLimits()[1].zoom?a.addClass("zoomdisabled"):(a.removeClass("zoomdisabled"),b.removeClass("zoomdisabled"))});return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.WaxProvider=function(a){this.layerName=a.layerName,this.baseUrls=typeof a.baseUrl=="string"?[a.baseUrl]:a.baseUrl,this.n_urls=this.baseUrls.length,this.filetype=a.filetype||".png",this.zoomRange=a.zoomRange||[0,18]},com.modestmaps.WaxProvider.prototype={outerLimits:function(){return[(new com.modestmaps.Coordinate(0,0,0)).zoomTo(this.zoomRange[0]),(new com.modestmaps.Coordinate(1,1,0)).zoomTo(this.zoomRange[1])]},getTileUrl:function(a){var b;a=this.sourceCoordinate(a);if(!a)return null;var c=Math.pow(2,a.zoom);a.row=Math.pow(2,a.zoom)-a.row-1,this.n_urls===1?b=this.baseUrls[0]:b=this.baseUrls[parseInt(c*a.row+a.column,10)%this.n_urls];var d=["1.0.0",this.layerName,a.zoom,a.column,a.row].join("/");return b+d+this.filetype}},com.modestmaps.extend(com.modestmaps.WaxProvider,com.modestmaps.MapProvider)
View
11 control/mm/boxselector.js
@@ -26,11 +26,9 @@ com.modestmaps.Map.prototype.boxselector = function(opts) {
var mouseDownPoint = null;
var map = this;
- if (typeof opts === 'function') {
- var callback = opts;
- } else {
- var callback = opts.callback;
- }
+ var callback = (typeof opts === 'function') ?
+ opts :
+ opts.callback;
var boxselector = this.boxselector;
this.boxselector.getMousePoint = function(e) {
@@ -130,8 +128,7 @@ com.modestmaps.Map.prototype.boxselector = function(opts) {
this.boxselector.remove = function() {
boxDiv.parentNode.removeChild(boxDiv);
map.removeCallback('mousedown', drawbox);
- delete box;
- }
+ };
return this;
};
Please sign in to comment.
Something went wrong with that request. Please try again.