Skip to content
Browse files

new version 0.47, all changes in NEWS.md

  • Loading branch information...
1 parent 61b0909 commit 38a87339d3312fab3d304453b1cf6f001800a356 @xavijam xavijam committed Jun 13, 2012
Showing with 3,201 additions and 86 deletions.
  1. +7 −0 NEWS.md
  2. +16 −30 README.md
  3. +8 −14 custompopup.html
  4. +1 −1 dist/cartodb-leaflet-min.js
  5. +59 −27 dist/cartodb-leaflet.js
  6. +20 −12 index.html
  7. +3,088 −0 js/wax.leaf.js
  8. +0 −2 js/wax.leaf.min-6.0.0-beta2.js
  9. +2 −0 js/wax.leaf.min-6.0.5-touched.js
View
7 NEWS.md
@@ -0,0 +1,7 @@
+
+ [v 0.47]
+ - Touch events supported
+ - Feature event functions renamed (featureClick,featureOut,featureOver)
+ - New parameter added in those functions, position. Where it returns the x and y position where user clicked or touched.
+ - setBounds function improved
+ - setBounds function added for publicy using.
View
46 README.md
@@ -4,33 +4,10 @@
This library allows you to use your own CartoDB tables with Laeflet.
-# Creating an example
-
-You will need to load these files to run the library:
-
- - [Leaflet library](http://github.com/CloudMade/Leaflet/blob/master/dist/leaflet.js)
- - [Leaflet css theme](http://github.com/CloudMade/Leaflet/tree/master/dist/leaflet.css)
- - [Wax for Leaflet](https://github.com/mapbox/wax)
- - [CartoDB library for Leaflet](https://github.com/Vizzuality/cartodb-leaflet/blob/gh-pages/cartodb-leaflet-min.js)
-
-Html(*):
-
-```html
-<link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.css" />
-<!--[if lte IE 8]><link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.ie.css" /><![endif]-->
-<script type="text/javascript" src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
-<script type="text/javascript" src="wax.leaf.min-6.0.0-beta2.js"></script>
-<script type="text/javascript" src="cartodb-leaflet-min.js"></script>
-```
-* We strongly recommend to use the library files we have in this repository, they are fully tested.
-
-
-
# Using the library
Using the library is really easy. It accepts the following parameters to manage the behavior of your CartoDB layers:
-
<table>
<tr>
<td><b>Parameter name</b></td>
@@ -89,32 +66,34 @@ Using the library is really easy. It accepts the following parameters to manage
</tr>
<tr>
-<td>featureMouseOver</td>
+<td>featureOver</td>
<td>A callback when hovers in a feature</td>
<td>Function</td>
<td>
<b>event:</b> Mouse event object<br/>
<b>latlng:</b> The LatLng leaflet object where was clicked<br/>
+ <b>pos:</b> Object with x and y position in the DOM map element<br/>
<b>data:</b> The CartoDB data of the clicked feature with the `interactivity` param.
</td>
<td>No (But only will work with `interactivity` specified)</td>
</tr>
<tr>
-<td>featureMouseOut</td>
+<td>featureOut</td>
<td>A callback when hovers out a feature</td>
<td>Function</td>
<td></td>
<td>No (But only will work with `interactivity` specified)</td>
</tr>
<tr>
-<td>featureMouseClick</td>
+<td>featureClick</td>
<td>A callback when clicks in a feature</td>
<td>Function</td>
<td>
<b>event:</b> Mouse event object<br/>
<b>latlng:</b> The LatLng leaflet object where was clicked<br/>
+ <b>pos:</b> Object with x and y position in the DOM map element<br/>
<b>data:</b> The CartoDB data of the clicked feature with the `interactivity` param.
</td>
<td>No (But only will work with `interactivity` specified)</td>
@@ -200,21 +179,26 @@ If you want to get a feature clicked || hover data (via the `interactivity` para
If you don't want to write the name of the table several times, you can use {{table_name}} in the `query` or `tile_style` parameters.
We strongly recommend the use of the files available in this repository. These are tested, and if you decide use updated ones, the library could not work.
-# Example
+
+# Creating an example
+
Here's a [live example](http://vizzuality.github.com/cartodb-leaflet/custompopup.html)!
+
First of all add the necessary script and css files:
```html
<link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.ie.css" /><![endif]-->
<link href="css/cartodb-leaflet.css" rel="stylesheet" type="text/css">
<script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
-<script type="text/javascript" src="js/wax.leaf.min-6.0.0-beta2.js"></script>
+<script type="text/javascript" src="js/wax.leaf.min-6.0.5-touched.js"></script>
<script type="text/javascript" src="dist/cartodb-leaflet-min.js"></script>
<script type="text/javascript" src="dist/cartodb-popup.js"></script>
```
+* We strongly recommend to use the library files we have in this repository, they are fully tested.
+
When the document is loaded, start creating the map:
@@ -226,7 +210,7 @@ var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D7597
map.addLayer(cloudmade);
```
-When the document is loaded, start creating the map:
+After that, create the CartoDB layer:
```javascript
var cartodb_leaflet = new L.CartoDBLayer({
@@ -236,7 +220,7 @@ var cartodb_leaflet = new L.CartoDBLayer({
query: "SELECT * FROM {{table_name}}",
tile_style: "#{{table_name}}{marker-fill:red}",
interactivity: "cartodb_id, magnitude",
- featureMouseClick: function(ev, latlng, data) {alert(data)}
+ featureClick: function(ev, latlng, pos, data) {alert(data)}
auto_bound: true
});
```
@@ -270,4 +254,6 @@ New funcionalities are coming, in the meantime you can use:
Example: ```cartodb_leaflet.isVisible();```
- **setInteractivity**: Change the columns you want to get data (it needs to reload the tiles)
Example: ```cartodb_leaflet.setInteractivity("cartodb_id, the_geom, magnitude");```
+- **setBounds**: Set bounds in the map using a new query or the default one
+ Example: ```cartodb_leaflet.setBounds(); || cartodb_leaflet.setBounds("SELECT * FROM {{table_name}} WHERE cartodb_id < 100");```
- **setLayerOrder**: _Not available yet_ -> Waiting for this ticket fixed: https://github.com/CloudMade/Leaflet/issues/505
View
22 custompopup.html
@@ -5,30 +5,25 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Using CartoDB with Leaflet and custom infowindow</title>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
- <style>body,html {width:100%; height:100%; margin:0; padding:0; overflow:hidden;} #map {height:100%;}</style>
+ <style>body,html {width:100%; height:100%; margin:0; padding:0; overflow:hidden;} #map {margin:100px 0 0 0; height:50%;} .leaflet-container {background:#A7BDDE!important;}</style>
<link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.ie.css" /><![endif]-->
<link href="css/cartodb-leaflet.css" rel="stylesheet" type="text/css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
- <script type="text/javascript" src="js/wax.leaf.min-6.0.0-beta2.js"></script>
+ <script type="text/javascript" src="js/wax.leaf.min-6.0.5-touched.js"></script>
<script type="text/javascript" src="dist/cartodb-leaflet-min.js"></script>
<script type="text/javascript" src="dist/cartodb-popup-min.js"></script>
<script type="text/javascript">
function initialize() {
+ // Create map
var map = new L.Map('map').setView(new L.LatLng(20,0), 3);
- var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
- cloudmadeAttrib = 'Map data &copy; 2012 OpenStreetMap contributors, Imagery &copy; 2012 CloudMade',
- cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttrib});
- map.addLayer(cloudmade,true);
-
-
// Create a CartoDB popup
var popup = new L.CartoDBPopup();
-
// First cartodb layer, countries
var cartodb_leaflet1 = new L.CartoDBLayer({
map: map,
@@ -47,17 +42,16 @@
map: map,
user_name:"examples",
table_name: 'earthquakes',
- query: "SELECT cartodb_id,the_geom_webmercator,magnitude FROM {{table_name}}",
+ query: "SELECT cartodb_id,the_geom_webmercator,the_geom,magnitude FROM {{table_name}}",
tile_style: "#{{table_name}}{marker-fill:#E25B5B}",
- opacity: 0.8,
interactivity: "cartodb_id, magnitude",
- featureMouseOver: function(ev,latlng,data) {
+ featureOver: function(ev,latlng,pos,data) {
document.body.style.cursor = "pointer";
},
- featureMouseOut: function() {
+ featureOut: function() {
document.body.style.cursor = "default";
},
- featureMouseClick: function(ev,latlng,data) {
+ featureClick: function(ev,latlng,pos,data) {
// Set popup content
popup.setContent(data);
View
2 dist/cartodb-leaflet-min.js
@@ -1,2 +1,2 @@
-/*0.45*/if(typeof(L.CartoDBLayer)==="undefined"){L.CartoDBLayer=L.Class.extend({includes:L.Mixin.Events,options:{query:"SELECT * FROM {{table_name}}",opacity:0.99,auto_bound:false,debug:false,visible:true,tiler_domain:"cartodb.com",tiler_port:"80",tiler_protocol:"http",sql_domain:"cartodb.com",sql_port:"80",sql_protocol:"http"},initialize:function(a){L.Util.setOptions(this,a);if(!a.table_name||!a.map){if(a.debug){throw ("cartodb-leaflet needs at least a CartoDB table name and the Leaflet map object :(")}else{return}}if(a.auto_bound){this._setBounds()}this._addWadus()},onAdd:function(a){if(!this.options.interactivity){this._addSimple()}else{this._addInteraction()}},onRemove:function(a){this._remove()},setOpacity:function(a){if(isNaN(a)||a>1||a<0){if(this.options.debug){throw (a+" is not a valid value")}else{return}}this.layer.setOpacity(a)},setQuery:function(a){if(!isNaN(a)){if(this.options.debug){throw (a+" is not a valid query")}else{return}}this.options.query=a;this._update()},setStyle:function(a){if(!isNaN(a)){if(this.options.debug){throw (a+" is not a valid style")}else{return}}this.options.tile_style=a;this._update()},setInteractivity:function(a){if(!isNaN(a)){if(this.options.debug){throw (a+" is not a valid setInteractivity value")}else{return}}this.options.interactivity=a;this._update()},setLayerOrder:function(a){},setInteraction:function(b){if(b!==false&&b!==true){if(this.options.debug){throw (b+" is not a valid setInteraction value")}else{return}}if(this.interaction){if(b){var a=this;this.interaction.on("on",function(c){a._bindWaxEvents(a.options.map,c)})}else{this.interaction.off("on")}}},isVisible:function(){return this.options.visible},hide:function(){this.setOpacity(0);this.setInteraction(false);this.options.visible=false},show:function(){this.setOpacity(this.options.opacity);this.setInteraction(true);this.options.visible=true},_remove:function(){this.setInteraction(false);this.options.map.removeLayer(this.layer)},_update:function(){this._remove();if(!this.options.interactivity){this._addSimple()}else{this._addInteraction()}},_setBounds:function(){var a=this;reqwest({url:this.generateUrl("sql")+"/api/v2/sql/?q="+escape("select ST_Extent(the_geom) from "+this.options.table_name),type:"jsonp",jsonpCallback:"callback",success:function(q){if(q.rows[0].st_extent!=null){var p=q.rows[0].st_extent.replace("BOX(","").replace(")","").split(",");var n=p[0].split(" ");var l=p[1].split(" ");var j=n[0];var h=n[1];var i=l[0];var g=l[1];var c=-85.0511;var e=85.0511;var k=-179;var m=179;var f=function(s,t,r){return s<t?t:s>r?r:s};j=f(j,k,m);i=f(i,k,m);h=f(h,c,e);g=f(g,c,e);var o=new L.LatLng(h,j);var d=new L.LatLng(g,i);var b=new L.LatLngBounds(o,d);a.options.map.fitBounds(b)}},error:function(b,c){if(this.options.debug){throw ("Error getting table bounds: "+c)}}})},_addWadus:function(){if(!document.getElementById("cartodb_logo")){var a=document.createElement("a");a.setAttribute("id","cartodb_logo");a.setAttribute("style","position:absolute; bottom:8px; left:8px; display:block;");a.setAttribute("href","http://www.cartodb.com");a.setAttribute("target","_blank");a.innerHTML="<img src='http://cartodb.s3.amazonaws.com/static/new_logo.png' alt='CartoDB' title='CartoDB' />";this.options.map._container.appendChild(a)}},_addSimple:function(){var a=(this.options.tile_style)?encodeURIComponent(this.options.tile_style.replace(/\{\{table_name\}\}/g,this.options.table_name)):"",c=encodeURIComponent(this.options.query.replace(/\{\{table_name\}\}/g,this.options.table_name));var b=this.generateUrl("tiler")+"/tiles/"+this.options.table_name+"/{z}/{x}/{y}.png?sql="+c+"&style="+a;this.layer=new L.TileLayer(b,{attribution:"CartoDB",opacity:this.options.opacity});this.options.map.addLayer(this.layer,false)},_addInteraction:function(){var a=this;this.tilejson=this._generateTileJson();this.layer=new wax.leaf.connector(this.tilejson);this.options.map.addLayer(this.layer,false);this.interaction=wax.leaf.interaction().map(this.options.map).tilejson(this.tilejson).on("on",function(b){a._bindWaxEvents(a.options.map,b)}).on("off",function(){if(a.options.featureMouseOut){return a.options.featureMouseOut&&a.options.featureMouseOut()}else{if(a.options.debug){throw ("featureMouseOut function not defined")}}})},_bindWaxEvents:function(b,c){var a=b.mouseEventToLayerPoint(c.e),d=b.layerPointToLatLng(a);switch(c.e.type){case"mousemove":if(this.options.featureMouseOver){return this.options.featureMouseOver(c.e,d,c.data)}else{if(this.options.debug){throw ("featureMouseOver function not defined")}}break;case"mouseup":if(this.options.featureMouseClick){this.options.featureMouseClick(c.e,d,c.data)}else{if(this.options.debug){throw ("featureMouseClick function not defined")}}break;default:break}},_generateTileJson:function(){var b=this.generateUrl("tiler");var f=b+"/tiles/"+this.options.table_name+"/{z}/{x}/{y}";var g=f+".png";var a=f+".grid.json";if(this.options.query){var e="sql="+encodeURIComponent(this.options.query.replace(/\{\{table_name\}\}/g,this.options.table_name));g=this._addUrlData(g,e);a=this._addUrlData(a,e)}if(this.options.tile_style){var c="style="+encodeURIComponent(this.options.tile_style.replace(/\{\{table_name\}\}/g,this.options.table_name));g=this._addUrlData(g,c);a=this._addUrlData(a,c)}if(this.options.interactivity){var d="interactivity="+encodeURIComponent(this.options.interactivity.replace(/ /g,""));g=this._addUrlData(g,d);a=this._addUrlData(a,d)}return{blankImage:"../img/blank_tile.png",tilejson:"1.0.0",scheme:"xyz",tiles:[g],grids:[a],tiles_base:g,grids_base:a,opacity:this.options.opacity,formatter:function(h,i){return i}}},_parseUri:function(e){var d={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},a=d.parser[d.strictMode?"strict":"loose"].exec(e),c={},b=14;while(b--){c[d.key[b]]=a[b]||""}c[d.q.name]={};c[d.key[12]].replace(d.q.parser,function(g,f,h){if(f){c[d.q.name][f]=h}});return c},_addUrlData:function(a,b){a+=(this._parseUri(a).query)?"&":"?";return a+=b},generateUrl:function(a){if(a=="sql"){return this.options.sql_protocol+"://"+((this.options.user_name)?this.options.user_name+".":"")+this.options.sql_domain+((this.options.sql_port!="")?(":"+this.options.sql_port):"")}else{return this.options.tiler_protocol+"://"+((this.options.user_name)?this.options.user_name+".":"")+this.options.tiler_domain+((this.options.tiler_port!="")?(":"+this.options.tiler_port):"")}}});
+/*0.47*/if(typeof(L.CartoDBLayer)==="undefined"){L.CartoDBLayer=L.Class.extend({includes:L.Mixin.Events,options:{query:"SELECT * FROM {{table_name}}",opacity:0.99,auto_bound:false,debug:false,visible:true,tiler_domain:"cartodb.com",tiler_port:"80",tiler_protocol:"http",sql_domain:"cartodb.com",sql_port:"80",sql_protocol:"http"},initialize:function(a){L.Util.setOptions(this,a);if(!a.table_name||!a.map){if(a.debug){throw ("cartodb-leaflet needs at least a CartoDB table name and the Leaflet map object :(")}else{return}}if(a.auto_bound){this.setBounds()}this._addWadus()},onAdd:function(a){if(!this.options.interactivity){this._addSimple()}else{this._addInteraction()}},onRemove:function(a){this._remove()},setOpacity:function(a){if(isNaN(a)||a>1||a<0){if(this.options.debug){throw (a+" is not a valid value")}else{return}}this.layer.setOpacity(a)},setQuery:function(a){if(!isNaN(a)){if(this.options.debug){throw (a+" is not a valid query")}else{return}}this.options.query=a;this._update()},setStyle:function(a){if(!isNaN(a)){if(this.options.debug){throw (a+" is not a valid style")}else{return}}this.options.tile_style=a;this._update()},setInteractivity:function(a){if(!isNaN(a)){if(this.options.debug){throw (a+" is not a valid setInteractivity value")}else{return}}this.options.interactivity=a;this._update()},setLayerOrder:function(a){},setInteraction:function(b){if(b!==false&&b!==true){if(this.options.debug){throw (b+" is not a valid setInteraction value")}else{return}}if(this.interaction){if(b){var a=this;this.interaction.on("on",function(c){a._bindWaxEvents(a.options.map,c)})}else{this.interaction.off("on")}}},isVisible:function(){return this.options.visible},hide:function(){this.setOpacity(0);this.setInteraction(false);this.options.visible=false},show:function(){this.setOpacity(this.options.opacity);this.setInteraction(true);this.options.visible=true},_remove:function(){this.setInteraction(false);this.options.map.removeLayer(this.layer)},_update:function(){this._remove();if(!this.options.interactivity){this._addSimple()}else{this._addInteraction()}},setBounds:function(c){var a=this,b="";if(c){b=c}else{b=this.options.query}reqwest({url:this.generateUrl("sql")+"/api/v2/sql/?q="+escape("SELECT ST_XMin(ST_Extent(the_geom)) as minx,ST_YMin(ST_Extent(the_geom)) as miny,ST_XMax(ST_Extent(the_geom)) as maxx,ST_YMax(ST_Extent(the_geom)) as maxy from ("+b.replace(/\{\{table_name\}\}/g,this.options.table_name)+") as subq"),type:"jsonp",jsonpCallback:"callback",success:function(q){if(q.rows[0].maxx!=null){var p=q.rows[0];var l=p.maxx;var j=p.maxy;var k=p.minx;var i=p.miny;var e=-85.0511;var g=85.0511;var m=-179;var n=179;var h=function(s,t,r){return s<t?t:s>r?r:s};l=h(l,m,n);k=h(k,m,n);j=h(j,e,g);i=h(i,e,g);var o=new L.LatLng(j,l);var f=new L.LatLng(i,k);var d=new L.LatLngBounds(o,f);a.options.map.fitBounds(d)}},error:function(d,f){if(this.options.debug){throw ("Error getting table bounds: "+f)}}})},_addWadus:function(){if(!document.getElementById("cartodb_logo")){var a=document.createElement("a");a.setAttribute("id","cartodb_logo");a.setAttribute("style","position:absolute; bottom:8px; left:8px; display:block;");a.setAttribute("href","http://www.cartodb.com");a.setAttribute("target","_blank");a.innerHTML="<img src='http://cartodb.s3.amazonaws.com/static/new_logo.png' alt='CartoDB' title='CartoDB' />";this.options.map._container.appendChild(a)}},_addSimple:function(){var a=(this.options.tile_style)?encodeURIComponent(this.options.tile_style.replace(/\{\{table_name\}\}/g,this.options.table_name)):"",c=encodeURIComponent(this.options.query.replace(/\{\{table_name\}\}/g,this.options.table_name));var b=this.generateUrl("tiler")+"/tiles/"+this.options.table_name+"/{z}/{x}/{y}.png?sql="+c+"&style="+a;this.layer=new L.TileLayer(b,{attribution:"CartoDB",opacity:this.options.opacity});this.options.map.addLayer(this.layer,false)},_addInteraction:function(){var a=this;this.tilejson=this._generateTileJson();this.layer=new wax.leaf.connector(this.tilejson);this.options.map.addLayer(this.layer,false);this.interaction=wax.leaf.interaction().map(this.options.map).tilejson(this.tilejson).on("on",function(b){a._bindWaxEvents(a.options.map,b)}).on("off",function(){if(a.options.featureOut){return a.options.featureOut&&a.options.featureOut()}else{if(a.options.debug){throw ("featureOut function not defined")}}})},_bindWaxEvents:function(b,c){var a=this._findPos(b,c),d=b.layerPointToLatLng(a);switch(c.e.type){case"mousemove":if(this.options.featureOver){return this.options.featureOver(c.e,d,c.pos,c.data)}else{if(this.options.debug){throw ("featureOver function not defined")}}break;case"click":if(this.options.featureClick){this.options.featureClick(c.e,d,c.pos,c.data)}else{if(this.options.debug){throw ("featureClick function not defined")}}break;case"touchend":if(this.options.featureClick){this.options.featureClick(c.e,d,c.pos,c.data)}else{if(this.options.debug){throw ("featureClick function not defined")}}break;default:break}},_generateTileJson:function(){var b=this.generateUrl("tiler");var f=b+"/tiles/"+this.options.table_name+"/{z}/{x}/{y}";var g=f+".png";var a=f+".grid.json";if(this.options.query){var e="sql="+encodeURIComponent(this.options.query.replace(/\{\{table_name\}\}/g,this.options.table_name));g=this._addUrlData(g,e);a=this._addUrlData(a,e)}if(this.options.tile_style){var c="style="+encodeURIComponent(this.options.tile_style.replace(/\{\{table_name\}\}/g,this.options.table_name));g=this._addUrlData(g,c);a=this._addUrlData(a,c)}if(this.options.interactivity){var d="interactivity="+encodeURIComponent(this.options.interactivity.replace(/ /g,""));g=this._addUrlData(g,d);a=this._addUrlData(a,d)}return{blankImage:"../img/blank_tile.png",tilejson:"1.0.0",scheme:"xyz",tiles:[g],grids:[a],tiles_base:g,grids_base:a,opacity:this.options.opacity,formatter:function(h,i){return i}}},_parseUri:function(e){var d={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},a=d.parser[d.strictMode?"strict":"loose"].exec(e),c={},b=14;while(b--){c[d.key[b]]=a[b]||""}c[d.q.name]={};c[d.key[12]].replace(d.q.parser,function(g,f,h){if(f){c[d.q.name][f]=h}});return c},_addUrlData:function(a,b){a+=(this._parseUri(a).query)?"&":"?";return a+=b},generateUrl:function(a){if(a=="sql"){return this.options.sql_protocol+"://"+((this.options.user_name)?this.options.user_name+".":"")+this.options.sql_domain+((this.options.sql_port!="")?(":"+this.options.sql_port):"")}else{return this.options.tiler_protocol+"://"+((this.options.user_name)?this.options.user_name+".":"")+this.options.tiler_domain+((this.options.tiler_port!="")?(":"+this.options.tiler_port):"")}},_findPos:function(b,c){var d=curtop=0;var a=b._container;if(a.offsetParent){do{d+=a.offsetLeft;curtop+=a.offsetTop}while(a=a.offsetParent);return b.containerPointToLayerPoint(new L.Point(c.pos.x-d,c.pos.y-curtop))}else{return b.mouseEventToLayerPoint(c.e)}}});
}!function(d,c){typeof module!="undefined"?module.exports=c():typeof define=="function"&&define.amd?define(d,c):this[d]=c()}("reqwest",function(){function handleReadyState(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||{},d;c.Accept=c.Accept||defaultHeaders.accept[b.type]||defaultHeaders.accept["*"],!b.crossOrigin&&!c[requestedWith]&&(c[requestedWith]=defaultHeaders.requestedWith),c[contentType]||(c[contentType]=b.contentType||defaultHeaders.contentType);for(d in c){c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d])}}function generalCallback(a){lastValue=a}function urlappend(a,b){return a+(/\?/.test(a)?"&":"?")+b}function handleJsonp(a,b,c,d){var e=uniqid++,f=a.jsonpCallback||"callback",g=a.jsonpCallbackName||"reqwest_"+e,h=new RegExp("((^|\\?|&)"+f+")=([^&]+)"),i=d.match(h),j=doc.createElement("script"),k=0;i?i[3]==="?"?d=d.replace(h,"$1="+g):g=i[3]:d=urlappend(d,f+"="+g),win[g]=generalCallback,j.type="text/javascript",j.src=d,j.async=!0,typeof j.onreadystatechange!="undefined"&&(j.event="onclick",j.htmlFor=j.id="_reqwest_"+e),j.onload=j.onreadystatechange=function(){if(j[readyState]&&j[readyState]!=="complete"&&j[readyState]!=="loaded"||k){return !1}j.onload=j.onreadystatechange=null,j.onclick&&j.onclick(),a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(j),k=1},head.appendChild(j)}function getRequest(a,b,c){var d=(a.method||"GET").toUpperCase(),e=typeof a=="string"?a:a.url,f=a.processData!==!1&&a.data&&typeof a.data!="string"?reqwest.toQueryString(a.data):a.data||null,g;return(a.type=="jsonp"||d=="GET")&&f&&(e=urlappend(e,f),f=null),a.type=="jsonp"?handleJsonp(a,b,c,e):(g=xhr(),g.open(d,e,!0),setHeaders(g,a),g.onreadystatechange=handleReadyState(g,b,c),a.before&&a.before(g),g.send(f),g)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){var b=a.match(/\.(json|jsonp|html|xml)(\?|$)/);return b?b[1]:"js"}function init(o,fn){function complete(a){o.timeout&&clearTimeout(self.timeout),self.timeout=null,o.complete&&o.complete(a)}function success(resp){var r=resp.responseText;if(r){switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r}}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a,b,c){o.error&&o.error(a,b,c),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()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function normalize(a){return a?a.replace(/\r?\n/g,"\r\n"):""}function serial(a,b){var c=a.name,d=a.tagName.toLowerCase(),e=function(a){a&&!a.disabled&&b(c,normalize(a.attributes.value&&a.attributes.value.specified?a.value:a.text))};if(a.disabled||!c){return}switch(d){case"input":if(!/reset|button|image|file/i.test(a.type)){var f=/checkbox/i.test(a.type),g=/radio/i.test(a.type),h=a.value;(!f&&!g||a.checked)&&b(c,normalize(f&&h===""?"on":h))}break;case"textarea":b(c,normalize(a.value));break;case"select":if(a.type.toLowerCase()==="select-one"){e(a.selectedIndex>=0?a.options[a.selectedIndex]:null)}else{for(var i=0;a.length&&i<a.length;i++){a.options[i].selected&&e(a.options[i])}}}}function eachFormElement(){var a=this,b,c,d,e=function(b,c){for(var e=0;e<c.length;e++){var f=b[byTag](c[e]);for(d=0;d<f.length;d++){serial(f[d],a)}}};for(c=0;c<arguments.length;c++){b=arguments[c],/input|select|textarea/i.test(b.tagName)&&serial(b,a),e(b,["input","select","textarea"])}}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var a={};return eachFormElement.apply(function(b,c){b in a?(a[b]&&!isArray(a[b])&&(a[b]=[a[b]]),a[b].push(c)):a[b]=c},arguments),a}var context=this,win=window,doc=document,old=context.reqwest,twoHundo=/^20\d$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,lastValue,xmlHttpRequest="XMLHttpRequest",isArray=typeof Array.isArray=="function"?Array.isArray:function(a){return a instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"},requestedWith:xmlHttpRequest},xhr=win[xmlHttpRequest]?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};return Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serializeArray=function(){var a=[];return eachFormElement.apply(function(b,c){a.push({name:b,value:c})},arguments),a},reqwest.serialize=function(){if(arguments.length===0){return""}var a,b,c=Array.prototype.slice.call(arguments,0);return a=c.pop(),a&&a.nodeType&&c.push(a)&&(a=null),a&&(a=a.type),a=="map"?b=serializeHash:a=="array"?b=reqwest.serializeArray:b=serializeQueryString,b.apply(null,c)},reqwest.toQueryString=function(a){var b="",c,d=encodeURIComponent,e=function(a,c){b+=d(a)+"="+d(c)+"&"};if(isArray(a)){for(c=0;a&&c<a.length;c++){e(a[c].name,a[c].value)}}else{for(var f in a){if(!Object.hasOwnProperty.call(a,f)){continue}var g=a[f];if(isArray(g)){for(c=0;c<g.length;c++){e(f,g[c])}}else{e(f,a[f])}}}return b.replace(/&$/,"").replace(/%20/g,"+")},reqwest.compat=function(a,b){return a&&(a.type&&(a.method=a.type)&&delete a.type,a.dataType&&(a.type=a.dataType),a.jsonpCallback&&(a.jsonpCallbackName=a.jsonpCallback)&&delete a.jsonpCallback,a.jsonp&&(a.jsonpCallback=a.jsonp)),new Reqwest(a,b)},reqwest});
View
86 dist/cartodb-leaflet.js
@@ -1,6 +1,6 @@
/**
* @name cartodb-leaflet
- * @version 0.45 [May 30, 2012]
+ * @version 0.47 [June 13, 2012]
* @author: jmedina@vizzuality.com
* @fileoverview <b>Author:</b> jmedina@vizzuality.com<br/> <b>Licence:</b>
* Licensed under <a
@@ -40,9 +40,9 @@ if (typeof(L.CartoDBLayer) === "undefined") {
* opacity - If you want to change the opacity of the CartoDB layer
* tile_style - If you want to add other style to the layer
* interactivity - Get data from the feature clicked ( without any request :) )
- * featureMouseOver - Callback when user hovers a feature (return mouse event, latlng and feature data)
- * featureMouseOut - Callback when user hovers out a feature
- * featureMouseClick - Callback when user clicks a feature (return mouse event, latlng and feature data)
+ * featureOver - Callback when user hovers a feature (return mouse event, latlng, position (x & y) and feature data)
+ * featureOut - Callback when user hovers out a feature
+ * featureClick - Callback when user clicks a feature (return mouse/touch event, latlng, position (x & y) and feature data)
* debug - Get error messages from the library
* auto_bound - Let cartodb auto-bound-zoom in the map (opcional - default = false)
*
@@ -67,7 +67,7 @@ if (typeof(L.CartoDBLayer) === "undefined") {
// Bounds? CartoDB does it
if (options.auto_bound)
- this._setBounds();
+ this.setBounds();
// Add cartodb logo, yes sir!
this._addWadus();
@@ -260,22 +260,31 @@ if (typeof(L.CartoDBLayer) === "undefined") {
/**
* Zoom to cartodb geometries
*/
- _setBounds: function() {
- var self = this;
+ setBounds: function(sql) {
+ var self = this
+ , query = "";
+
+ if (sql) {
+ // Custom query
+ query = sql;
+ } else {
+ // Already defined query
+ query = this.options.query;
+ }
+
reqwest({
- url: this.generateUrl("sql") + '/api/v2/sql/?q='+escape('select ST_Extent(the_geom) from '+ this.options.table_name),
+ url: this.generateUrl("sql") + '/api/v2/sql/?q='+escape('SELECT ST_XMin(ST_Extent(the_geom)) as minx,ST_YMin(ST_Extent(the_geom)) as miny,'+
+ 'ST_XMax(ST_Extent(the_geom)) as maxx,ST_YMax(ST_Extent(the_geom)) as maxy from ('+ query.replace(/\{\{table_name\}\}/g,this.options.table_name) + ') as subq'),
type: 'jsonp',
jsonpCallback: 'callback',
success: function(result) {
- if (result.rows[0].st_extent!=null) {
- var coordinates = result.rows[0].st_extent.replace('BOX(','').replace(')','').split(',');
- var coor1 = coordinates[0].split(' ');
- var coor2 = coordinates[1].split(' ');
+ if (result.rows[0].maxx!=null) {
+ var coordinates = result.rows[0];
- var lon0 = coor1[0];
- var lat0 = coor1[1];
- var lon1 = coor2[0];
- var lat1 = coor2[1];
+ var lon0 = coordinates.maxx;
+ var lat0 = coordinates.maxy;
+ var lon1 = coordinates.minx;
+ var lat1 = coordinates.miny;
var minlat = -85.0511;
var maxlat = 85.0511;
@@ -356,10 +365,10 @@ if (typeof(L.CartoDBLayer) === "undefined") {
.tilejson(this.tilejson)
.on('on',function(o) {self._bindWaxEvents(self.options.map,o)})
.on('off', function(){
- if (self.options.featureMouseOut) {
- return self.options.featureMouseOut && self.options.featureMouseOut();
+ if (self.options.featureOut) {
+ return self.options.featureOut && self.options.featureOut();
} else {
- if (self.options.debug) throw('featureMouseOut function not defined');
+ if (self.options.debug) throw('featureOut function not defined');
}
});
},
@@ -371,20 +380,26 @@ if (typeof(L.CartoDBLayer) === "undefined") {
* @param {Event} Wax event
*/
_bindWaxEvents: function(map,o) {
- var container_point = map.mouseEventToLayerPoint(o.e)
- , latlng = map.layerPointToLatLng(container_point);
+ var layer_point = this._findPos(map,o)
+ , latlng = map.layerPointToLatLng(layer_point);
switch (o.e.type) {
- case 'mousemove': if (this.options.featureMouseOver) {
- return this.options.featureMouseOver(o.e,latlng,o.data);
+ case 'mousemove': if (this.options.featureOver) {
+ return this.options.featureOver(o.e,latlng,o.pos,o.data);
} else {
- if (this.options.debug) throw('featureMouseOver function not defined');
+ if (this.options.debug) throw('featureOver function not defined');
}
break;
- case 'mouseup': if (this.options.featureMouseClick) {
- this.options.featureMouseClick(o.e,latlng,o.data);
+ case 'click': if (this.options.featureClick) {
+ this.options.featureClick(o.e,latlng,o.pos,o.data);
} else {
- if (this.options.debug) throw('featureMouseClick function not defined');
+ if (this.options.debug) throw('featureClick function not defined');
+ }
+ break;
+ case 'touchend': if (this.options.featureClick) {
+ this.options.featureClick(o.e,latlng,o.pos,o.data);
+ } else {
+ if (this.options.debug) throw('featureClick function not defined');
}
break;
default: break;
@@ -503,6 +518,23 @@ if (typeof(L.CartoDBLayer) === "undefined") {
this.options.tiler_domain +
((this.options.tiler_port != "") ? (":" + this.options.tiler_port) : "");
}
+ },
+
+
+ _findPos: function (map,o) {
+ var curleft = curtop = 0;
+ var obj = map._container;
+ if (obj.offsetParent) {
+ // Modern browsers
+ do {
+ curleft += obj.offsetLeft;
+ curtop += obj.offsetTop;
+ } while (obj = obj.offsetParent);
+ return map.containerPointToLayerPoint(new L.Point(o.pos.x - curleft,o.pos.y - curtop))
+ } else {
+ // IE
+ return map.mouseEventToLayerPoint(o.e)
+ }
}
});
View
32 index.html
@@ -36,15 +36,15 @@ <h1 class="left">
<div class="background floating">
<section class="shadow top">
<div class="content">
- <hgroup><h2 class="dark">CartoDB Leaflet library</h2><em class="medium">0.45</em></hgroup>
+ <hgroup><h2 class="dark">CartoDB Leaflet library</h2><em class="medium">0.47</em></hgroup>
</div>
<div class="content no_padding border code">
<link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<!--[if lt IE 9]> <link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.ie.css" /> <![endif]-->
<link href="css/cartodb-leaflet.css" rel="stylesheet" type="text/css">
<script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
- <script type="text/javascript" src="js/wax.leaf.min-6.0.0-beta2.js"></script>
+ <script type="text/javascript" src="js/wax.leaf.min-6.0.5-touched.js"></script>
<script type="text/javascript" src="dist/cartodb-leaflet-min.js"></script>
<script type="text/javascript">
@@ -79,17 +79,17 @@ <h1 class="left">
map: map,
user_name:"examples",
table_name: 'earthquakes',
- query: "SELECT cartodb_id,the_geom_webmercator,magnitude FROM {{table_name}}",
+ query: "SELECT cartodb_id,the_geom_webmercator,the_geom,magnitude FROM {{table_name}}",
tile_style: "#{{table_name}}{marker-fill:#E25B5B}",
opacity: 0.8,
interactivity: "cartodb_id, magnitude",
- featureMouseOver: function(ev,latlng,data) {
+ featureOver: function(ev,latlng,pos,data) {
document.body.style.cursor = "pointer";
},
- featureMouseOut: function() {
+ featureOut: function() {
document.body.style.cursor = "default";
},
- featureMouseClick: function(ev,latlng,data) {
+ featureClick: function(ev,latlng,pos,data) {
// Set popup content
var html = '';
for(var column in data) {
@@ -193,30 +193,32 @@ <h3 class="big" id="documentation">Documentation</h3>
<td>No</td>
</tr>
<tr>
- <td><i>featureMouseOver</i></td>
+ <td><i>featureOver</i></td>
<td>A callback when hovers in a feature</td>
<td>Function</td>
<td>
<b>event:</b> Mouse event object<br/>
<b>latlng:</b> The LatLng leaflet object where was clicked<br/>
+ <b>pos:</b> Object with x and y position in the DOM map element<br/>
<b>data:</b> The CartoDB data of the clicked feature with the `interactivity` param.
</td>
<td>No (But only will work with <i>interactivity</i> specified)</td>
</tr>
<tr>
- <td><i>featureMouseOut</i></td>
+ <td><i>featureOut</i></td>
<td>A callback when hovers out a feature</td>
<td>Function</td>
<td></td>
<td>No (But only will work with <i>interactivity</i> specified)</td>
</tr>
<tr>
- <td><i>featureMouseClick</i></td>
+ <td><i>featureClick</i></td>
<td>A callback when clicks in a feature</td>
<td>Function</td>
<td>
<b>event:</b> Mouse event object<br/>
<b>latlng:</b> The LatLng leaflet object where was clicked<br/>
+ <b>pos:</b> Object with x and y position in the DOM map element<br/>
<b>data:</b> The CartoDB data of the clicked feature with the `interactivity` param.
</td>
<td>No (But only will work with <i>interactivity</i> specified)</td>
@@ -302,7 +304,7 @@ <h5 class="margin30">Example</h5>
&#60;!--[if lt IE 9]&#62; &#60;link rel="stylesheet" href="http://code.leafletjs.com/leaflet-0.3.1/leaflet.ie.css" /&#62; &#60;![endif]--&#62;
&#60;link href="css/cartodb-leaflet.css" rel="stylesheet" type="text/css"&#62;
&#60;script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"&#62;&#60;/script&#62;
-&#60;script type="text/javascript" src="js/wax.leaf.min-6.0.0-beta2.js"&#62;&#60;/script&#62;
+&#60;script type="text/javascript" src="js/wax.leaf.min-6.0.5-touched.js"&#62;&#60;/script&#62;
&#60;script type="text/javascript" src="dist/cartodb-leaflet-min.js"&#62;&#60;/script&#62;
</pre>
@@ -327,7 +329,9 @@ <h5 class="margin30">Example</h5>
query: "SELECT * FROM {{table_name}}",
tile_style: "#{{table_name}}{marker-fill:red}",
interactivity: "cartodb_id, magnitude",
- featureMouseClick: function(ev, latlng, data) {alert(data)}
+ featureClick: function(ev, latlng, pos, data) {alert(data)},
+ featureOut: function() {},
+ featureOver: function(ev, latlng, pos, data) {},
auto_bound: true
});
</pre>
@@ -376,6 +380,10 @@ <h5 class="margin30">Functions</h5>
<pre style="margin:5px 0 0!important" data-language="javascript"> cartodb_leaflet.setInteractivity("cartodb_id, the_geom, magnitude");</pre>
</li>
<li class="margin15" style="display:block">
+ <p class="light"><b>setBounds</b>: Set bounds in the map using a new query or the default one</p>
+ <pre style="margin:5px 0 0!important" data-language="javascript"> cartodb_leaflet.setBounds(); || cartodb_leaflet.setBounds("SELECT * FROM {{table_name}} WHERE cartodb_id < 100"); </pre>
+ </li>
+ <li class="margin15" style="display:block">
<p class="light"><b>setLayerOrder</b>: _Not available yet_ -> Waiting for this ticket fixed: https://github.com/CloudMade/Leaflet/issues/505</p>
</li>
</ul>
@@ -394,7 +402,7 @@ <h5 class="margin30" id="custom-popup">Custom popup</h5>
<p class="light margin15">And then use as you want:</p>
<pre data-language="javascript">
...
-featureMouseClick: function(ev,latlng,data) {
+featureClick: function(ev,latlng,pos,data) {
// Set popup content
// You can pass an Object, an Array or a String
popup.setContent(data);
View
3,088 js/wax.leaf.js
3,088 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
2 js/wax.leaf.min-6.0.0-beta2.js
@@ -1,2 +0,0 @@
-/* wax - 6.0.0-beta2 - 1.0.4-532-g1db5f21 */!function(a,b,c){typeof module!="undefined"?module.exports=c(a,b):typeof define=="function"&&typeof define.amd=="object"?define(c):b[a]=c(a,b)}("bean",this,function(a,b){var c=window,d=b[a],e=/over|out/,f=/[^\.]*(?=\..*)\.|.*/,g=/\..*/,h="addEventListener",i="attachEvent",j="removeEventListener",k="detachEvent",l=document||{},m=l.documentElement||{},n=m[h],o=n?h:i,p=Array.prototype.slice,q=/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,r=/mouse.*(wheel|scroll)/i,s=/^text/i,t=/^touch|^gesture/i,u={one:1},v=function(a,b,c){for(c=0;c<b.length;c++)a[b[c]]=1;return a}({},("click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange error abort scroll "+(n?"show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend message readystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ":"")).split(" ")),w=function(){function a(a,b){while((b=b.parentNode)!==null)if(b===a)return!0;return!1}function b(b){var c=b.relatedTarget;return c?c!==this&&c.prefix!=="xul"&&!/document/.test(this.toString())&&!a(this,c):c===null}return{mouseenter:{base:"mouseover",condition:b},mouseleave:{base:"mouseout",condition:b},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),x=function(){var a="altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which".split(" "),b=a.concat("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" ")),c=b.concat("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis".split(" ")),d=a.concat("char charCode key keyCode keyIdentifier keyLocation".split(" ")),f=a.concat(["data"]),g=a.concat("touches targetTouches changedTouches scale rotation".split(" ")),h="preventDefault",i=function(a){return function(){a[h]?a[h]():a.returnValue=!1}},j="stopPropagation",k=function(a){return function(){a[j]?a[j]():a.cancelBubble=!0}},n=function(a){return function(){a[h](),a[j](),a.stopped=!0}},o=function(a,b,c){var d,e;for(d=c.length;d--;)e=c[d],!(e in b)&&e in a&&(b[e]=a[e])};return function(p,u){var v={originalEvent:p,isNative:u};if(!p)return v;var w,x=p.type,y=p.target||p.srcElement;v[h]=i(p),v[j]=k(p),v.stop=n(v),v.target=y&&y.nodeType===3?y.parentNode:y;if(u){if(x.indexOf("key")!==-1)w=d,v.keyCode=p.which||p.keyCode;else if(q.test(x)){w=b,v.rightClick=p.which===3||p.button===2,v.pos={x:0,y:0};if(p.pageX||p.pageY)v.clientX=p.pageX,v.clientY=p.pageY;else if(p.clientX||p.clientY)v.clientX=p.clientX+l.body.scrollLeft+m.scrollLeft,v.clientY=p.clientY+l.body.scrollTop+m.scrollTop;e.test(x)&&(v.relatedTarget=p.relatedTarget||p[(x==="mouseover"?"from":"to")+"Element"])}else t.test(x)?w=g:r.test(x)?w=c:s.test(x)&&(w=f);o(p,v,w||a)}return v}}(),y=function(a,b){return!n&&!b&&(a===l||a===c)?m:a},z=function(){function a(a,b,c,d,e){this.element=a,this.type=b,this.handler=c,this.original=d,this.namespaces=e,this.custom=w[b],this.isNative=v[b]&&a[o],this.eventType=n||this.isNative?b:"propertychange",this.customType=!n&&!this.isNative&&b,this.target=y(a,this.isNative),this.eventSupport=this.target[o]}return a.prototype={inNamespaces:function(a){var b,c;if(!a)return!0;if(!this.namespaces)return!1;for(b=a.length;b--;)for(c=this.namespaces.length;c--;)if(a[b]===this.namespaces[c])return!0;return!1},matches:function(a,b,c){return this.element===a&&(!b||this.original===b)&&(!c||this.handler===c)}},a}(),A=function(){var a={},b=function(c,d,e,f,g){if(!d||d==="*")for(var h in a)h.charAt(0)==="$"&&b(c,h.substr(1),e,f,g);else{var i=0,j,k=a["$"+d],l=c==="*";if(!k)return;for(j=k.length;i<j;i++)if(l||k[i].matches(c,e,f))if(!g(k[i],k,i,d))return}},c=function(b,c,d){var e,f=a["$"+c];if(f)for(e=f.length;e--;)if(f[e].matches(b,d,null))return!0;return!1},d=function(a,c,d){var e=[];return b(a,c,d,null,function(a){return e.push(a)}),e},e=function(b){return(a["$"+b.type]||(a["$"+b.type]=[])).push(b),b},f=function(c){b(c.element,c.type,null,c.handler,function(b,c,d){return c.splice(d,1),c.length===0&&delete a["$"+b.type],!1})},g=function(){var b,c=[];for(b in a)b.charAt(0)==="$"&&(c=c.concat(a[b]));return c};return{has:c,get:d,put:e,del:f,entries:g}}(),B=n?function(a,b,c,d){a[d?h:j](b,c,!1)}:function(a,b,c,d,e){e&&d&&a["_on"+e]===null&&(a["_on"+e]=0),a[d?i:k]("on"+b,c)},C=function(a,b,d){return function(e){return e=x(e||((this.ownerDocument||this.document||this).parentWindow||c).event,!0),b.apply(a,[e].concat(d))}},D=function(a,b,d,e,f,g){return function(h){if(e?e.apply(this,arguments):n?!0:h&&h.propertyName==="_on"+d||!h)h&&(h=x(h||((this.ownerDocument||this.document||this).parentWindow||c).event,g)),b.apply(a,h&&(!f||f.length===0)?arguments:p.call(arguments,h?0:1).concat(f))}},E=function(a,b,c,d,e){return function(){a(b,c,e),d.apply(this,arguments)}},F=function(a,b,c,d){var e,f,h,i=b&&b.replace(g,""),j=A.get(a,i,c);for(e=0,f=j.length;e<f;e++)j[e].inNamespaces(d)&&((h=j[e]).eventSupport&&B(h.target,h.eventType,h.handler,!1,h.type),A.del(h))},G=function(a,b,c,d,e){var h,i=b.replace(g,""),j=b.replace(f,"").split(".");if(A.has(a,i,c))return a;i==="unload"&&(c=E(F,a,i,c,d)),w[i]&&(w[i].condition&&(c=D(a,c,i,w[i].condition,!0)),i=w[i].base||i),h=A.put(new z(a,i,c,d,j[0]&&j)),h.handler=h.isNative?C(a,h.handler,e):D(a,h.handler,i,!1,e,!1),h.eventSupport&&B(h.target,h.eventType,h.handler,!0,h.customType)},H=function(a,b,c){return function(d){var e,f,g=typeof a=="string"?c(a,this):a;for(e=d.target;e&&e!==this;e=e.parentNode)for(f=g.length;f--;)if(g[f]===e)return b.apply(e,arguments)}},I=function(a,b,c){var d,e,h,i,j,k=F,l=b&&typeof b=="string";if(l&&b.indexOf(" ")>0){b=b.split(" ");for(j=b.length;j--;)I(a,b[j],c);return a}h=l&&b.replace(g,""),h&&w[h]&&(h=w[h].type);if(!b||l){if(i=l&&b.replace(f,""))i=i.split(".");k(a,h,c,i)}else if(typeof b=="function")k(a,null,b);else for(d in b)b.hasOwnProperty(d)&&I(a,d,b[d]);return a},J=function(a,b,c,d,e){var f,g,h,i,j=c,k=c&&typeof c=="string";if(b&&!c&&typeof b=="object")for(f in b)b.hasOwnProperty(f)&&J.apply(this,[a,f,b[f]]);else{i=arguments.length>3?p.call(arguments,3):[],g=(k?c:b).split(" "),k&&(c=H(b,j=d,e))&&(i=p.call(i,1)),this===u&&(c=E(I,a,b,c,j));for(h=g.length;h--;)G(a,g[h],c,j,i)}return a},K=function(){return J.apply(u,arguments)},L=n?function(a,b,d){var e=l.createEvent(a?"HTMLEvents":"UIEvents");e[a?"initEvent":"initUIEvent"](b,!0,!0,c,1),d.dispatchEvent(e)}:function(a,b,c){c=y(c,a),a?c.fireEvent("on"+b,l.createEventObject()):c["_on"+b]++},M=function(a,b,c){var d,e,h,i,j,k=b.split(" ");for(d=k.length;d--;){b=k[d].replace(g,"");if(i=k[d].replace(f,""))i=i.split(".");if(!i&&!c&&a[o])L(v[b],b,a);else{j=A.get(a,b),c=[!1].concat(c);for(e=0,h=j.length;e<h;e++)j[e].inNamespaces(i)&&j[e].handler.apply(a,c)}}return a},N=function(a,b,c){var d=0,e=A.get(b,c),f=e.length;for(;d<f;d++)e[d].original&&J(a,e[d].type,e[d].original);return a},O={add:J,one:K,remove:I,clone:N,fire:M,noConflict:function(){return b[a]=d,this}};if(c[i]){var P=function(){var a,b=A.entries();for(a in b)b[a].type&&b[a].type!=="unload"&&I(b[a].element,b[a].type);c[k]("onunload",P),c.CollectGarbage&&c.CollectGarbage()};c[i]("onunload",P)}return O});var html4={};html4.atype={NONE:0,URI:1,URI_FRAGMENT:11,SCRIPT:2,STYLE:3,ID:4,IDREF:5,IDREFS:6,GLOBAL_NAME:7,LOCAL_NAME:8,CLASSES:9,FRAME_TARGET:10},html4.ATTRIBS={"*::class":9,"*::dir":0,"*::id":4,"*::lang":0,"*::onclick":2,"*::ondblclick":2,"*::onkeydown":2,"*::onkeypress":2,"*::onkeyup":2,"*::onload":2,"*::onmousedown":2,"*::onmousemove":2,"*::onmouseout":2,"*::onmouseover":2,"*::onmouseup":2,"*::style":3,"*::title":0,"a::accesskey":0,"a::coords":0,"a::href":1,"a::hreflang":0,"a::name":7,"a::onblur":2,"a::onfocus":2,"a::rel":0,"a::rev":0,"a::shape":0,"a::tabindex":0,"a::target":10,"a::type":0,"area::accesskey":0,"area::alt":0,"area::coords":0,"area::href":1,"area::nohref":0,"area::onblur":2,"area::onfocus":2,"area::shape":0,"area::tabindex":0,"area::target":10,"bdo::dir":0,"blockquote::cite":1,"br::clear":0,"button::accesskey":0,"button::disabled":0,"button::name":8,"button::onblur":2,"button::onfocus":2,"button::tabindex":0,"button::type":0,"button::value":0,"canvas::height":0,"canvas::width":0,"caption::align":0,"col::align":0,"col::char":0,"col::charoff":0,"col::span":0,"col::valign":0,"col::width":0,"colgroup::align":0,"colgroup::char":0,"colgroup::charoff":0,"colgroup::span":0,"colgroup::valign":0,"colgroup::width":0,"del::cite":1,"del::datetime":0,"dir::compact":0,"div::align":0,"dl::compact":0,"font::color":0,"font::face":0,"font::size":0,"form::accept":0,"form::action":1,"form::autocomplete":0,"form::enctype":0,"form::method":0,"form::name":7,"form::onreset":2,"form::onsubmit":2,"form::target":10,"h1::align":0,"h2::align":0,"h3::align":0,"h4::align":0,"h5::align":0,"h6::align":0,"hr::align":0,"hr::noshade":0,"hr::size":0,"hr::width":0,"iframe::align":0,"iframe::frameborder":0,"iframe::height":0,"iframe::marginheight":0,"iframe::marginwidth":0,"iframe::width":0,"img::align":0,"img::alt":0,"img::border":0,"img::height":0,"img::hspace":0,"img::ismap":0,"img::name":7,"img::src":1,"img::usemap":11,"img::vspace":0,"img::width":0,"input::accept":0,"input::accesskey":0,"input::align":0,"input::alt":0,"input::autocomplete":0,"input::checked":0,"input::disabled":0,"input::ismap":0,"input::maxlength":0,"input::name":8,"input::onblur":2,"input::onchange":2,"input::onfocus":2,"input::onselect":2,"input::readonly":0,"input::size":0,"input::src":1,"input::tabindex":0,"input::type":0,"input::usemap":11,"input::value":0,"ins::cite":1,"ins::datetime":0,"label::accesskey":0,"label::for":5,"label::onblur":2,"label::onfocus":2,"legend::accesskey":0,"legend::align":0,"li::type":0,"li::value":0,"map::name":7,"menu::compact":0,"ol::compact":0,"ol::start":0,"ol::type":0,"optgroup::disabled":0,"optgroup::label":0,"option::disabled":0,"option::label":0,"option::selected":0,"option::value":0,"p::align":0,"pre::width":0,"q::cite":1,"select::disabled":0,"select::multiple":0,"select::name":8,"select::onblur":2,"select::onchange":2,"select::onfocus":2,"select::size":0,"select::tabindex":0,"table::align":0,"table::bgcolor":0,"table::border":0,"table::cellpadding":0,"table::cellspacing":0,"table::frame":0,"table::rules":0,"table::summary":0,"table::width":0,"tbody::align":0,"tbody::char":0,"tbody::charoff":0,"tbody::valign":0,"td::abbr":0,"td::align":0,"td::axis":0,"td::bgcolor":0,"td::char":0,"td::charoff":0,"td::colspan":0,"td::headers":6,"td::height":0,"td::nowrap":0,"td::rowspan":0,"td::scope":0,"td::valign":0,"td::width":0,"textarea::accesskey":0,"textarea::cols":0,"textarea::disabled":0,"textarea::name":8,"textarea::onblur":2,"textarea::onchange":2,"textarea::onfocus":2,"textarea::onselect":2,"textarea::readonly":0,"textarea::rows":0,"textarea::tabindex":0,"tfoot::align":0,"tfoot::char":0,"tfoot::charoff":0,"tfoot::valign":0,"th::abbr":0,"th::align":0,"th::axis":0,"th::bgcolor":0,"th::char":0,"th::charoff":0,"th::colspan":0,"th::headers":6,"th::height":0,"th::nowrap":0,"th::rowspan":0,"th::scope":0,"th::valign":0,"th::width":0,"thead::align":0,"thead::char":0,"thead::charoff":0,"thead::valign":0,"tr::align":0,"tr::bgcolor":0,"tr::char":0,"tr::charoff":0,"tr::valign":0,"ul::compact":0,"ul::type":0},html4.eflags={OPTIONAL_ENDTAG:1,EMPTY:2,CDATA:4,RCDATA:8,UNSAFE:16,FOLDABLE:32,SCRIPT:64,STYLE:128},html4.ELEMENTS={a:0,abbr:0,acronym:0,address:0,applet:16,area:2,b:0,base:18,basefont:18,bdo:0,big:0,blockquote:0,body:49,br:2,button:0,canvas:0,caption:0,center:0,cite:0,code:0,col:2,colgroup:1,dd:1,del:0,dfn:0,dir:0,div:0,dl:0,dt:1,em:0,fieldset:0,font:0,form:0,frame:18,frameset:16,h1:0,h2:0,h3:0,h4:0,h5:0,h6:0,head:49,hr:2,html:49,i:0,iframe:4,img:2,input:2,ins:0,isindex:18,kbd:0,label:0,legend:0,li:1,link:18,map:0,menu:0,meta:18,nobr:0,noembed:4,noframes:20,noscript:20,object:16,ol:0,optgroup:0,option:1,p:1,param:18,pre:0,q:0,s:0,samp:0,script:84,select:0,small:0,span:0,strike:0,strong:0,style:148,sub:0,sup:0,table:0,tbody:1,td:1,textarea:8,tfoot:1,th:1,thead:1,title:24,tr:1,tt:0,u:0,ul:0,"var":0},html4.ueffects={NOT_LOADED:0,SAME_DOCUMENT:1,NEW_DOCUMENT:2},html4.URIEFFECTS={"a::href":2,"area::href":2,"blockquote::cite":0,"body::background":1,"del::cite":0,"form::action":2,"img::src":1,"input::src":1,"ins::cite":0,"q::cite":0},html4.ltypes={UNSANDBOXED:2,SANDBOXED:1,DATA:0},html4.LOADERTYPES={"a::href":2,"area::href":2,"blockquote::cite":2,"body::background":1,"del::cite":2,"form::action":2,"img::src":1,"input::src":1,"ins::cite":2,"q::cite":2};var html=function(a){function g(a){a=b(a);if(c.hasOwnProperty(a))return c[a];var d=a.match(e);return d?String.fromCharCode(parseInt(d[1],10)):(d=a.match(f))?String.fromCharCode(parseInt(d[1],16)):""}function h(a,b){return g(b)}function j(a){return a.replace(i,"")}function l(a){return a.replace(k,h)}function s(a){return a.replace(m,"&amp;").replace(o,"&lt;").replace(p,"&gt;").replace(q,"&#34;").replace(r,"&#61;")}function t(a){return a.replace(n,"&amp;$1").replace(o,"&lt;").replace(p,"&gt;")}function w(c){return function d(d,e){d=String(d);var f=null,g=!1,h=[],i=void 0,k=void 0,m=void 0;c.startDoc&&c.startDoc(e);while(d){var n=d.match(g?u:v);d=d.substring(n[0].length);if(g){if(n[1]){var o=b(n[1]),p;if(n[2]){var q=n[3];switch(q.charCodeAt(0)){case 34:case 39:q=q.substring(1,q.length-1)}p=l(j(q))}else p=o;h.push(o,p)}else if(n[4]){k!==void 0&&(m?c.startTag&&c.startTag(i,h,e):c.endTag&&c.endTag(i,e));if(m&&k&(a.eflags.CDATA|a.eflags.RCDATA)){f===null?f=b(d):f=f.substring(f.length-d.length);var r=f.indexOf("</"+i);r<0&&(r=d.length),r&&(k&a.eflags.CDATA?c.cdata&&c.cdata(d.substring(0,r),e):c.rcdata&&c.rcdata(t(d.substring(0,r)),e),d=d.substring(r))}i=k=m=void 0,h.length=0,g=!1}}else if(n[1])c.pcdata&&c.pcdata(n[0],e);else if(n[3])m=!n[2],g=!0,i=b(n[3]),k=a.ELEMENTS.hasOwnProperty(i)?a.ELEMENTS[i]:void 0;else if(n[4])c.pcdata&&c.pcdata(n[4],e);else if(n[5]&&c.pcdata){var s=n[5];c.pcdata(s==="<"?"&lt;":s===">"?"&gt;":"&amp;",e)}}c.endDoc&&c.endDoc(e)}}function x(b){var c,d;return w({startDoc:function(a){c=[],d=!1},startTag:function(e,f,g){if(d)return;if(!a.ELEMENTS.hasOwnProperty(e))return;var h=a.ELEMENTS[e];if(h&a.eflags.FOLDABLE)return;if(h&a.eflags.UNSAFE){d=!(h&a.eflags.EMPTY);return}f=b(e,f);if(f){h&a.eflags.EMPTY||c.push(e),g.push("<",e);for(var i=0,j=f.length;i<j;i+=2){var k=f[i],l=f[i+1];l!==null&&l!==void 0&&g.push(" ",k,'="',s(l),'"')}g.push(">")}},endTag:function(b,e){if(d){d=!1;return}if(!a.ELEMENTS.hasOwnProperty(b))return;var f=a.ELEMENTS[b];if(!(f&(a.eflags.UNSAFE|a.eflags.EMPTY|a.eflags.FOLDABLE))){var g;if(f&a.eflags.OPTIONAL_ENDTAG)for(g=c.length;--g>=0;){var h=c[g];if(h===b)break;if(!(a.ELEMENTS[h]&a.eflags.OPTIONAL_ENDTAG))return}else for(g=c.length;--g>=0;)if(c[g]===b)break;if(g<0)return;for(var i=c.length;--i>g;){var h=c[i];a.ELEMENTS[h]&a.eflags.OPTIONAL_ENDTAG||e.push("</",h,">")}c.length=g,e.push("</",b,">")}},pcdata:function(a,b){d||b.push(a)},rcdata:function(a,b){d||b.push(a)},cdata:function(a,b){d||b.push(a)},endDoc:function(a){for(var b=c.length;--b>=0;)a.push("</",c[b],">");c.length=0}})}function z(b,c,e){var f=[];return x(function g(b,f){for(var g=0;g<f.length;g+=2){var h=f[g],i=f[g+1],j=null,k;if((k=b+"::"+h,a.ATTRIBS.hasOwnProperty(k))||(k="*::"+h,a.ATTRIBS.hasOwnProperty(k)))j=a.ATTRIBS[k];if(j!==null)switch(j){case a.atype.NONE:break;case a.atype.SCRIPT:case a.atype.STYLE:i=null;break;case a.atype.ID:case a.atype.IDREF:case a.atype.IDREFS:case a.atype.GLOBAL_NAME:case a.atype.LOCAL_NAME:case a.atype.CLASSES:i=e?e(i):i;break;case a.atype.URI:var l=(""+i).match(y);l?!l[1]||d.test(l[1])?i=c&&c(i):i=null:i=null;break;case a.atype.URI_FRAGMENT:i&&"#"===i.charAt(0)?(i=e?e(i):i,i&&(i="#"+i)):i=null;break;default:i=null}else i=null;f[g+1]=i}return f})(b,f),f.join("")}var b;"script"==="SCRIPT".toLowerCase()?b=function(a){return a.toLowerCase()}:b=function(a){return a.replace(/[A-Z]/g,function(a){return String.fromCharCode(a.charCodeAt(0)|32)})};var c={lt:"<",gt:">",amp:"&",nbsp:" ",quot:'"',apos:"'"},d=/^(?:https?|mailto|data)$/i,e=/^#(\d+)$/,f=/^#x([0-9A-Fa-f]+)$/,i=/\0/g,k=/&(#\d+|#x[0-9A-Fa-f]+|\w+);/g,m=/&/g,n=/&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi,o=/</g,p=/>/g,q=/\"/g,r=/\=/g,u=new RegExp("^\\s*(?:(?:([a-z][a-z-]*)(\\s*=\\s*(\"[^\"]*\"|'[^']*'|(?=[a-z][a-z-]*\\s*=)|[^>\"'\\s]*))?)|(/?>)|[\\s\\S][^a-z\\s>]*)","i"),v=new RegExp("^(?:&(\\#[0-9]+|\\#[x][0-9a-f]+|\\w+);|<!--[\\s\\S]*?-->|<!\\w[^>]*>|<\\?[^>*]*>|<(/)?([a-z][a-z0-9]*)|([^<&>]+)|([<&>]))","i"),y=new RegExp("^(?:([^:/?#]+):)?");return{escapeAttrib:s,makeHtmlSanitizer:x,makeSaxParser:w,normalizeRCData:t,sanitize:z,unescapeEntities:l}}(html4),html_sanitize=html.sanitize;typeof window!="undefined"&&(window.html=html,window.html_sanitize=html_sanitize),html4.ATTRIBS["*::style"]=0,html4.ELEMENTS.style=0;var Mustache=function(){var a={},b=function(){};return b.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":!0},context:{},render:function(a,b,c,d){d||(this.context=b,this.buffer=[]);if(!this.includes("",a)){if(d)return a;this.send(a);return}a=this.render_pragmas(a);var e=this.render_section(a,b,c);e===!1&&(e=this.render_tags(a,b,c,d));if(d)return e;this.sendLines(e)},send:function(a){a!==""&&this.buffer.push(a)},sendLines:function(a){if(a){var b=a.split("\n");for(var c=0;c<b.length;c++)this.send(b[c])}},render_pragmas:function(a){if(!this.includes("%",a))return a;var b=this,c=this.getCachedRegex("render_pragmas",function(a,b){return new RegExp(a+"%([\\w-]+) ?([\\w]+=[\\w]+)?"+b,"g")});return a.replace(c,function(a,c,d){if(!b.pragmas_implemented[c])throw{message:"This implementation of mustache doesn't understand the '"+c+"' pragma"};b.pragmas[c]={};if(d){var e=d.split("=");b.pragmas[c][e[0]]=e[1]}return""})},render_partial:function(a,b,c){a=this.trim(a);if(!c||c[a]===undefined)throw{message:"unknown_partial '"+a+"'"};return typeof b[a]!="object"?this.render(c[a],b,c,!0):this.render(c[a],b[a],c,!0)},render_section:function(a,b,c){if(!this.includes("#",a)&&!this.includes("^",a))return!1;var d=this,e=this.getCachedRegex("render_section",function(a,b){return new RegExp("^([\\s\\S]*?)"+a+"(\\^|\\#)\\s*(.+)\\s*"+b+"\n*([\\s\\S]*?)"+a+"\\/\\s*\\3\\s*"+b+"\\s*([\\s\\S]*)$","g")});return a.replace(e,function(a,e,f,g,h,i){var j=e?d.render_tags(e,b,c,!0):"",k=i?d.render(i,b,c,!0):"",l,m=d.find(g,b);return f==="^"?!m||d.is_array(m)&&m.length===0?l=d.render(h,b,c,!0):l="":f==="#"&&(d.is_array(m)?l=d.map(m,function(a){return d.render(h,d.create_context(a),c,!0)}).join(""):d.is_object(m)?l=d.render(h,d.create_context(m),c,!0):typeof m=="function"?l=m.call(b,h,function(a){return d.render(a,b,c,!0)}):m?l=d.render(h,b,c,!0):l=""),j+l+k})},render_tags:function(a,b,c,d){var e=this,f=function(){return e.getCachedRegex("render_tags",function(a,b){return new RegExp(a+"(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?"+b+"+","g")})},g=f(),h=function(a,d,h){switch(d){case"!":return"";case"=":return e.set_delimiters(h),g=f(),"";case">":return e.render_partial(h,b,c);case"{":return e.find(h,b);default:return e.escape(e.find(h,b))}},i=a.split("\n");for(var j=0;j<i.length;j++)i[j]=i[j].replace(g,h,this),d||this.send(i[j]);if(d)return i.join("\n")},set_delimiters:function(a){var b=a.split(" ");this.otag=this.escape_regex(b[0]),this.ctag=this.escape_regex(b[1])},escape_regex:function(a){if(!arguments.callee.sRE){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+b.join("|\\")+")","g")}return a.replace(arguments.callee.sRE,"\\$1")},find:function(a,b){function c(a){return a===!1||a===0||a}a=this.trim(a);var d;return c(b[a])?d=b[a]:c(this.context[a])&&(d=this.context[a]),typeof d=="function"?d.apply(b):d!==undefined?d:""},includes:function(a,b){return b.indexOf(this.otag+a)!=-1},escape:function(a){return a=String(a===null?"":a),a.replace(/&(?!\w+;)|["'<>\\]/g,function(a){switch(a){case"&":return"&amp;";case'"':return"&quot;";case"'":return"&#39;";case"<":return"&lt;";case">":return"&gt;";default:return a}})},create_context:function(a){if(this.is_object(a))return a;var b=".";this.pragmas["IMPLICIT-ITERATOR"]&&(b=this.pragmas["IMPLICIT-ITERATOR"].iterator);var c={};return c[b]=a,c},is_object:function(a){return a&&typeof a=="object"},is_array:function(a){return Object.prototype.toString.call(a)==="[object Array]"},trim:function(a){return a.replace(/^\s*|\s*$/g,"")},map:function(a,b){if(typeof a.map=="function")return a.map(b);var c=[],d=a.length;for(var e=0;e<d;e++)c.push(b(a[e]));return c},getCachedRegex:function(b,c){var d=a[this.otag];d||(d=a[this.otag]={});var e=d[this.ctag];e||(e=d[this.ctag]={});var f=e[b];return f||(f=e[b]=c(this.otag,this.ctag)),f}},{name:"mustache.js",version:"0.4.0-dev",to_html:function(a,c,d,e){var f=new b;e&&(f.send=e),f.render(a,c||{},d);if(!e)return f.buffer.join("\n")}}}();!function(context,win){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;if(r)switch(type){case"json":resp=win.JSON?win.JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.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 setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();return d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=handleReadyState(d,b,c),a.before&&a.before(d),d.send(a.data||null),d}var e=doc.createElement("script"),f=0;win[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0,e.onload=e.onreadystatechange=function(){if(e[readyState]&&e[readyState]!=="complete"&&e[readyState]!=="loaded"||f)return!1;e.onload=e.onreadystatechange=null,a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e),f=1},head.appendChild(e)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;return a.url=a.url.substr(0,a.url.length-1)+c,c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",b.crossOrigin||(c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest"),c[contentType]=c[contentType]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}function handleReadyState(a,b,c){return function(){a&&a[readyState]==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",head=doc[byTag]("head")[0],uniqid=0,lastValue,xhr="XMLHttpRequest"in win?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};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"),a[byTag]("select"),a[byTag]("textarea")],c=[],d,e;for(d=0,l=b.length;d<l;++d)for(e=0,l2=b[d].length;e<l2;++e)c.push(serial(b[d][e]));return c.join("").replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=context.reqwest;reqwest.noConflict=function(){return context.reqwest=old,this},typeof module!="undefined"?module.exports=reqwest:context.reqwest=reqwest}(this,window),wax=wax||{},wax.attribution=function(){function c(a){if(/^(https?:\/\/|data:image)/.test(a))return a}function d(a){return a}var a,b={};return b.content=function(b){return typeof b=="undefined"?a.innerHTML:(a.innerHTML=html_sanitize(b,c,d),this)},b.element=function(){return a},b.init=function(){return a=document.createElement("div"),a.className="wax-attribution",this},b.init()},wax=wax||{},wax.bwdetect=function(a,b){function h(){wax.bw=-1;var a=new Image;a.src=e;var b=!0,f=setTimeout(function(){b&&wax.bw==-1&&(c.bw(0),b=!1)},d);a.onload=function(){b&&wax.bw==-1&&(clearTimeout(f),c.bw(1),b=!1)}}var c={},d=a.threshold||400,e="http://a.tiles.mapbox.com/mapbox/1.0.0/blue-marble-topo-bathy-jul/0/0/0.png?preventcache="+ +(new Date),f=1,g=a.auto===undefined?!0:a.auto;return c.bw=function(a){if(!arguments.length)return f;var c=f;wax.bwlisteners&&wax.bwlisteners.length&&function(){listeners=wax.bwlisteners,wax.bwlisteners=[];for(i=0;i<listeners;i++)listeners[i](a)}(),wax.bw=a,f!=(f=a)&&b(a)},c.add=function(){return g&&h(),this},wax.bw==-1?(wax.bwlisteners=wax.bwlisteners||[],wax.bwlisteners.push(c.bw)):wax.bw!==undefined?c.bw(wax.bw):c.add(),c},wax.formatter=function(x){function urlX(a){if(/^(https?:\/\/|data:image)/.test(a))return a}function idX(a){return a}var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};return formatter.format=function(a,b){try{return html_sanitize(f(a,b),urlX,idX)}catch(c){console&&console.log(c)}},formatter},wax.gi=function(a,b){function f(a){return a>=93&&a--,a>=35&&a--,a-=32,a}b=b||{};var c={},d=b.resolution||4,e=b.tileSize||256;return c.grid_tile=function(){return a},c.getKey=function(b,c){if(!a||!a.grid)return;if(c<0||b<0)return;if(Math.floor(c)>=e||Math.floor(b)>=e)return;return f(a.grid[Math.floor(c/d)].charCodeAt(Math.floor(b/d)))},c.gridFeature=function(b,c){var d=this.getKey(b,c),e=a.keys;if(e&&e[d]&&a.data[e[d]])return a.data[e[d]]},c.tileFeature=function(b,c,d){if(!a)return;var e=wax.u.offset(d);return feature=this.gridFeature(b-e.left,c-e.top),feature},c},wax.gm=function(){function f(a){return typeof a=="string"&&(a=[a]),function b(b){if(!b)return;var c=new RegExp("/(\\d+)\\/(\\d+)\\/(\\d+)\\.[\\w\\._]+"),d=c.exec(b);if(!d)return;return a[parseInt(d[2],10)%a.length].replace("{z}",d[1]).replace("{x}",d[2]).replace("{y}",d[3])}}var a=4,b={},c={},d,e=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};return c.formatter=function(a){return arguments.length?(d=wax.formatter(a),c):d},c.template=function(a){return arguments.length?(d=wax.template(a),c):d},c.gridUrl=function(a){return arguments.length?(e=typeof a=="function"?a:f(a),c):e},c.getGrid=function(b,f){var g=e(b);return!d||!g?f(null,null):(wax.request.get(g,function(b,c){if(b)return f(b,null);f(null,wax.gi(c,{formatter:d,resolution:a}))}),c)},c.tilejson=function(b){return b.template?c.template(b.template):b.formatter&&c.formatter(b.formatter),b.grids&&c.gridUrl(b.grids),b.resolution&&(a=b.resolution),c},c},wax=wax||{},wax.hash=function(a){function b(){return location.hash.substring(1)}function c(a){location.hash="#"+a}function g(b){var c=b.split("/");for(var d=0;d<c.length;d++){c[d]=Number(c[d]);if(isNaN(c[d]))return!0}if(c.length<3)return!0;c.length==3&&a.setCenterZoom(c)}function h(){var b=a.getCenterZoom();d!==b&&(d=b,c(d))}function i(a){if(a===d)return;g(d=a)&&h()}a=a||{};var d,e={},f=90-1e-8,j=wax.u.throttle(h,500);return e.add=function(){return i(b()),a.bindChange(j),this},e.remove=function(){return a.unbindChange(j),this},e.add()},wax=wax||{},wax.interaction=function(){function m(a){var b=g();for(var c=0;c<b.length;c++)if(b[c][0]<a.y&&b[c][0]+256>a.y&&b[c][1]<a.x&&b[c][1]+256>a.x)return b[c][2];return!1}function n(){return d?(window.clearTimeout(d),d=null,!0):!1}function o(d){if(c)return;var e=wax.u.eventoffset(d),f=m(e),g;f&&a.getGrid(f.src,function(c,i){if(c||!i)return;g=i.tileFeature(e.x,e.y,f),g?bean.fire(b,"on",{parent:h(),data:g,formatter:a.formatter().format,e:d}):bean.fire(b,"off")})}function p(a){if(n())return;c=!0,e=wax.u.eventoffset(a),a.type==="mousedown"?bean.add(document.body,"mouseup",r):a.type==="touchstart"&&a.touches.length===1&&(bean.fire(b,"off"),bean.add(h(),l))}function q(){bean.remove(h(),l),c=!1}function r(a){var b={},g=wax.u.eventoffset(a);c=!1;for(var i in a)b[i]=a[i];return bean.remove(document.body,"mouseup",r),bean.remove(h(),l),a.type==="touchend"?s(a,e):Math.round(g.y/f)===Math.round(e.y/f)&&Math.round(g.x/f)===Math.round(e.x/f)&&(d=window.setTimeout(function(){d=null,s(b,g)},300)),r}function s(c,d){var e=m(d);e&&a.getGrid(e.src,function(f,g){if(f||!g)return;var i=g.tileFeature(d.x,d.y,e);if(!i)return;bean.fire(b,"on",{parent:h(),data:i,formatter:a.formatter().format,e:c})})}var a=wax.gm(),b={},c=!1,d=!1,e,f=4,g,h,i,j,k={mousemove:o,touchstart:p,mousedown:p},l={touchend:r,touchmove:r,touchcancel:q};return b.attach=function(a){return arguments.length?(attach=a,b):attach},b.map=function(a){return arguments.length?(i=a,attach&&attach(i),bean.add(h(),k),bean.add(h(),"touchstart",p),b):i},b.grid=function(a){return arguments.length?(g=a,b):g},b.remove=function(){for(var a=0;a<clearingEvents.length;a++)i.removeCallback(clearingEvents[a],clearTileGrid);return bean.remove(h(),k),bean.fire(b,"remove"),b},b.tilejson=function(c){return arguments.length?(a.tilejson(c),b):tilejson},b.formatter=function(){return a.formatter()},b.on=function(a,c){return bean.add(b,a,c),b},b.off=function(a,c){return bean.remove(b,a,c),b},b.parent=function(a){return h=a,b},b};var wax=wax||{};wax.legend=function(){function d(a){if(/^(https?:\/\/|data:image)/.test(a))return a}function e(a){return a}var a,b={},c;return b.element=function(){return c},b.content=function(c){return arguments.length?(c?(a.innerHTML=html_sanitize(c,d,e),a.style.display="block"):(a.innerHTML="",a.style.display="none"),b):a.innerHTML},b.add=function(){return c=document.createElement("div"),c.className="wax-legends",a=c.appendChild(document.createElement("div")),a.className="wax-legend",a.style.display="none",b},b.add()};var wax=wax||{};wax.movetip={},wax.movetip=function(){function g(a){var b=wax.u.eventoffset(a);c.height+b.y>d.top+d.height&&d.height>c.height&&(b.y-=c.height,e.className+=" flip-y"),c.width+b.x>d.left+d.width&&(b.x-=c.width,e.className+=" flip-x"),e.style.left=b.x+"px",e.style.top=b.y+"px"}function h(a){var b=document.createElement("div");return b.className="wax-tooltip wax-tooltip-0",b.innerHTML=a,b}function i(){e&&(e.parentNode.removeChild(e),e=null)}function j(b){var j;if(a)return;if(b.e.type==="mousemove"||!b.e.type){j=b.formatter({format:"teaser"},b.data);if(!j)return;i(),f.style.cursor="pointer",e=document.body.appendChild(h(j))}else{j=b.formatter({format:"teaser"},b.data);if(!j)return;i();var k=document.body.appendChild(h(j));k.className+=" wax-popup";var l=k.appendChild(document.createElement("a"));l.href="#close",l.className="close",l.innerHTML="Close",a=!0,e=k,c=wax.u.offset(e),d=wax.u.offset(f),g(b.e),bean.add(l,"click touchend",function(b){b.stop(),i(),a=!1})}e&&(c=wax.u.offset(e),d=wax.u.offset(f),g(b.e))}function k(){f.style.cursor="default",a||i()}var a=!1,b={},c,d,e,f;return b.parent=function(a){return arguments.length?(f=a,b):f},b.events=function(){return{on:j,off:k}},b};var wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(this.locks[a])return;var c=this;this.locks[a]=!0,reqwest({url:a+(~a.indexOf("?")?"&":"?")+"callback=grid",type:"jsonp"
-,jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}},wax.template=function(a){function c(a){if(/^(https?:\/\/|data:image)/.test(a))return a}function d(a){return a}var b={};return b.format=function(b,e){var f={};for(var g in e)f[g]=e[g];return b.format&&(f["__"+b.format+"__"]=!0),html_sanitize(Mustache.to_html(a,f),c,d)},b};if(!wax)var wax={};wax.tilejson=function(a,b){reqwest({url:a+(~a.indexOf("?")?"&":"?")+"callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(){function h(a){var b=document.createElement("div");return b.className="wax-tooltip wax-tooltip-0",b.innerHTML=a,b}function i(){this.parentNode&&this.parentNode.removeChild(this)}function j(){var a;while(a=d.pop())b&&f?(bean.add(a,f,i),a.className+=" wax-fade"):a.parentNode&&a.parentNode.removeChild(a)}function k(b){var c;if((b.e.type==="mousemove"||!b.e.type)&&!a){c=b.formatter({format:"teaser"},b.data);if(!c||c==e)return;j(),g.style.cursor="pointer",d.push(g.appendChild(h(c))),e=c}else{c=b.formatter({format:"full"},b.data);if(!c)return;j(),g.style.cursor="pointer";var f=g.appendChild(h(c));f.className+=" wax-popup";var i=f.appendChild(document.createElement("a"));i.href="#close",i.className="close",i.innerHTML="Close",a=!0,d.push(f),bean.add(i,"click touchend",function(b){b.stop(),j(),a=!1})}}function l(){g.style.cursor="default",e=null,a||j()}var a=!1,b=!1,c={},d=[],e,f,g;return document.body.style["-webkit-transition"]!==undefined?f="webkitTransitionEnd":document.body.style.MozTransition!==undefined&&(f="transitionend"),c.parent=function(a){return arguments.length?(g=a,c):g},c.animate=function(a){return arguments.length?(b=a,c):b},c.events=function(){return{on:k,off:l}},c};var wax=wax||{};wax.u={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=document.body,e=0,f=0,g=function(a){if(a===d||a===document.documentElement)return;e+=a.offsetTop,f+=a.offsetLeft;var b=a.style.transform||a.style.WebkitTransform||a.style.OTransform||a.style.MozTransform||a.style.msTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))e+=parseInt(match[2],10),f+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))e+=parseInt(match[2],10),f+=parseInt(match[1],10);else if(match=b.match(/matrix3d\(([\-\d,\s]+)\)/)){var c=match[1].split(",");e+=parseInt(c[13],10),f+=parseInt(c[12],10)}else if(match=b.match(/matrix\(.+, .+, .+, .+, (.+), (.+)\)/))e+=parseInt(match[2],10),f+=parseInt(match[1],10)};g(a);try{while(a=a.offsetParent)g(a)}catch(h){}e+=d.offsetTop,f+=d.offsetLeft,e+=d.parentNode.offsetTop,f+=d.parentNode.offsetLeft;var i=document.defaultView?window.getComputedStyle(d.parentNode,null):d.parentNode.currentStyle;return d.parentNode.offsetTop!==parseInt(i.marginTop,10)&&!isNaN(parseInt(i.marginTop,10))&&(e+=parseInt(i.marginTop,10),f+=parseInt(i.marginLeft,10)),{top:e,left:f,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;a||(a=window.event);if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}},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 this.limit(a,b,!1)}},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.interaction=function(){function d(){a=!0}function e(){return!a&&b?b:b=function(a){var b=[];for(var c in a)if(a[c]._tiles)for(var d in a[c]._tiles){var e=wax.u.offset(a[c]._tiles[d]);b.push([e.top,e.left,a[c]._tiles[d]])}return b}(c._layers)}function f(a){if(!arguments.length)return c;c=a;var b=["moveend"];for(var e=0;e<b.length;e++)c.on(b[e],d)}var a=!1,b,c;return wax.interaction().attach(f).parent(function(){return c._container}).grid(e)},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.connector=L.TileLayer.extend({initialize:function(a){a=a||{},a.minZoom=a.minzoom||0,a.maxZoom=a.maxzoom||22,L.TileLayer.prototype.initialize.call(this,a.tiles[0],a)}})
View
2 js/wax.leaf.min-6.0.5-touched.js
@@ -0,0 +1,2 @@
+/*wax-6.0.5-touched_vizz*/!function(name,context,definition){if(typeof module!=="undefined"){module.exports=definition(name,context)}else{if(typeof define==="function"&&typeof define.amd==="object"){define(definition)}else{context[name]=definition(name,context)}}}("bean",this,function(name,context){var win=window,old=context[name],overOut=/over|out/,namespaceRegex=/[^\.]*(?=\..*)\.|.*/,nameRegex=/\..*/,addEvent="addEventListener",attachEvent="attachEvent",removeEvent="removeEventListener",detachEvent="detachEvent",doc=document||{},root=doc.documentElement||{},W3C_MODEL=root[addEvent],eventSupport=W3C_MODEL?addEvent:attachEvent,slice=Array.prototype.slice,mouseTypeRegex=/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,mouseWheelTypeRegex=/mouse.*(wheel|scroll)/i,textTypeRegex=/^text/i,touchTypeRegex=/^touch|^gesture/i,ONE={one:1},nativeEvents=(function(hash,events,i){for(i=0;i<events.length;i++){hash[events[i]]=1}return hash})({},("click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange error abort scroll "+(W3C_MODEL?"show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend message readystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ":"")).split(" ")),customEvents=(function(){function isDescendant(parent,node){while((node=node.parentNode)!==null){if(node===parent){return true}}return false}function check(event){var related=event.relatedTarget;if(!related){return related===null}return(related!==this&&related.prefix!=="xul"&&!/document/.test(this.toString())&&!isDescendant(this,related))}return{mouseenter:{base:"mouseover",condition:check},mouseleave:{base:"mouseout",condition:check},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}})(),fixEvent=(function(){var commonProps="altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which".split(" "),mouseProps=commonProps.concat("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" ")),mouseWheelProps=mouseProps.concat("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis".split(" ")),keyProps=commonProps.concat("char charCode key keyCode keyIdentifier keyLocation".split(" ")),textProps=commonProps.concat(["data"]),touchProps=commonProps.concat("touches targetTouches changedTouches scale rotation".split(" ")),preventDefault="preventDefault",createPreventDefault=function(event){return function(){if(event[preventDefault]){event[preventDefault]()}else{event.returnValue=false}}},stopPropagation="stopPropagation",createStopPropagation=function(event){return function(){if(event[stopPropagation]){event[stopPropagation]()}else{event.cancelBubble=true}}},createStop=function(synEvent){return function(){synEvent[preventDefault]();synEvent[stopPropagation]();synEvent.stopped=true}},copyProps=function(event,result,props){var i,p;for(i=props.length;i--;){p=props[i];if(!(p in result)&&p in event){result[p]=event[p]}}};return function(event,isNative){var result={originalEvent:event,isNative:isNative};if(!event){return result}var props,type=event.type,target=event.target||event.srcElement;result[preventDefault]=createPreventDefault(event);result[stopPropagation]=createStopPropagation(event);result.stop=createStop(result);result.target=target&&target.nodeType===3?target.parentNode:target;if(isNative){if(type.indexOf("key")!==-1){props=keyProps;result.keyCode=event.which||event.keyCode}else{if(mouseTypeRegex.test(type)){props=mouseProps;result.rightClick=event.which===3||event.button===2;result.pos={x:0,y:0};if(event.pageX||event.pageY){result.clientX=event.pageX;result.clientY=event.pageY}else{if(event.clientX||event.clientY){result.clientX=event.clientX+doc.body.scrollLeft+root.scrollLeft;result.clientY=event.clientY+doc.body.scrollTop+root.scrollTop}}if(overOut.test(type)){result.relatedTarget=event.relatedTarget||event[(type==="mouseover"?"from":"to")+"Element"]}}else{if(touchTypeRegex.test(type)){props=touchProps}else{if(mouseWheelTypeRegex.test(type)){props=mouseWheelProps}else{if(textTypeRegex.test(type)){props=textProps}}}}}copyProps(event,result,props||commonProps)}return result}})(),targetElement=function(element,isNative){return !W3C_MODEL&&!isNative&&(element===doc||element===win)?root:element},RegEntry=(function(){function entry(element,type,handler,original,namespaces){this.element=element;this.type=type;this.handler=handler;this.original=original;this.namespaces=namespaces;this.custom=customEvents[type];this.isNative=nativeEvents[type]&&element[eventSupport];this.eventType=W3C_MODEL||this.isNative?type:"propertychange";this.customType=!W3C_MODEL&&!this.isNative&&type;this.target=targetElement(element,this.isNative);this.eventSupport=this.target[eventSupport]}entry.prototype={inNamespaces:function(checkNamespaces){var i,j;if(!checkNamespaces){return true}if(!this.namespaces){return false}for(i=checkNamespaces.length;i--;){for(j=this.namespaces.length;j--;){if(checkNamespaces[i]===this.namespaces[j]){return true}}}return false},matches:function(checkElement,checkOriginal,checkHandler){return this.element===checkElement&&(!checkOriginal||this.original===checkOriginal)&&(!checkHandler||this.handler===checkHandler)}};return entry})(),registry=(function(){var map={},forAll=function(element,type,original,handler,fn){if(!type||type==="*"){for(var t in map){if(t.charAt(0)==="$"){forAll(element,t.substr(1),original,handler,fn)}}}else{var i=0,l,list=map["$"+type],all=element==="*";if(!list){return}for(l=list.length;i<l;i++){if(all||list[i].matches(element,original,handler)){if(!fn(list[i],list,i,type)){return}}}}},has=function(element,type,original){var i,list=map["$"+type];if(list){for(i=list.length;i--;){if(list[i].matches(element,original,null)){return true}}}return false},get=function(element,type,original){var entries=[];forAll(element,type,original,null,function(entry){return entries.push(entry)});return entries},put=function(entry){(map["$"+entry.type]||(map["$"+entry.type]=[])).push(entry);return entry},del=function(entry){forAll(entry.element,entry.type,null,entry.handler,function(entry,list,i){list.splice(i,1);if(list.length===0){delete map["$"+entry.type]}return false})},entries=function(){var t,entries=[];for(t in map){if(t.charAt(0)==="$"){entries=entries.concat(map[t])}}return entries};return{has:has,get:get,put:put,del:del,entries:entries}})(),listener=W3C_MODEL?function(element,type,fn,add){element[add?addEvent:removeEvent](type,fn,false)}:function(element,type,fn,add,custom){if(custom&&add&&element["_on"+custom]===null){element["_on"+custom]=0}element[add?attachEvent:detachEvent]("on"+type,fn)},nativeHandler=function(element,fn,args){return function(event){event=fixEvent(event||((this.ownerDocument||this.document||this).parentWindow||win).event,true);return fn.apply(element,[event].concat(args))}},customHandler=function(element,fn,type,condition,args,isNative){return function(event){if(condition?condition.apply(this,arguments):W3C_MODEL?true:event&&event.propertyName==="_on"+type||!event){if(event){event=fixEvent(event||((this.ownerDocument||this.document||this).parentWindow||win).event,isNative)}fn.apply(element,event&&(!args||args.length===0)?arguments:slice.call(arguments,event?0:1).concat(args))}}},once=function(rm,element,type,fn,originalFn){return function(){rm(element,type,originalFn);fn.apply(this,arguments)}},removeListener=function(element,orgType,handler,namespaces){var i,l,entry,type=(orgType&&orgType.replace(nameRegex,"")),handlers=registry.get(element,type,handler);for(i=0,l=handlers.length;i<l;i++){if(handlers[i].inNamespaces(namespaces)){if((entry=handlers[i]).eventSupport){listener(entry.target,entry.eventType,entry.handler,false,entry.type)}registry.del(entry)}}},addListener=function(element,orgType,fn,originalFn,args){var entry,type=orgType.replace(nameRegex,""),namespaces=orgType.replace(namespaceRegex,"").split(".");if(registry.has(element,type,fn)){return element}if(type==="unload"){fn=once(removeListener,element,type,fn,originalFn)}if(customEvents[type]){if(customEvents[type].condition){fn=customHandler(element,fn,type,customEvents[type].condition,true)}type=customEvents[type].base||type}entry=registry.put(new RegEntry(element,type,fn,originalFn,namespaces[0]&&namespaces));entry.handler=entry.isNative?nativeHandler(element,entry.handler,args):customHandler(element,entry.handler,type,false,args,false);if(entry.eventSupport){listener(entry.target,entry.eventType,entry.handler,true,entry.customType)}},del=function(selector,fn,$){return function(e){var target,i,array=typeof selector==="string"?$(selector,this):selector;for(target=e.target;target&&target!==this;target=target.parentNode){for(i=array.length;i--;){if(array[i]===target){return fn.apply(target,arguments)}}}}},remove=function(element,typeSpec,fn){var k,m,type,namespaces,i,rm=removeListener,isString=typeSpec&&typeof typeSpec==="string";if(isString&&typeSpec.indexOf(" ")>0){typeSpec=typeSpec.split(" ");for(i=typeSpec.length;i--;){remove(element,typeSpec[i],fn)}return element}type=isString&&typeSpec.replace(nameRegex,"");if(type&&customEvents[type]){type=customEvents[type].type}if(!typeSpec||isString){if(namespaces=isString&&typeSpec.replace(namespaceRegex,"")){namespaces=namespaces.split(".")}rm(element,type,fn,namespaces)}else{if(typeof typeSpec==="function"){rm(element,null,typeSpec)}else{for(k in typeSpec){if(typeSpec.hasOwnProperty(k)){remove(element,k,typeSpec[k])}}}}return element},add=function(element,events,fn,delfn,$){var type,types,i,args,originalFn=fn,isDel=fn&&typeof fn==="string";if(events&&!fn&&typeof events==="object"){for(type in events){if(events.hasOwnProperty(type)){add.apply(this,[element,type,events[type]])}}}else{args=arguments.length>3?slice.call(arguments,3):[];types=(isDel?fn:events).split(" ");isDel&&(fn=del(events,(originalFn=delfn),$))&&(args=slice.call(args,1));this===ONE&&(fn=once(remove,element,events,fn,originalFn));for(i=types.length;i--;){addListener(element,types[i],fn,originalFn,args)}}return element},one=function(){return add.apply(ONE,arguments)},fireListener=W3C_MODEL?function(isNative,type,element){var evt=doc.createEvent(isNative?"HTMLEvents":"UIEvents");evt[isNative?"initEvent":"initUIEvent"](type,true,true,win,1);element.dispatchEvent(evt)}:function(isNative,type,element){element=targetElement(element,isNative);isNative?element.fireEvent("on"+type,doc.createEventObject()):element["_on"+type]++},fire=function(element,type,args){var i,j,l,names,handlers,types=type.split(" ");for(i=types.length;i--;){type=types[i].replace(nameRegex,"");if(names=types[i].replace(namespaceRegex,"")){names=names.split(".")}if(!names&&!args&&element[eventSupport]){fireListener(nativeEvents[type],type,element)}else{handlers=registry.get(element,type);args=[false].concat(args);for(j=0,l=handlers.length;j<l;j++){if(handlers[j].inNamespaces(names)){handlers[j].handler.apply(element,args)}}}}return element},clone=function(element,from,type){var i=0,handlers=registry.get(from,type),l=handlers.length;for(;i<l;i++){handlers[i].original&&add(element,handlers[i].type,handlers[i].original)}return element},bean={add:add,one:one,remove:remove,clone:clone,fire:fire,noConflict:function(){context[name]=old;return this}};if(win[attachEvent]){var cleanup=function(){var i,entries=registry.entries();for(i in entries){if(entries[i].type&&entries[i].type!=="unload"){remove(entries[i].element,entries[i].type)}}win[detachEvent]("onunload",cleanup);win.CollectGarbage&&win.CollectGarbage()};win[attachEvent]("onunload",cleanup)}return bean});var html4={};html4.atype={NONE:0,URI:1,URI_FRAGMENT:11,SCRIPT:2,STYLE:3,ID:4,IDREF:5,IDREFS:6,GLOBAL_NAME:7,LOCAL_NAME:8,CLASSES:9,FRAME_TARGET:10};html4.ATTRIBS={"*::class":9,"*::dir":0,"*::id":4,"*::lang":0,"*::onclick":2,"*::ondblclick":2,"*::onkeydown":2,"*::onkeypress":2,"*::onkeyup":2,"*::onload":2,"*::onmousedown":2,"*::onmousemove":2,"*::onmouseout":2,"*::onmouseover":2,"*::onmouseup":2,"*::style":3,"*::title":0,"a::accesskey":0,"a::coords":0,"a::href":1,"a::hreflang":0,"a::name":7,"a::onblur":2,"a::onfocus":2,"a::rel":0,"a::rev":0,"a::shape":0,"a::tabindex":0,"a::target":10,"a::type":0,"area::accesskey":0,"area::alt":0,"area::coords":0,"area::href":1,"area::nohref":0,"area::onblur":2,"area::onfocus":2,"area::shape":0,"area::tabindex":0,"area::target":10,"bdo::dir":0,"blockquote::cite":1,"br::clear":0,"button::accesskey":0,"button::disabled":0,"button::name":8,"button::onblur":2,"button::onfocus":2,"button::tabindex":0,"button::type":0,"button::value":0,"canvas::height":0,"canvas::width":0,"caption::align":0,"col::align":0,"col::char":0,"col::charoff":0,"col::span":0,"col::valign":0,"col::width":0,"colgroup::align":0,"colgroup::char":0,"colgroup::charoff":0,"colgroup::span":0,"colgroup::valign":0,"colgroup::width":0,"del::cite":1,"del::datetime":0,"dir::compact":0,"div::align":0,"dl::compact":0,"font::color":0,"font::face":0,"font::size":0,"form::accept":0,"form::action":1,"form::autocomplete":0,"form::enctype":0,"form::method":0,"form::name":7,"form::onreset":2,"form::onsubmit":2,"form::target":10,"h1::align":0,"h2::align":0,"h3::align":0,"h4::align":0,"h5::align":0,"h6::align":0,"hr::align":0,"hr::noshade":0,"hr::size":0,"hr::width":0,"iframe::align":0,"iframe::frameborder":0,"iframe::height":0,"iframe::marginheight":0,"iframe::marginwidth":0,"iframe::width":0,"img::align":0,"img::alt":0,"img::border":0,"img::height":0,"img::hspace":0,"img::ismap":0,"img::name":7,"img::src":1,"img::usemap":11,"img::vspace":0,"img::width":0,"input::accept":0,"input::accesskey":0,"input::align":0,"input::alt":0,"input::autocomplete":0,"input::checked":0,"input::disabled":0,"input::ismap":0,"input::maxlength":0,"input::name":8,"input::onblur":2,"input::onchange":2,"input::onfocus":2,"input::onselect":2,"input::readonly":0,"input::size":0,"input::src":1,"input::tabindex":0,"input::type":0,"input::usemap":11,"input::value":0,"ins::cite":1,"ins::datetime":0,"label::accesskey":0,"label::for":5,"label::onblur":2,"label::onfocus":2,"legend::accesskey":0,"legend::align":0,"li::type":0,"li::value":0,"map::name":7,"menu::compact":0,"ol::compact":0,"ol::start":0,"ol::type":0,"optgroup::disabled":0,"optgroup::label":0,"option::disabled":0,"option::label":0,"option::selected":0,"option::value":0,"p::align":0,"pre::width":0,"q::cite":1,"select::disabled":0,"select::multiple":0,"select::name":8,"select::onblur":2,"select::onchange":2,"select::onfocus":2,"select::size":0,"select::tabindex":0,"table::align":0,"table::bgcolor":0,"table::border":0,"table::cellpadding":0,"table::cellspacing":0,"table::frame":0,"table::rules":0,"table::summary":0,"table::width":0,"tbody::align":0,"tbody::char":0,"tbody::charoff":0,"tbody::valign":0,"td::abbr":0,"td::align":0,"td::axis":0,"td::bgcolor":0,"td::char":0,"td::charoff":0,"td::colspan":0,"td::headers":6,"td::height":0,"td::nowrap":0,"td::rowspan":0,"td::scope":0,"td::valign":0,"td::width":0,"textarea::accesskey":0,"textarea::cols":0,"textarea::disabled":0,"textarea::name":8,"textarea::onblur":2,"textarea::onchange":2,"textarea::onfocus":2,"textarea::onselect":2,"textarea::readonly":0,"textarea::rows":0,"textarea::tabindex":0,"tfoot::align":0,"tfoot::char":0,"tfoot::charoff":0,"tfoot::valign":0,"th::abbr":0,"th::align":0,"th::axis":0,"th::bgcolor":0,"th::char":0,"th::charoff":0,"th::colspan":0,"th::headers":6,"th::height":0,"th::nowrap":0,"th::rowspan":0,"th::scope":0,"th::valign":0,"th::width":0,"thead::align":0,"thead::char":0,"thead::charoff":0,"thead::valign":0,"tr::align":0,"tr::bgcolor":0,"tr::char":0,"tr::charoff":0,"tr::valign":0,"ul::compact":0,"ul::type":0};html4.eflags={OPTIONAL_ENDTAG:1,EMPTY:2,CDATA:4,RCDATA:8,UNSAFE:16,FOLDABLE:32,SCRIPT:64,STYLE:128};html4.ELEMENTS={a:0,abbr:0,acronym:0,address:0,applet:16,area:2,b:0,base:18,basefont:18,bdo:0,big:0,blockquote:0,body:49,br:2,button:0,canvas:0,caption:0,center:0,cite:0,code:0,col:2,colgroup:1,dd:1,del:0,dfn:0,dir:0,div:0,dl:0,dt:1,em:0,fieldset:0,font:0,form:0,frame:18,frameset:16,h1:0,h2:0,h3:0,h4:0,h5:0,h6:0,head:49,hr:2,html:49,i:0,iframe:4,img:2,input:2,ins:0,isindex:18,kbd:0,label:0,legend:0,li:1,link:18,map:0,menu:0,meta:18,nobr:0,noembed:4,noframes:20,noscript:20,object:16,ol:0,optgroup:0,option:1,p:1,param:18,pre:0,q:0,s:0,samp:0,script:84,select:0,small:0,span:0,strike:0,strong:0,style:148,sub:0,sup:0,table:0,tbody:1,td:1,textarea:8,tfoot:1,th:1,thead:1,title:24,tr:1,tt:0,u:0,ul:0,"var":0};html4.ueffects={NOT_LOADED:0,SAME_DOCUMENT:1,NEW_DOCUMENT:2};html4.URIEFFECTS={"a::href":2,"area::href":2,"blockquote::cite":0,"body::background":1,"del::cite":0,"form::action":2,"img::src":1,"input::src":1,"ins::cite":0,"q::cite":0};html4.ltypes={UNSANDBOXED:2,SANDBOXED:1,DATA:0};html4.LOADERTYPES={"a::href":2,"area::href":2,"blockquote::cite":2,"body::background":1,"del::cite":2,"form::action":2,"img::src":1,"input::src":1,"ins::cite":2,"q::cite":2};var html=(function(html4){var lcase;if("script"==="SCRIPT".toLowerCase()){lcase=function(s){return s.toLowerCase()}}else{lcase=function(s){return s.replace(/[A-Z]/g,function(ch){return String.fromCharCode(ch.charCodeAt(0)|32)})}}var ENTITIES={lt:"<",gt:">",amp:"&",nbsp:"\240",quot:'"',apos:"'"};var WHITELISTED_SCHEMES=/^(?:https?|mailto|data)$/i;var decimalEscapeRe=/^#(\d+)$/;var hexEscapeRe=/^#x([0-9A-Fa-f]+)$/;function lookupEntity(name){name=lcase(name);if(ENTITIES.hasOwnProperty(name)){return ENTITIES[name]}var m=name.match(decimalEscapeRe);if(m){return String.fromCharCode(parseInt(m[1],10))}else{if(!!(m=name.match(hexEscapeRe))){return String.fromCharCode(parseInt(m[1],16))}}return""}function decodeOneEntity(_,name){return lookupEntity(name)}var nulRe=/\0/g;function stripNULs(s){return s.replace(nulRe,"")}var entityRe=/&(#\d+|#x[0-9A-Fa-f]+|\w+);/g;function unescapeEntities(s){return s.replace(entityRe,decodeOneEntity)}var ampRe=/&/g;var looseAmpRe=/&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi;var ltRe=/</g;var gtRe=/>/g;var quotRe=/\"/g;var eqRe=/\=/g;function escapeAttrib(s){return s.replace(ampRe,"&amp;").replace(ltRe,"&lt;").replace(gtRe,"&gt;").replace(quotRe,"&#34;").replace(eqRe,"&#61;")}function normalizeRCData(rcdata){return rcdata.replace(looseAmpRe,"&amp;$1").replace(ltRe,"&lt;").replace(gtRe,"&gt;")}var INSIDE_TAG_TOKEN=new RegExp("^\\s*(?:"+("(?:([a-z][a-z-]*)"+("(\\s*=\\s*"+("(\"[^\"]*\"|'[^']*'|(?=[a-z][a-z-]*\\s*=)|[^>\"'\\s]*)")+")")+"?)")+"|(/?>)|[\\s\\S][^a-z\\s>]*)","i");var OUTSIDE_TAG_TOKEN=new RegExp("^(?:&(\\#[0-9]+|\\#[x][0-9a-f]+|\\w+);|<!--[\\s\\S]*?-->|<!\\w[^>]*>|<\\?[^>*]*>|<(/)?([a-z][a-z0-9]*)|([^<&>]+)|([<&>]))","i");function makeSaxParser(handler){return function parse(htmlText,param){htmlText=String(htmlText);var htmlLower=null;var inTag=false;var attribs=[];var tagName=void 0;var eflags=void 0;var openTag=void 0;if(handler.startDoc){handler.startDoc(param)}while(htmlText){var m=htmlText.match(inTag?INSIDE_TAG_TOKEN:OUTSIDE_TAG_TOKEN);htmlText=htmlText.substring(m[0].length);if(inTag){if(m[1]){var attribName=lcase(m[1]);var decodedValue;if(m[2]){var encodedValue=m[3];switch(encodedValue.charCodeAt(0)){case 34:case 39:encodedValue=encodedValue.substring(1,encodedValue.length-1);break}decodedValue=unescapeEntities(stripNULs(encodedValue))}else{decodedValue=attribName}attribs.push(attribName,decodedValue)}else{if(m[4]){if(eflags!==void 0){if(openTag){if(handler.startTag){handler.startTag(tagName,attribs,param)}}else{if(handler.endTag){handler.endTag(tagName,param)}}}if(openTag&&(eflags&(html4.eflags.CDATA|html4.eflags.RCDATA))){if(htmlLower===null){htmlLower=lcase(htmlText)}else{htmlLower=htmlLower.substring(htmlLower.length-htmlText.length)}var dataEnd=htmlLower.indexOf("</"+tagName);if(dataEnd<0){dataEnd=htmlText.length}if(dataEnd){if(eflags&html4.eflags.CDATA){if(handler.cdata){handler.cdata(htmlText.substring(0,dataEnd),param)}}else{if(handler.rcdata){handler.rcdata(normalizeRCData(htmlText.substring(0,dataEnd)),param)}}htmlText=htmlText.substring(dataEnd)}}tagName=eflags=openTag=void 0;attribs.length=0;inTag=false}}}else{if(m[1]){if(handler.pcdata){handler.pcdata(m[0],param)}}else{if(m[3]){openTag=!m[2];inTag=true;tagName=lcase(m[3]);eflags=html4.ELEMENTS.hasOwnProperty(tagName)?html4.ELEMENTS[tagName]:void 0}else{if(m[4]){if(handler.pcdata){handler.pcdata(m[4],param)}}else{if(m[5]){if(handler.pcdata){var ch=m[5];handler.pcdata(ch==="<"?"&lt;":ch===">"?"&gt;":"&amp;",param)}}}}}}}if(handler.endDoc){handler.endDoc(param)}}}function makeHtmlSanitizer(sanitizeAttributes){var stack;var ignoring;return makeSaxParser({startDoc:function(_){stack=[];ignoring=false},startTag:function(tagName,attribs,out){if(ignoring){return}if(!html4.ELEMENTS.hasOwnProperty(tagName)){return}var eflags=html4.ELEMENTS[tagName];if(eflags&html4.eflags.FOLDABLE){return}else{if(eflags&html4.eflags.UNSAFE){ignoring=!(eflags&html4.eflags.EMPTY);return}}attribs=sanitizeAttributes(tagName,attribs);if(attribs){if(!(eflags&html4.eflags.EMPTY)){stack.push(tagName)}out.push("<",tagName);for(var i=0,n=attribs.length;i<n;i+=2){var attribName=attribs[i],value=attribs[i+1];if(value!==null&&value!==void 0){out.push(" ",attribName,'="',escapeAttrib(value),'"')}}out.push(">")}},endTag:function(tagName,out){if(ignoring){ignoring=false;return}if(!html4.ELEMENTS.hasOwnProperty(tagName)){return}var eflags=html4.ELEMENTS[tagName];if(!(eflags&(html4.eflags.UNSAFE|html4.eflags.EMPTY|html4.eflags.FOLDABLE))){var index;if(eflags&html4.eflags.OPTIONAL_ENDTAG){for(index=stack.length;--index>=0;){var stackEl=stack[index];if(stackEl===tagName){break}if(!(html4.ELEMENTS[stackEl]&html4.eflags.OPTIONAL_ENDTAG)){return}}}else{for(index=stack.length;--index>=0;){if(stack[index]===tagName){break}}}if(index<0){return}for(var i=stack.length;--i>index;){var stackEl=stack[i];if(!(html4.ELEMENTS[stackEl]&html4.eflags.OPTIONAL_ENDTAG)){out.push("</",stackEl,">")}}stack.length=index;out.push("</",tagName,">")}},pcdata:function(text,out){if(!ignoring){out.push(text)}},rcdata:function(text,out){if(!ignoring){out.push(text)}},cdata:function(text,out){if(!ignoring){out.push(text)}},endDoc:function(out){for(var i=stack.length;--i>=0;){out.push("</",stack[i],">")}stack.length=0}})}var URI_SCHEME_RE=new RegExp("^(?:([^:/?#]+):)?");function sanitize(htmlText,opt_uriPolicy,opt_nmTokenPolicy){var out=[];makeHtmlSanitizer(function sanitizeAttribs(tagName,attribs){for(var i=0;i<attribs.length;i+=2){var attribName=attribs[i];var value=attribs[i+1];var atype=null,attribKey;if((attribKey=tagName+"::"+attribName,html4.ATTRIBS.hasOwnProperty(attribKey))||(attribKey="*::"+attribName,html4.ATTRIBS.hasOwnProperty(attribKey))){atype=html4.ATTRIBS[attribKey]}if(atype!==null){switch(atype){case html4.atype.NONE:break;case html4.atype.SCRIPT:case html4.atype.STYLE:value=null;break;case html4.atype.ID:case html4.atype.IDREF:case html4.atype.IDREFS:case html4.atype.GLOBAL_NAME:case html4.atype.LOCAL_NAME:case html4.atype.CLASSES:value=opt_nmTokenPolicy?opt_nmTokenPolicy(value):value;break;case html4.atype.URI:var parsedUri=(""+value).match(URI_SCHEME_RE);if(!parsedUri){value=null}else{if(!parsedUri[1]||WHITELISTED_SCHEMES.test(parsedUri[1])){value=opt_uriPolicy&&opt_uriPolicy(value)}else{value=null}}break;case html4.atype.URI_FRAGMENT:if(value&&"#"===value.charAt(0)){value=opt_nmTokenPolicy?opt_nmTokenPolicy(value):value;if(value){value="#"+value}}else{value=null}break;default:value=null;break}}else{value=null}attribs[i+1]=value}return attribs})(htmlText,out);return out.join("")}return{escapeAttrib:escapeAttrib,makeHtmlSanitizer:makeHtmlSanitizer,makeSaxParser:makeSaxParser,normalizeRCData:normalizeRCData,sanitize:sanitize,unescapeEntities:unescapeEntities}})(html4);var html_sanitize=html.sanitize;if(typeof window!=="undefined"){window.html=html;window.html_sanitize=html_sanitize}html4.ATTRIBS["*::style"]=0;html4.ATTRIBS["a::target"]=0;html4.ELEMENTS.style=0;var Mustache=function(){var regexCache={};var Renderer=function(){};Renderer.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(template,context,partials,in_recursion){if(!in_recursion){this.context=context;this.buffer=[]}if(!this.includes("",template)){if(in_recursion){return template}else{this.send(template);return}}template=this.render_pragmas(template);var html=this.render_section(template,context,partials);if(html===false){html=this.render_tags(template,context,partials,in_recursion)}if(in_recursion){return html}else{this.sendLines(html)}},send:function(line){if(line!==""){this.buffer.push(line)}},sendLines:function(text){if(text){var lines=text.split("\n");for(var i=0;i<lines.length;i++){this.send(lines[i])}}},render_pragmas:function(template){if(!this.includes("%",template)){return template}var that=this;var regex=this.getCachedRegex("render_pragmas",function(otag,ctag){return new RegExp(otag+"%([\\w-]+) ?([\\w]+=[\\w]+)?"+ctag,"g")});return template.replace(regex,function(match,pragma,options){if(!that.pragmas_implemented[pragma]){throw ({message:"This implementation of mustache doesn't understand the '"+pragma+"' pragma"})}that.pragmas[pragma]={};if(options){var opts=options.split("=");that.pragmas[pragma][opts[0]]=opts[1]}return""})},render_partial:function(name,context,partials){name=this.trim(name);if(!partials||partials[name]===undefined){throw ({message:"unknown_partial '"+name+"'"})}if(typeof(context[name])!="object"){return this.render(partials[name],context,partials,true)}return this.render(partials[name],context[name],partials,true)},render_section:function(template,context,partials){if(!this.includes("#",template)&&!this.includes("^",template)){return false}var that=this;var regex=this.getCachedRegex("render_section",function(otag,ctag){return new RegExp("^([\\s\\S]*?)"+otag+"(\\^|\\#)\\s*(.+)\\s*"+ctag+"\n*([\\s\\S]*?)"+otag+"\\/\\s*\\3\\s*"+ctag+"\\s*([\\s\\S]*)$","g")});return template.replace(regex,function(match,before,type,name,content,after){var renderedBefore=before?that.render_tags(before,context,partials,true):"",renderedAfter=after?that.render(after,context,partials,true):"",renderedContent,value=that.find(name,context);if(type==="^"){if(!value||that.is_array(value)&&value.length===0){renderedContent=that.render(content,context,partials,true)}else{renderedContent=""}}else{if(type==="#"){if(that.is_array(value)){renderedContent=that.map(value,function(row){return that.render(content,that.create_context(row),partials,true)}).join("")}else{if(that.is_object(value)){renderedContent=that.render(content,that.create_context(value),partials,true)}else{if(typeof value==="function"){renderedContent=value.call(context,content,function(text){return that.render(text,context,partials,true)})}else{if(value){renderedContent=that.render(content,context,partials,true)}else{renderedContent=""}}}}}}return renderedBefore+renderedContent+renderedAfter})},render_tags:function(template,context,partials,in_recursion){var that=this;var new_regex=function(){return that.getCachedRegex("render_tags",function(otag,ctag){return new RegExp(otag+"(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?"+ctag+"+","g")})};var regex=new_regex();var tag_replace_callback=function(match,operator,name){switch(operator){case"!":return"";case"=":that.set_delimiters(name);regex=new_regex();return"";case">":return that.render_partial(name,context,partials);case"{":return that.find(name,context);default:return that.escape(that.find(name,context))}};var lines=template.split("\n");for(var i=0;i<lines.length;i++){lines[i]=lines[i].replace(regex,tag_replace_callback,this);if(!in_recursion){this.send(lines[i])}}if(in_recursion){return lines.join("\n")}},set_delimiters:function(delimiters){var dels=delimiters.split(" ");this.otag=this.escape_regex(dels[0]);this.ctag=this.escape_regex(dels[1])},escape_regex:function(text){if(!arguments.callee.sRE){var specials=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+specials.join("|\\")+")","g")}return text.replace(arguments.callee.sRE,"\\$1")},find:function(name,context){name=this.trim(name);function is_kinda_truthy(bool){return bool===false||bool===0||bool}var value;if(is_kinda_truthy(context[name])){value=context[name]}else{if(is_kinda_truthy(this.context[name])){value=this.context[name]}}if(typeof value==="function"){return value.apply(context)}if(value!==undefined){return value}return""},includes:function(needle,haystack){return haystack.indexOf(this.otag+needle)!=-1},escape:function(s){s=String(s===null?"":s);return s.replace(/&(?!\w+;)|["'<>\\]/g,function(s){switch(s){case"&":return"&amp;";case'"':return"&quot;";case"'":return"&#39;";case"<":return"&lt;";case">":return"&gt;";default:return s}})},create_context:function(_context){if(this.is_object(_context)){return _context}else{var iterator=".";if(this.pragmas["IMPLICIT-ITERATOR"]){iterator=this.pragmas["IMPLICIT-ITERATOR"].iterator}var ctx={};ctx[iterator]=_context;return ctx}},is_object:function(a){return a&&typeof a=="object"},is_array:function(a){return Object.prototype.toString.call(a)==="[object Array]"},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},map:function(array,fn){if(typeof array.map=="function"){return array.map(fn)}else{var r=[];var l=array.length;for(var i=0;i<l;i++){r.push(fn(array[i]))}return r}},getCachedRegex:function(name,generator){var byOtag=regexCache[this.otag];if(!byOtag){byOtag=regexCache[this.otag]={}}var byCtag=byOtag[this.ctag];if(!byCtag){byCtag=byOtag[this.ctag]={}}var regex=byCtag[name];if(!regex){regex=byCtag[name]=generator(this.otag,this.ctag)}return regex}};return({name:"mustache.js",version:"0.4.0-dev",to_html:function(template,view,partials,send_fun){var renderer=new Renderer();if(send_fun){renderer.send=send_fun}renderer.render(template,view||{},partials);if(!send_fun){return renderer.buffer.join("\n")}}})}();
+!function(context,win){function serial(a){var b=a.name;if(a.disabled||!b){return""}b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;if(r){switch(type){case"json":resp=win.JSON?win.JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.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 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 Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=handleReadyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script"),e=0;win[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0,d.onload=d.onreadystatechange=function(){if(d[readyState]&&d[readyState]!=="complete"&&d[readyState]!=="loaded"||e){return !1}d.onload=d.onreadystatechange=null,a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d),e=1},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",b.crossOrigin||(c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest"),c[contentType]=c[contentType]||"application/x-www-form-urlencoded";for(var d in c){c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function handleReadyState(a,b,c){return function(){a&&a[readyState]==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",head=doc[byTag]("head")[0],uniqid=0,lastValue,xhr="XMLHttpRequest" in win?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};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"),a[byTag]("select"),a[byTag]("textarea")],c=[],d,e;for(d=0,l=b.length;d<l;++d){for(e=0,l2=b[d].length;e<l2;++e){c.push(serial(b[d][e]))}}return c.join("").replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++){b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]})}return e};var old=context.reqwest;reqwest.noConflict=function(){context.reqwest=old;return this},typeof module!="undefined"?module.exports=reqwest:context.reqwest=reqwest}(this,window);wax=wax||{};wax.attribution=function(){var container,a={};function urlX(url){if(/^(https?:\/\/|data:image)/.test(url)){return url}}function idX(id){return id}a.content=function(x){if(typeof x==="undefined"){return container.innerHTML}container.innerHTML=html_sanitize(x,urlX,idX);return this};a.element=function(){return container};a.init=function(){container=document.createElement("div");container.className="wax-attribution";return this};return a.init()};wax=wax||{};wax.bwdetect=function(options,callback){var detector={},threshold=options.threshold||400,testImage="http://a.tiles.mapbox.com/mapbox/1.0.0/blue-marble-topo-bathy-jul/0/0/0.png?preventcache="+(+new Date()),bw=1,auto=options.auto===undefined?true:options.auto;function bwTest(){wax.bw=-1;var im=new Image();im.src=testImage;var first=true;var timeout=setTimeout(function(){if(first&&wax.bw==-1){detector.bw(0);first=false}},threshold);im.onload=function(){if(first&&wax.bw==-1){clearTimeout(timeout);detector.bw(1);first=false}}}detector.bw=function(x){if(!arguments.length){return bw}var oldBw=bw;if(wax.bwlisteners&&wax.bwlisteners.length){(function(){listeners=wax.bwlisteners;wax.bwlisteners=[];for(i=0;i<listeners;i++){listeners[i](x)}})()}wax.bw=x;if(bw!=(bw=x)){callback(x)}};detector.add=function(){if(auto){bwTest()}return this};if(wax.bw==-1){wax.bwlisteners=wax.bwlisteners||[];wax.bwlisteners.push(detector.bw)}else{if(wax.bw!==undefined){detector.bw(wax.bw)}else{detector.add()}}return detector};wax.formatter=function(x){var formatter={},f;if(x&&typeof x==="string"){try{eval("f = "+x)}catch(e){if(console){console.log(e)}}}else{if(x&&typeof x==="function"){f=x}else{f=function(){}}}function urlX(url){if(/^(https?:\/\/|data:image)/.test(url)){return url}}function idX(id){return id}formatter.format=function(options,data){try{return html_sanitize(f(options,data),urlX,idX)}catch(e){if(console){console.log(e)}}};return formatter};wax.gi=function(grid_tile,options){options=options||{};var instance={},resolution=options.resolution||4,tileSize=options.tileSize||256;function resolveCode(key){if(key>=93){key--}if(key>=35){key--}key-=32;return key}instance.grid_tile=function(){return grid_tile};instance.getKey=function(x,y){if(!(grid_tile&&grid_tile.grid)){return}if((y<0)||(x<0)){return}if((Math.floor(y)>=tileSize)||(Math.floor(x)>=tileSize)){return}return resolveCode(grid_tile.grid[Math.floor((y)/resolution)].charCodeAt(Math.floor((x)/resolution)))};instance.gridFeature=function(x,y){var key=this.getKey(x,y),keys=grid_tile.keys;if(keys&&keys[key]&&grid_tile.data[keys[key]]){return grid_tile.data[keys[key]]}};instance.tileFeature=function(x,y,tile_element){if(!grid_tile){return}var offset=wax.u.offset(tile_element);feature=this.gridFeature(x-offset.left,y-offset.top);return feature};return instance};wax.gm=function(){var resolution=4,grid_tiles={},manager={},tilejson,formatter;var gridUrl=function(url){return url.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};function templatedGridUrl(template){if(typeof template==="string"){template=[template]}return function templatedGridFinder(url){if(!url){return}var rx=new RegExp("/(\\d+)\\/(\\d+)\\/(\\d+)\\.[\\w\\._]+");var xyz=rx.exec(url);if(!xyz){return}return template[parseInt(xyz[2],10)%template.length].replace(/\{z\}/g,xyz[1]).replace(/\{x\}/g,xyz[2]).replace(/\{y\}/g,xyz[3])}}manager.formatter=function(x){if(!arguments.length){return formatter}formatter=wax.formatter(x);return manager};manager.template=function(x){if(!arguments.length){return formatter}formatter=wax.template(x);return manager};manager.gridUrl=function(x){if(!arguments.length){return gridUrl}gridUrl=typeof x==="function"?x:templatedGridUrl(x);return manager};manager.getGrid=function(url,callback){var gurl=gridUrl(url);if(!formatter||!gurl){return callback(null,null)}wax.request.get(gurl,function(err,t){if(err){return callback(err,null)}callback(null,wax.gi(t,{formatter:formatter,resolution:resolution}))});return manager};manager.tilejson=function(x){if(!arguments.length){return tilejson}if(x.template){manager.template(x.template)}else{if(x.formatter){manager.formatter(x.formatter)}}if(x.grids){manager.gridUrl(x.grids)}if(x.resolution){resolution=x.resolution}tilejson=x;return manager};return manager};wax=wax||{};wax.hash=function(options){options=options||{};function getState(){return location.hash.substring(1)}function pushState(state){var l=window.location;l.replace(l.toString().replace(l.hash,"#"+state))}var s0,hash={},lat=90-1e-8;function parseHash(s){var args=s.split("/");for(var i=0;i<args.length;i++){args[i]=Number(args[i]);if(isNaN(args[i])){return true}}if(args.length<3){return true}else{if(args.length==3){options.setCenterZoom(args)}}}function move(){var s1=options.getCenterZoom();if(s0!==s1){s0=s1;pushState(s0)}}function stateChange(state){if(state===s0){return}if(parseHash(s0=state)){move()}}var _move=wax.u.throttle(move,500);hash.add=function(){stateChange(getState());options.bindChange(_move);return this};hash.remove=function(){options.unbindChange(_move);return this};return hash.add()};wax=wax||{};wax.interaction=function(){var gm=wax.gm(),interaction={},_downLock=false,_clickTimeout=false,_d,tol=4,grid,attach,detach,parent,map,tileGrid;var defaultEvents={mousemove:onMove,touchstart:onDown,mousedown:onDown};var touchEnds={touchend:onUp,touchmove:onUp,touchcancel:touchCancel};function getTile(e){var g=grid();for(var i=0;i<g.length;i++){if((g[i][0]<e.y)&&((g[i][0]+256)>e.y)&&(g[i][1]<e.x)&&((g[i][1]+256)>e.x)){return g[i][2]}}return false}function killTimeout(){if(_clickTimeout){window.clearTimeout(_clickTimeout);_clickTimeout=null;return true}else{return false}}function onMove(e){if(_downLock){return}var pos=wax.u.eventoffset(e);interaction.screen_feature(pos,function(feature){if(feature){bean.fire(interaction,"on",{parent:parent(),data:feature,formatter:gm.formatter().format,pos:pos,e:e})}else{bean.fire(interaction,"off")}})}function onDown(e){if(killTimeout()){return}_downLock=true;_d=wax.u.eventoffset(e);if(e.type==="mousedown"){bean.add(document.body,"click",onUp)}else{if(e.type==="touchstart"&&e.touches.length===1){bean.fire(interaction,"off");bean.add(parent(),touchEnds)}}}function touchCancel(){bean.remove(parent(),touchEnds);_downLock=false}function onUp(e){var evt={},pos=wax.u.eventoffset(e);_downLock=false;for(var key in e){evt[key]=e[key]}bean.remove(document.body,"mouseup",onUp);bean.remove(parent(),touchEnds);if(e.type==="touchend"){interaction.click(e,_d)}else{if(Math.round(pos.y/tol)===Math.round(_d.y/tol)&&Math.round(pos.x/tol)===Math.round(_d.x/tol)){_clickTimeout=window.setTimeout(function(){_clickTimeout=null;interaction.click(evt,pos)},300)}}return onUp}interaction.click=function(e,pos){interaction.screen_feature(pos,function(feature){if(feature){bean.fire(interaction,"on",{parent:parent(),data:feature,formatter:gm.formatter().format,pos:pos,e:e})}})};interaction.screen_feature=function(pos,callback){var tile=getTile(pos);if(!tile){callback(null)}gm.getGrid(tile.src,function(err,g){if(err||!g){return callback(null)}var feature=g.tileFeature(pos.x,pos.y,tile);callback(feature)})};interaction.attach=function(x){if(!arguments.length){return attach}attach=x;return interaction};interaction.detach=function(x){if(!arguments.length){return detach}detach=x;return interaction};interaction.map=function(x){if(!arguments.length){return map}map=x;if(attach){attach(map)}bean.add(parent(),defaultEvents);bean.add(parent(),"touchstart",onDown);return interaction};interaction.grid=function(x){if(!arguments.length){return grid}grid=x;return interaction};interaction.remove=function(x){if(detach){detach(map)}bean.remove(parent(),defaultEvents);bean.fire(interaction,"remove");return interaction};interaction.tilejson=function(x){if(!arguments.length){return gm.tilejson()}gm.tilejson(x);return interaction};interaction.formatter=function(){return gm.formatter()};interaction.on=function(ev,fn){bean.add(interaction,ev,fn);return interaction};interaction.off=function(ev,fn){bean.remove(interaction,ev,fn);return interaction};interaction.gridmanager=function(x){if(!arguments.length){return gm}gm=x;return interaction};interaction.parent=function(x){parent=x;return interaction};return interaction};var wax=wax||{};wax.legend=function(){var element,legend={},container;function urlX(url){if(/^(https?:\/\/|data:image)/.test(url)){return url}}function idX(id){return id}legend.element=function(){return container};legend.content=function(content){if(!arguments.length){return element.innerHTML}if(content){element.innerHTML=html_sanitize(content,urlX,idX);element.style.display="block"}else{element.innerHTML="";element.style.display="none"}return legend};legend.add=function(){container=document.createElement("div");container.className="wax-legends";element=container.appendChild(document.createElement("div"));element.className="wax-legend";element.style.display="none";return legend};return legend.add()};var wax=wax||{};wax.movetip={};wax.movetip=function(){var popped=false,t={},_tooltipOffset,_contextOffset,tooltip,parent;function moveTooltip(e){var eo=wax.u.eventoffset(e);if((_tooltipOffset.height+eo.y)>(_contextOffset.top+_contextOffset.height)&&(_contextOffset.height>_tooltipOffset.height)){eo.y-=_tooltipOffset.height;tooltip.className+=" flip-y"}if((_tooltipOffset.width+eo.x)>(_contextOffset.left+_contextOffset.width)){eo.x-=_tooltipOffset.width;tooltip.className+=" flip-x"}tooltip.style.left=eo.x+"px";tooltip.style.top=eo.y+"px"}function getTooltip(feature){var tooltip=document.createElement("div");tooltip.className="wax-tooltip wax-tooltip-0";tooltip.innerHTML=feature;return tooltip}function hide(){if(tooltip){tooltip.parentNode.removeChild(tooltip);tooltip=null}}function on(o){var content;if(popped){return}if((o.e.type==="mousemove"||!o.e.type)){content=o.formatter({format:"teaser"},o.data);if(!content){return}hide();parent.style.cursor="pointer";tooltip=document.body.appendChild(getTooltip(content))}else{content=o.formatter({format:"teaser"},o.data);if(!content){return}hide();var tt=document.body.appendChild(getTooltip(content));tt.className+=" wax-popup";var close=tt.appendChild(document.createElement("a"));close.href="#close";close.className="close";close.innerHTML="Close";popped=true;tooltip=tt;_tooltipOffset=wax.u.offset(tooltip);_contextOffset=wax.u.offset(parent);moveTooltip(o.e);bean.add(close,"click touchend",function closeClick(e){e.stop();hide();popped=false})}if(tooltip){_tooltipOffset=wax.u.offset(tooltip);_contextOffset=wax.u.offset(parent);moveTooltip(o.e)}}function off(){parent.style.cursor="default";if(!popped){hide()}}t.parent=function(x){if(!arguments.length){return parent}parent=x;return t};t.events=function(){return{on:on,off:off}};return t};var wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(url,callback){if(this.cache[url]){return callback(this.cache[url][0],this.cache[url][1])}else{this.promises[url]=this.promises[url]||[];this.promises[url].push(callback);if(this.locks[url]){return}var that=this;this.locks[url]=true;reqwest({url:url+(~url.indexOf("?")?"&":"?")+"callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(data){that.locks[url]=false;that.cache[url]=[null,data];for(var i=0;i<that.promises[url].length;i++){that.promises[url][i](that.cache[url][0],that.cache[url][1])}},error:function(err){that.locks[url]=false;that.cache[url]=[err,null];for(var i=0;i<that.promises[url].length;i++){that.promises[url][i](that.cache[url][0],that.cache[url][1])}}})}}};wax.template=function(x){var template={};function urlX(url){if(/^(https?:\/\/|data:image)/.test(url)){return url}}function idX(id){return id}template.format=function(options,data){var clone={};for(var key in data){clone[key]=data[key]}if(options.format){clone["__"+options.format+"__"]=true}return html_sanitize(Mustache.to_html(x,clone),urlX,idX)};return template};if(!wax){var wax={}}wax.tilejson=function(url,callback){reqwest({url:url+(~url.indexOf("?")?"&":"?")+"callback=grid",type:"jsonp",jsonpCallback:"callback",success:callback,error:callback})};var wax=wax||{};wax.tooltip={};wax.tooltip=function(){var popped=false,animate=false,t={},tooltips=[],_currentContent,transitionEvent,parent;if(document.body.style["-webkit-transition"]!==undefined){transitionEvent="webkitTransitionEnd"}else{if(document.body.style.MozTransition!==undefined){transitionEvent="transitionend"}}function getTooltip(feature){var tooltip=document.createElement("div");tooltip.className="wax-tooltip wax-tooltip-0";tooltip.innerHTML=feature;return tooltip}function remove(){if(this.parentNode){this.parentNode.removeChild(this)}}function hide(){var _ct;while(_ct=tooltips.pop()){if(animate&&transitionEvent){bean.add(_ct,transitionEvent,remove);_ct.className+=" wax-fade"}else{if(_ct.parentNode){_ct.parentNode.removeChild(_ct)}}}}function on(o){var content;if(o.e.type==="mousemove"||!o.e.type){if(!popped){content=o.content||o.formatter({format:"teaser"},o.data);if(!content||content==_currentContent){return}hide();parent.style.cursor="pointer";tooltips.push(parent.appendChild(getTooltip(content)));_currentContent=content}}else{content=o.content||o.formatter({format:"full"},o.data);if(!content){if(o.e.type&&o.e.type.match(/touch/)){content=o.content||o.formatter({format:"teaser"},o.data)}if(!content){return}}hide();parent.style.cursor="pointer";var tt=parent.appendChild(getTooltip(content));tt.className+=" wax-popup";var close=tt.appendChild(document.createElement("a"));close.href="#close";close.className="close";close.innerHTML="Close";popped=true;tooltips.push(tt);bean.add(close,"click touchend",function closeClick(e){e.stop();hide();popped=false})}}function off(){parent.style.cursor="default";_currentContent=null;if(!popped){hide()}}t.parent=function(x){if(!arguments.length){return parent}parent=x;return t};t.animate=function(x){if(!arguments.length){return animate}animate=x;return t};t.events=function(){return{on:on,off:off}};return t};var wax=wax||{};wax.u={offset:function(el){var width=el.offsetWidth||parseInt(el.style.width,10),height=el.offsetHeight||parseInt(el.style.height,10),doc_body=document.body,top=0,left=0;var calculateOffset=function(el){if(el===doc_body||el===document.documentElement){return}top+=el.offsetTop;left+=el.offsetLeft;var style=el.style.transform||el.style.WebkitTransform||el.style.OTransform||el.style.MozTransform||el.style.msTransform;if(style){if(match=style.match(/translate\((.+)px, (.+)px\)/)){top+=parseInt(match[2],10);left+=parseInt(match[1],10)}else{if(match=style.match(/translate3d\((.+)px, (.+)px, (.+)px\)/)){top+=parseInt(match[2],10);left+=parseInt(match[1],10)}else{if(match=style.match(/matrix3d\(([\-\d,\s]+)\)/)){var pts=match[1].split(",");top+=parseInt(pts[13],10);left+=parseInt(pts[12],10)}else{if(match=style.match(/matrix\(.+, .+, .+, .+, (.+), (.+)\)/)){top+=parseInt(match[2],10);left+=parseInt(match[1],10)}}}}}};calculateOffset(el);try{while(el=el.offsetParent){calculateOffset(el)}}catch(e){}top+=doc_body.offsetTop;left+=doc_body.offsetLeft;top+=doc_body.parentNode.offsetTop;left+=doc_body.parentNode.offsetLeft;var htmlComputed=document.defaultView?window.getComputedStyle(doc_body.parentNode,null):doc_body.parentNode.currentStyle;if(doc_body.parentNode.offsetTop!==parseInt(htmlComputed.marginTop,10)&&!isNaN(parseInt(htmlComputed.marginTop,10))){top+=parseInt(htmlComputed.marginTop,10);left+=parseInt(htmlComputed.marginLeft,10)}return{top:top,left:left,height:height,width:width}},"$":function(x){return(typeof x==="string")?document.getElementById(x):x},indexOf:function(array,item){var nativeIndexOf=Array.prototype.indexOf;if(array===null){return -1}var i,l;if(nativeIndexOf&&array.indexOf===nativeIndexOf){return array.indexOf(item)}for(i=0,l=array.length;i<l;i++){if(array[i]===item){return i}}return -1},eventoffset:function(e){var posx=0;var posy=0;if(!e){e=window.event}if(e.pageX||e.pageY){return{x:e.pageX,y:e.pageY}}else{if(e.clientX||e.clientY){var doc=document.documentElement,body=document.body;var htmlComputed=document.body.parentNode.currentStyle;var topMargin=parseInt(htmlComputed.marginTop,10)||0;var leftMargin=parseInt(htmlComputed.marginLeft,10)||0;return{x:e.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0)+leftMargin,y:e.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0)+topMargin}}else{if(e.touches&&e.touches.length===1){return{x:e.touches[0].pageX,y:e.touches[0].pageY}}}}},limit:function(func,wait,debounce){var timeout;return function(){var context=this,args=arguments;var throttler=function(){timeout=null;func.apply(context,args)};if(debounce){clearTimeout(timeout)}if(debounce||!timeout){timeout=setTimeout(throttler,wait)}}},throttle:function(func,wait){return this.limit(func,wait,false)}};wax=wax||{};wax.leaf=wax.leaf||{};wax.leaf.interaction=function(){var dirty=false,_grid,map;function setdirty(){dirty=true}function grid(){if(!dirty&&_grid){return _grid}else{return(_grid=(function(layers){var o=[];for(var layerId in layers){if(layers[layerId]._tiles){for(var tile in layers[layerId]._tiles){var offset=wax.u.offset(layers[layerId]._tiles[tile]);o.push([offset.top,offset.left,layers[layerId]._tiles[tile]])}}}return o})(map._layers))}}function attach(x){if(!arguments.length){return map}map=x;var l=["moveend"];for(var i=0;i<l.length;i++){map.on(l[i],setdirty)}}function detach(x){if(!arguments.length){return map}map=x;var l=["moveend"];for(var i=0;i<l.length;i++){map.off(l[i],setdirty)}}return wax.interaction().attach(attach).detach(detach).parent(function(){return map._container}).grid(grid)};wax=wax||{};wax.leaf=wax.leaf||{};wax.leaf.connector=L.TileLayer.extend({initialize:function(options){options=options||{};options.minZoom=options.minzoom||0;options.maxZoom=options.maxzoom||22;L.TileLayer.prototype.initialize.call(this,options.tiles[0],options)}});

0 comments on commit 38a8733

Please sign in to comment.
Something went wrong with that request. Please try again.