From 2931010e35d99f66dc452d042133e88c9a5800d2 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 23 May 2011 18:28:53 -0400 Subject: [PATCH] Of course. --- build/wax.mm.js | 2 +- build/wax.mm.min.js | 2 +- control/mm/fullscreen.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/wax.mm.js b/build/wax.mm.js index 80aae595..0ac4666f 100644 --- a/build/wax.mm.js +++ b/build/wax.mm.js @@ -757,7 +757,7 @@ wax.fullscreen = function(map, opts) { click: function(map) { return this._click = this._click || wax.util.bind(function(e) { - if (e) e.preventDefault(); + if (e) com.modestmaps.cancelEvent(e); if (this.state) { this.smallSize = [map.parent.offsetWidth, map.parent.offsetHeight]; diff --git a/build/wax.mm.min.js b/build/wax.mm.min.js index 1c179eda..e30f938c 100644 --- a/build/wax.mm.min.js +++ b/build/wax.mm.min.js @@ -3,4 +3,4 @@ * copyright Dustin Diaz 2011 * https://github.com/ded/reqwest * license MIT - */!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.substr(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script"),f=getCallbackName(a);window[f]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0,e.onload=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)},head.insertBefore(e,topScript)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",topScript=doc[byTag]("script")[0],head=topScript.parentNode,xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else for(;;){if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(d=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=wax.util.offset(c),f=e.left,g=e.top;if(Math.floor((b-g)/this.tileRes)>256||Math.floor((a-f)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-g)/this.tileRes)].charCodeAt(Math.floor((a-f)/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||$('
')[0],this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=wax.util.bind(function(a,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("
").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').css({"z-index":"9999999999",position:"relative"}).val("
"+$("#"+this.el+"-script").html()+"
"));return this},wax=wax||{},wax.fullscreen=function(a,b){var c={state:1,add:function(a){this.a=document.createElement("a"),this.a.className="wax-fullscreen",this.a.href="#fullscreen",this.a.innerHTML="fullscreen",a.parent.appendChild(this.a),com.modestmaps.addEvent(this.a,"click",this.click(a));return this},click:function(a){return this._click=this._click||wax.util.bind(function(b){b&&b.preventDefault(),this.state?(this.smallSize=[a.parent.offsetWidth,a.parent.offsetHeight],a.parent.className+=" wax-fullscreen-map",a.setSize(a.parent.offsetWidth,a.parent.offsetHeight)):(a.parent.className=a.parent.className.replace("wax-fullscreen-map",""),a.setSize(this.smallSize[0],this.smallSize[1])),this.state=!this.state},this)}};return c.add(a)},wax=wax||{};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)},locationHash={stateChange:function(a){com.modestmaps.addEvent(window,"hashchange",function(){a(location.hash)},!1)},getState:function(){return location.hash},pushState:function(a){location.hash=a}};wax.hash=function(a,b){var c,d=90-1e-8,a,e={map:this,parser:function(b){var c=b.split("/");for(var d=0;da.pageY&&c[d][1]a.pageX){b=c[d][2];break}return b||!1},clearTimeout:function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},onMove:function(b){return this._onMove=this._onMove||wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d){if(d){var e=d.getFeature(b.pageX,b.pageY,c,{format:"teaser"});e?e&&this.feature!==e?(this.feature=e,this.callbacks.out(e,a.parent,0,b),this.callbacks.over(e,a.parent,0,b)):e||(this.feature=null,this.callbacks.out(e,a.parent,0,b)):(this.feature=null,this.callbacks.out({},a.parent,0,b))}},this))},this)},mouseDown:function(b){return this._mouseDown=this._mouseDown||wax.util.bind(function(b){this.clearTimeout()||(this.downEvent=b,c.addEvent(a.parent,"mouseup",this.mouseUp()))},this)},mouseUp:function(){return this._mouseUp=this._mouseUp||wax.util.bind(function(b){c.removeEvent(a.parent,"mouseup",this.mouseUp());var d=4;Math.round(b.pageY/d)===Math.round(this.downEvent.pageY/d)&&Math.round(b.pageX/d)===Math.round(this.downEvent.pageX/d)&&(this.clickTimeout=window.setTimeout(wax.util.bind(function(){this.click()(b)},this),300))},this)},click:function(a){return this._onClick=this._onClick||wax.util.bind(function(a){var b=this.getTile(a);b&&this.waxGM.getGrid(b.src,wax.util.bind(function(c){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)}};return d.add(a)},wax=wax||{},wax.legend=function(a,b){b=b||{};var c={add:function(){this.legend=new wax.Legend(a.parent,b.container),this.legend.render([a.provider.getTileUrl({zoom:0,column:0,row:0})])}};return c.add(a)},wax=wax||{},wax.mobile={},wax=wax||{},wax.pointselector=function(a,b){var c=null,d=null,e=5,f=com.modestmaps,g=[],h=typeof b=="function"?b:b.callback,i=function(b){var c=new f.Point(b.clientX,b.clientY);c.x+=document.body.scrollLeft+document.documentElement.scrollLeft,c.y+=document.body.scrollTop+document.documentElement.scrollTop,c.x-=parseFloat(f.getStyle(document.documentElement,"margin-left")),c.y-=parseFloat(f.getStyle(document.documentElement,"margin-top"));for(var d=a.parent;d;d=d.offsetParent)c.x-=d.offsetLeft,c.y-=d.offsetTop;return c},j={add:function(a){this.overlayDiv=document.createElement("div"),this.overlayDiv.id=a.parent.id+"-boxselector",this.overlayDiv.className="pointselector-box-container",this.overlayDiv.style.width=a.dimensions.x+"px",this.overlayDiv.style.height=a.dimensions.y+"px",a.parent.appendChild(this.overlayDiv),f.addEvent(this.overlayDiv,"mousedown",j.mouseDown),a.addCallback("drawn",j.drawPoints);return this},deletePoint:function(a,b){confirm("Delete this point?")&&(a.pointDiv.parentNode.removeChild(a.pointDiv),g.splice(g.indexOf(a),1),h(j.cleanLocations(g)))},drawPoints:function(){var b=new f.Point(0,0);for(var c=0;c>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else for(;;){if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(d=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=wax.util.offset(c),f=e.left,g=e.top;if(Math.floor((b-g)/this.tileRes)>256||Math.floor((a-f)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-g)/this.tileRes)].charCodeAt(Math.floor((a-f)/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||$('
')[0],this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=wax.util.bind(function(a,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("
").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').css({"z-index":"9999999999",position:"relative"}).val("
"+$("#"+this.el+"-script").html()+"
"));return this},wax=wax||{},wax.fullscreen=function(a,b){var c={state:1,add:function(a){this.a=document.createElement("a"),this.a.className="wax-fullscreen",this.a.href="#fullscreen",this.a.innerHTML="fullscreen",a.parent.appendChild(this.a),com.modestmaps.addEvent(this.a,"click",this.click(a));return this},click:function(a){return this._click=this._click||wax.util.bind(function(b){b&&com.modestmaps.cancelEvent(b),this.state?(this.smallSize=[a.parent.offsetWidth,a.parent.offsetHeight],a.parent.className+=" wax-fullscreen-map",a.setSize(a.parent.offsetWidth,a.parent.offsetHeight)):(a.parent.className=a.parent.className.replace("wax-fullscreen-map",""),a.setSize(this.smallSize[0],this.smallSize[1])),this.state=!this.state},this)}};return c.add(a)},wax=wax||{};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)},locationHash={stateChange:function(a){com.modestmaps.addEvent(window,"hashchange",function(){a(location.hash)},!1)},getState:function(){return location.hash},pushState:function(a){location.hash=a}};wax.hash=function(a,b){var c,d=90-1e-8,a,e={map:this,parser:function(b){var c=b.split("/");for(var d=0;da.pageY&&c[d][1]a.pageX){b=c[d][2];break}return b||!1},clearTimeout:function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},onMove:function(b){return this._onMove=this._onMove||wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d){if(d){var e=d.getFeature(b.pageX,b.pageY,c,{format:"teaser"});e?e&&this.feature!==e?(this.feature=e,this.callbacks.out(e,a.parent,0,b),this.callbacks.over(e,a.parent,0,b)):e||(this.feature=null,this.callbacks.out(e,a.parent,0,b)):(this.feature=null,this.callbacks.out({},a.parent,0,b))}},this))},this)},mouseDown:function(b){return this._mouseDown=this._mouseDown||wax.util.bind(function(b){this.clearTimeout()||(this.downEvent=b,c.addEvent(a.parent,"mouseup",this.mouseUp()))},this)},mouseUp:function(){return this._mouseUp=this._mouseUp||wax.util.bind(function(b){c.removeEvent(a.parent,"mouseup",this.mouseUp());var d=4;Math.round(b.pageY/d)===Math.round(this.downEvent.pageY/d)&&Math.round(b.pageX/d)===Math.round(this.downEvent.pageX/d)&&(this.clickTimeout=window.setTimeout(wax.util.bind(function(){this.click()(b)},this),300))},this)},click:function(a){return this._onClick=this._onClick||wax.util.bind(function(a){var b=this.getTile(a);b&&this.waxGM.getGrid(b.src,wax.util.bind(function(c){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)}};return d.add(a)},wax=wax||{},wax.legend=function(a,b){b=b||{};var c={add:function(){this.legend=new wax.Legend(a.parent,b.container),this.legend.render([a.provider.getTileUrl({zoom:0,column:0,row:0})])}};return c.add(a)},wax=wax||{},wax.mobile={},wax=wax||{},wax.pointselector=function(a,b){var c=null,d=null,e=5,f=com.modestmaps,g=[],h=typeof b=="function"?b:b.callback,i=function(b){var c=new f.Point(b.clientX,b.clientY);c.x+=document.body.scrollLeft+document.documentElement.scrollLeft,c.y+=document.body.scrollTop+document.documentElement.scrollTop,c.x-=parseFloat(f.getStyle(document.documentElement,"margin-left")),c.y-=parseFloat(f.getStyle(document.documentElement,"margin-top"));for(var d=a.parent;d;d=d.offsetParent)c.x-=d.offsetLeft,c.y-=d.offsetTop;return c},j={add:function(a){this.overlayDiv=document.createElement("div"),this.overlayDiv.id=a.parent.id+"-boxselector",this.overlayDiv.className="pointselector-box-container",this.overlayDiv.style.width=a.dimensions.x+"px",this.overlayDiv.style.height=a.dimensions.y+"px",a.parent.appendChild(this.overlayDiv),f.addEvent(this.overlayDiv,"mousedown",j.mouseDown),a.addCallback("drawn",j.drawPoints);return this},deletePoint:function(a,b){confirm("Delete this point?")&&(a.pointDiv.parentNode.removeChild(a.pointDiv),g.splice(g.indexOf(a),1),h(j.cleanLocations(g)))},drawPoints:function(){var b=new f.Point(0,0);for(var c=0;c