/usr/share/javascript/wax/wax.ol.min.js is in libjs-wax 5.0.1+ds2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* wax.js - 5.0.1 */// Copyright (C) 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview
* Whitelists of HTML elements and attributes.
*
* @author mikesamuel@gmail.com
*//** @namespace */var html4={};html4.eflags={OPTIONAL_ENDTAG:1,BREAKS_FLOW:2,EMPTY:4,NAVIGATES:8,CDATA:16,RCDATA:32,UNSAFE:64,FOLDABLE:128},html4.atype={SCRIPT:1,STYLE:2,IDREF:3,NAME:4,NMTOKENS:5,URI:6,FRAME:7},html4.ELEMENTS={a:html4.eflags.NAVIGATES,abbr:0,acronym:0,address:0,applet:html4.eflags.UNSAFE,area:html4.eflags.EMPTY|html4.eflags.NAVIGATES,b:0,base:html4.eflags.UNSAFE|html4.eflags.EMPTY,basefont:html4.eflags.UNSAFE|html4.eflags.EMPTY,bdo:0,big:0,blockquote:html4.eflags.BREAKS_FLOW,body:html4.eflags.FOLDABLE|html4.eflags.OPTIONAL_ENDTAG|html4.eflags.UNSAFE,br:html4.eflags.EMPTY|html4.eflags.BREAKS_FLOW,button:0,caption:0,center:html4.eflags.BREAKS_FLOW,cite:0,code:0,col:html4.eflags.EMPTY,colgroup:html4.eflags.OPTIONAL_ENDTAG,dd:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,del:0,dfn:0,dir:html4.eflags.BREAKS_FLOW,div:html4.eflags.BREAKS_FLOW,dl:html4.eflags.BREAKS_FLOW,dt:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,em:0,fieldset:0,font:0,form:html4.eflags.BREAKS_FLOW|html4.eflags.NAVIGATES,frame:html4.eflags.UNSAFE|html4.eflags.EMPTY,frameset:html4.eflags.UNSAFE,h1:html4.eflags.BREAKS_FLOW,h2:html4.eflags.BREAKS_FLOW,h3:html4.eflags.BREAKS_FLOW,h4:html4.eflags.BREAKS_FLOW,h5:html4.eflags.BREAKS_FLOW,h6:html4.eflags.BREAKS_FLOW,head:html4.eflags.FOLDABLE|html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW|html4.eflags.UNSAFE,hr:html4.eflags.EMPTY|html4.eflags.BREAKS_FLOW,html:html4.eflags.FOLDABLE|html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW|html4.eflags.UNSAFE,i:0,iframe:html4.eflags.UNSAFE,img:html4.eflags.EMPTY,input:html4.eflags.EMPTY,ins:0,isindex:html4.eflags.UNSAFE|html4.eflags.EMPTY|html4.eflags.BREAKS_FLOW|html4.eflags.NAVIGATES,kbd:0,label:0,legend:0,li:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,link:html4.eflags.UNSAFE|html4.eflags.EMPTY,map:0,menu:html4.eflags.BREAKS_FLOW,meta:html4.eflags.UNSAFE|html4.eflags.EMPTY,noframes:html4.eflags.UNSAFE|html4.eflags.BREAKS_FLOW,noscript:html4.eflags.UNSAFE,object:html4.eflags.UNSAFE,ol:html4.eflags.BREAKS_FLOW,optgroup:0,option:html4.eflags.OPTIONAL_ENDTAG,p:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,param:html4.eflags.UNSAFE|html4.eflags.EMPTY,plaintext:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.UNSAFE|html4.eflags.CDATA,pre:html4.eflags.BREAKS_FLOW,q:0,s:0,samp:0,script:html4.eflags.UNSAFE|html4.eflags.CDATA,select:0,small:0,span:0,strike:0,strong:0,style:html4.eflags.UNSAFE|html4.eflags.CDATA,sub:0,sup:0,table:html4.eflags.BREAKS_FLOW,tbody:html4.eflags.OPTIONAL_ENDTAG,td:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,textarea:html4.eflags.RCDATA,tfoot:html4.eflags.OPTIONAL_ENDTAG,th:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,thead:html4.eflags.OPTIONAL_ENDTAG,title:html4.eflags.UNSAFE|html4.eflags.BREAKS_FLOW|html4.eflags.RCDATA,tr:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,tt:0,u:0,ul:html4.eflags.BREAKS_FLOW,"var":0,xmp:html4.eflags.CDATA},html4.ATTRIBS={abbr:0,accept:0,"accept-charset":0,action:html4.atype.URI,align:0,alink:0,alt:0,archive:html4.atype.URI,axis:0,background:html4.atype.URI,bgcolor:0,border:0,cellpadding:0,cellspacing:0,"char":0,charoff:0,charset:0,checked:0,cite:html4.atype.URI,"class":html4.atype.NMTOKENS,classid:html4.atype.URI,clear:0,code:0,codebase:html4.atype.URI,codetype:0,color:0,cols:0,colspan:0,compact:0,content:0,coords:0,data:html4.atype.URI,datetime:0,declare:0,defer:0,dir:0,disabled:0,enctype:0,face:0,"for":html4.atype.IDREF,frame:0,frameborder:0,headers:0,height:0,href:html4.atype.URI,hreflang:0,hspace:0,id:html4.atype.IDREF,ismap:0,label:0,lang:0,language:0,link:0,longdesc:html4.atype.URI,marginheight:0,marginwidth:0,maxlength:0,media:0,method:0,multiple:0,name:html4.atype.NAME,nohref:0,noresize:0,noshade:0,nowrap:0,object:0,onblur:html4.atype.SCRIPT,onchange:html4.atype.SCRIPT,onclick:html4.atype.SCRIPT,ondblclick:html4.atype.SCRIPT,onfocus:html4.atype.SCRIPT,onkeydown:html4.atype.SCRIPT,onkeypress:html4.atype.SCRIPT,onkeyup:html4.atype.SCRIPT,onload:html4.atype.SCRIPT,onmousedown:html4.atype.SCRIPT,onmousemove:html4.atype.SCRIPT,onmouseout:html4.atype.SCRIPT,onmouseover:html4.atype.SCRIPT,onmouseup:html4.atype.SCRIPT,onreset:html4.atype.SCRIPT,onselect:html4.atype.SCRIPT,onsubmit:html4.atype.SCRIPT,onunload:html4.atype.SCRIPT,profile:html4.atype.URI,prompt:0,readonly:0,rel:0,rev:0,rows:0,rowspan:0,rules:0,scheme:0,scope:0,scrolling:0,selected:0,shape:0,size:0,span:0,src:html4.atype.URI,standby:0,start:0,style:html4.atype.STYLE,summary:0,tabindex:0,target:html4.atype.FRAME,text:0,title:0,type:0,usemap:html4.atype.URI,valign:0,value:0,valuetype:0,version:0,vlink:0,vspace:0,width:0};if("I".toLowerCase()!=="i")throw"I/i problem";var html=function(a){function h(a){a=a.toLowerCase();if(e.hasOwnProperty(a))return e[a];var b=a.match(f);return b?String.fromCharCode(parseInt(b[1],10)):(b=a.match(g))?String.fromCharCode(parseInt(b[1],16)):""}function i(a,b){return h(b)}function k(a){return a.replace(j,"")}function n(a){return a.replace(l,i)}function t(a){return(""+a).replace(o,"&").replace(q,"<").replace(r,">").replace(s,""")}function u(a){return a.replace(p,"&$1").replace(q,"<").replace(r,">")}function y(a){var b={cdata:a.cdata||a.cdata,comment:a.comment||a.comment,endDoc:a.endDoc||a.endDoc,endTag:a.endTag||a.endTag,pcdata:a.pcdata||a.pcdata,rcdata:a.rcdata||a.rcdata,startDoc:a.startDoc||a.startDoc,startTag:a.startTag||a.startTag};return function(a,c){return A(a,b,c)}}function A(a,b,c){var d,e,f,g=D(a),h={noMoreGT:!1,noMoreEndComments:!1};C(b,g,0,h,c)}function B(a,b,c,d,e){return function(){C(a,b,c,d,e)}}function C(b,c,d,e,f){try{b.startDoc&&d==0&&b.startDoc(f);var g,h,i;for(var j=d,k=c.length;j<k;){var l=c[j++],n=c[j];switch(l){case"&":m.test(n)?(b.pcdata&&b.pcdata("&"+n,f,z,B(b,c,j,e,f)),j++):b.pcdata&&b.pcdata("&",f,z,B(b,c,j,e,f));break;case"</":(g=/^([\w:]+)[^\'\"]*/.exec(n))?g[0].length===n.length&&c[j+1]===">"?(j+=2,i=g[1].toLowerCase(),b.endTag&&b.endTag(i,f,z,B(b,c,j,e,f))):j=E(c,j,b,f,z,e):b.pcdata&&b.pcdata("</",f,z,B(b,c,j,e,f));break;case"<":if(g=/^([\w:]+)\s*\/?/.exec(n))if(g[0].length===n.length&&c[j+1]===">"){j+=2,i=g[1].toLowerCase(),b.startTag&&b.startTag(i,[],f,z,B(b,c,j,e,f));var o=a.ELEMENTS[i];if(o&x){var p={name:i,next:j,eflags:o};j=H(c,p,b,f,z,e)}}else j=F(c,j,b,f,z,e);else b.pcdata&&b.pcdata("<",f,z,B(b,c,j,e,f));break;case"<!--":if(!e.noMoreEndComments){for(h=j+1;h<k;h++)if(c[h]===">"&&/--$/.test(c[h-1]))break;if(h<k){if(b.comment){var q=c.slice(j,h).join("");b.comment(q.substr(0,q.length-2),f,z,B(b,c,h+1,e,f))}j=h+1}else e.noMoreEndComments=!0}e.noMoreEndComments&&b.pcdata&&b.pcdata("<!--",f,z,B(b,c,j,e,f));break;case"<!":if(!/^\w/.test(n))b.pcdata&&b.pcdata("<!",f,z,B(b,c,j,e,f));else{if(!e.noMoreGT){for(h=j+1;h<k;h++)if(c[h]===">")break;h<k?j=h+1:e.noMoreGT=!0}e.noMoreGT&&b.pcdata&&b.pcdata("<!",f,z,B(b,c,j,e,f))}break;case"<?":if(!e.noMoreGT){for(h=j+1;h<k;h++)if(c[h]===">")break;h<k?j=h+1:e.noMoreGT=!0}e.noMoreGT&&b.pcdata&&b.pcdata("<?",f,z,B(b,c,j,e,f));break;case">":b.pcdata&&b.pcdata(">",f,z,B(b,c,j,e,f));break;case"":break;default:b.pcdata&&b.pcdata(l,f,z,B(b,c,j,e,f))}}b.endDoc&&b.endDoc(f)}catch(r){if(r!==z)throw r}}function D(a){var b=/(<\/|<\!--|<[!?]|[&<>])/g;a+="";if(w)return a.split(b);var c=[],d=0,e;while((e=b.exec(a))!==null)c.push(a.substring(d,e.index)),c.push(e[0]),d=e.index+e[0].length;return c.push(a.substring(d)),c}function E(a,b,c,d,e,f){var g=I(a,b);return g?(c.endTag&&c.endTag(g.name,d,e,B(c,a,b,f,d)),g.next):a.length}function F(a,b,c,d,e,f){var g=I(a,b);return g?(c.startTag&&c.startTag(g.name,g.attrs,d,e,B(c,a,g.next,f,d)),g.eflags&x?H(a,g,c,d,e,f):g.next):a.length}function H(b,c,d,e,f,g){var h=b.length;G.hasOwnProperty(c.name)||(G[c.name]=new RegExp("^"+c.name+"(?:[\\s\\/]|$)","i"));var i=G[c.name],j=c.next,k=c.next+1;for(;k<h;k++)if(b[k-1]==="</"&&i.test(b[k]))break;k<h&&(k-=1);var l=b.slice(j,k).join("");if(c.eflags&a.eflags.CDATA)d.cdata&&d.cdata(l,e,f,B(d,b,k,g,e));else{if(!(c.eflags&a.eflags.RCDATA))throw new Error("bug");d.rcdata&&d.rcdata(u(l),e,f,B(d,b,k,g,e))}return k}function I(b,c){var d=/^([\w:]+)/.exec(b[c]),e={};e.name=d[1].toLowerCase(),e.eflags=a.ELEMENTS[e.name];var f=b[c].substr(d[0].length),g=c+1,h=b.length;for(;g<h;g++){if(b[g]===">")break;f+=b[g]}if(h<=g)return void 0;var i=[];while(f!==""){d=v.exec(f);if(!d)f=f.replace(/^[\s\S][^a-z\s]*/,"");else{if(d[4]&&!d[5]||d[6]&&!d[7]){var j=d[4]||d[6],k=!1,l=[f,b[g++]];for(;g<h;g++){if(k){if(b[g]===">")break}else 0<=b[g].indexOf(j)&&(k=!0);l.push(b[g])}if(h<=g)break;f=l.join("");continue}var m=d[1].toLowerCase(),n=d[2]?J(d[3]):m;i.push(m,n),f=f.substr(d[0].length)}}return e.attrs=i,e.next=g+1,e}function J(a){var b=a.charCodeAt(0);if(b===34||b===39)a=a.substr(1,a.length-2);return n(k(a))}function K(b){var c,d,e=function(a,b){d||b.push(a)};return y({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;f=b(e,f);if(!f){d=!(h&a.eflags.EMPTY);return}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,'="',t(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.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:e,rcdata:e,cdata:e,endDoc:function(a){for(;c.length;c.length--)a.push("</",c[c.length-1],">")}})}function N(a,b,c,d,e){if(!e)return null;var f=(""+a).match(L);return f&&(!f[1]||M.test(f[1]))?e(a,b,c,d):null}function O(a,b,c,d,e){c||a(b+" removed",{change:"removed",tagName:b});if(d!==e){var f="changed";d&&!e?f="removed":!d&&e&&(f="added"),a(b+"."+c+" "+f,{change:f,tagName:b,attribName:c,oldValue:d,newValue:e})}}function P(a,b,c){var d;return d=b+"::"+c,a.hasOwnProperty(d)?a[d]:(d="*::"+c,a.hasOwnProperty(d)?a[d]:void 0)}function Q(b,c){return P(a.ATTRIBS,b,c)}function R(b,c){return P(a.LOADERTYPES,b,c)}function S(b,c){return P(a.URIEFFECTS,b,c)}function T(e,f,g,h,i){for(var j=0;j<f.length;j+=2){var k=f[j],l=f[j+1],m=l,n=null,o;if((o=e+"::"+k,a.ATTRIBS.hasOwnProperty(o))||(o="*::"+k,a.ATTRIBS.hasOwnProperty(o)))n=a.ATTRIBS[o];if(n!==null)switch(n){case a.atype.NONE:break;case a.atype.SCRIPT:l=null,i&&O(i,e,k,m,l);break;case a.atype.STYLE:if("undefined"==typeof b){l=null,i&&O(i,e,k,m,l);break}var p=[];b(l,{declaration:function(b,e){var f=b.toLowerCase(),h=d[f];if(!h)return;c(f,h,e,g?function(b){return N(b,a.ueffects.SAME_DOCUMENT,a.ltypes.SANDBOXED,{TYPE:"CSS",CSS_PROP:f},g)}:null),p.push(b+": "+e.join(" "))}}),l=p.length>0?p.join(" ; "):null,i&&O(i,e,k,m,l);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:l=h?h(l):l,i&&O(i,e,k,m,l);break;case a.atype.URI:l=N(l,S(e,k),R(e,k),{TYPE:"MARKUP",XML_ATTR:k,XML_TAG:e},g),i&&O(i,e,k,m,l);break;case a.atype.URI_FRAGMENT:l&&"#"===l.charAt(0)?(l=l.substring(1),l=h?h(l):l,l!==null&&l!==void 0&&(l="#"+l)):l=null,i&&O(i,e,k,m,l);break;default:l=null,i&&O(i,e,k,m,l)}else l=null,i&&O(i,e,k,m,l);f[j+1]=l}return f}function U(b,c,d){return function(e,f){if(!(a.ELEMENTS[e]&a.eflags.UNSAFE))return T(e,f,b,c,d);d&&O(d,e,undefined,undefined,undefined)}}function V(a,b){var c=[];return K(b)(a,c),c.join("")}function W(a,b,c,d){var e=U(b,c,d);return V(a,e)}var b,c,d;"undefined"!=typeof window&&(b=window.parseCssDeclarations,c=window.sanitizeCssProperty,d=window.cssSchema);var e={lt:"<",gt:">",amp:"&",nbsp:" ",quot:'"',apos:"'"},f=/^#(\d+)$/,g=/^#x([0-9A-Fa-f]+)$/,j=/\0/g,l=/&(#[0-9]+|#[xX][0-9A-Fa-f]+|\w+);/g,m=/^(#[0-9]+|#[xX][0-9A-Fa-f]+|\w+);/,o=/&/g,p=/&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi,q=/[<]/g,r=/>/g,s=/\"/g,v=new RegExp("^\\s*([-.:\\w]+)(?:\\s*(=)\\s*((\")[^\"]*(\"|$)|(')[^']*('|$)|(?=[a-z][-\\w]*\\s*=)|[^\"'\\s]*))?","i"),w="a,b".split(/(,)/).length===3,x=a.eflags.CDATA|a.eflags.RCDATA,z={},G={},L=new RegExp("^(?:([^:/?# ]+):)?"),M=/^(?:https?|mailto)$/i,X={};return X.escapeAttrib=X.escapeAttrib=t,X.makeHtmlSanitizer=X.makeHtmlSanitizer=K,X.makeSaxParser=X.makeSaxParser=y,X.makeTagPolicy=X.makeTagPolicy=U,X.normalizeRCData=X.normalizeRCData=u,X.sanitize=X.sanitize=W,X.sanitizeAttribs=X.sanitizeAttribs=T,X.sanitizeWithPolicy=X.sanitizeWithPolicy=V,X.unescapeEntities=X.unescapeEntities=n,X}(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 wax=wax||{};wax.ol=wax.ol||{},wax.ol.connector=function(a){for(var b=0;b<a.tiles.length;b++)a.tiles[b]=a.tiles[b].replace("{z}","${z}").replace("{x}","${x}").replace("{y}","${y}");return new OpenLayers.Layer.XYZ(a.name,a.tiles,{sphericalMercator:!0,zoomOffset:a.minzoom,numZoomLevels:a.maxzoom-a.minzoom,attribution:a.attribution})},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.set=function(b){if(typeof b=="undefined")return;return 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.GridInstance=function(a,b,c){function g(a){return a>=93&&a--,a>=35&&a--,a-=32,a}c=c||{};var d={},e=c.resolution||4,f=c.tileSize||256;return d.grid_tile=function(){return a},d.getKey=function(b,c){if(!a||!a.grid)return;if(c<0||b<0)return;if(Math.floor(c)>=f||Math.floor(b)>=f)return;return g(a.grid[Math.floor(c/e)].charCodeAt(Math.floor(b/e)))},d.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]]},d.tileFeature=function(c,d,e,f){if(!a)return;var g=wax.util.offset(e);feature=this.gridFeature(c-g.left,d-g.top);if(feature)return b.format(f,feature)},d},wax.GridManager=function(a){function h(a){return typeof a=="string"&&(a=[a]),function(c){if(!c)return;var d=/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g.exec(c);if(!d)return;return a[parseInt(d[2],10)%a.length].replace("{z}",d[1]).replace("{x}",d[2]).replace("{y}",d[3])}}a=a||{};var b=a.resolution||4,c=a.version||"1.1",d={},e={},f,g=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};return e.formatter=function(a){return arguments.length?(f=wax.formatter(a),e):f},e.template=function(a){return arguments.length?(f=wax.template(a),e):f},e.gridUrl=function(a){return arguments.length?(g=typeof a=="function"?a:h(a),e):g},e.getGrid=function(a,c){var d=g(a);return!f||!d?c(null,null):(wax.request.get(d,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,f,{resolution:b||4}))}),e)},e.add=function(a){return a.template?e.template(a.template):a.formatter&&e.formatter(a.formatter),a.grids&&e.gridUrl(a.grids),this},e.add(a)},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.util.throttle(h,500);return e.add=function(){return i(b()),a.bindChange(j),this},e.remove=function(){return a.unbindChange(j),this},e.add()};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(b){return arguments.length?(b?(a.innerHTML=html_sanitize(b,d,e),a.style.display="block"):(a.innerHTML="",a.style.display="none"),this):a.innerHTML},b.add=function(){return c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a),this},b.add()};var w=function(a){return a.melt=function(b,c){return b.apply(c,[a,c])},a},wax=wax||{};wax.movetip={},wax.movetip=function(a){function g(a){return a&&a.className.indexOf("wax-popup")!==-1}function h(a,b){var c=document.createElement("div");return c.className="wax-movetip",c.style.cssText="position:absolute;",c.innerHTML=a,b.appendChild(c),d=b,_tooltipOffset=wax.util.offset(c),_contextOffset=wax.util.offset(d),c}function i(a){if(!c)return;var b=wax.util.eventoffset(a);c.className="wax-movetip",_tooltipOffset.height+b.y>_contextOffset.top+_contextOffset.height&&_contextOffset.height>_tooltipOffset.height&&(b.y-=_tooltipOffset.height,c.className+=" flip-y"),_tooltipOffset.width+b.x>_contextOffset.left+_contextOffset.width&&(b.x-=_tooltipOffset.width,c.className+=" flip-x"),c.style.left=b.x+"px",c.style.top=b.y+"px"}function j(a){if(!a)return;var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&e?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&e&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+e):a.parentNode&&a.parentNode.removeChild(a)}function k(a,b){c&&(j(c),c=undefined);var d=h(a,b);d.className+=" wax-popup",d.innerHTML=a;var e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close",d.appendChild(e);var f=function(a){return j(d),c=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),!1};e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),c=d}a=a||{};var b={},c=undefined,d=undefined,e=a.animationOut,f=a.animationIn;return b.over=function(a,b,d){if(!a)return;b.style.cursor="pointer";if(g(c))return;c=h(a,b),i(d),b.addEventListener&&b.addEventListener("mousemove",i)},b.out=function(a){a.style.cursor="default";if(g(c))return;c&&(j(c),a.removeEventListener&&a.removeEventListener("mousemove",i),c=undefined)},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(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b){var c=document.createElement("div");return c.className="wax-tooltip wax-tooltip-0",c.innerHTML=a,b.appendChild(c),c},wax.tooltip.prototype.hideTooltip=function(a){if(!a)return;var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)},wax.tooltip.prototype.click=function(a,b){this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined);var c=this.getTooltip(a,b);c.className+=" wax-popup",c.innerHTML=a;var d=document.createElement("a");d.href="#close",d.className="close",d.innerHTML="Close",c.appendChild(d);var e=wax.util.bind(function(a){return this.hideTooltip(c),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),!1},this);d.addEventListener?(d.addEventListener("click",e,!1),d.addEventListener("touchend",e,!1)):d.attachEvent&&d.attachEvent("onclick",e),this._currentTooltip=c},wax.tooltip.prototype.over=function(a,b){if(!a)return;b.style.cursor="pointer";if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b)},wax.tooltip.prototype.out=function(a){a.style.cursor="default";if(this.isPopup(this._currentTooltip))return;this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined)};var wax=wax||{};wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=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},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}},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)}};var wax=wax||{};wax.ol=wax.ol||{};var addEv=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)};wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a,b){this.options=b||{},this.clickAction=this.options.clickAction||"full",this.gm=new wax.GridManager(a),OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks=this.options.callbacks||new wax.tooltip},setMap:function(a){addEv(a.viewPortDiv,"mousemove",wax.util.bind(this.getInfoForHover,this)),addEv(a.viewPortDiv,"mouseout",wax.util.bind(this.resetLayers,this)),this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.getInfoForClick}),this.clickHandler.setMap(a),this.clickHandler.activate(),a.events.on({addlayer:this.resetLayers,changelayer:this.resetLayers,removelayer:this.resetLayers,changebaselayer:this.resetLayers,scope:this}),OpenLayers.Control.prototype.setMap.apply(this,arguments)},getTileStack:function(a,b){if(!a||!b)return[];var c=[];a:for(var d=0;d<a.length;d++)for(var e=0;e<a[d].grid.length;e++)for(var f=0;f<a[d].grid[e].length;f++){var g;a[d].grid[e][f].imgDiv?g=wax.util.offset(a[d].grid[e][f].imgDiv):g=wax.util.offset(a[d].grid[e][f].frame);if(g&&g.top<b.y&&g.top+256>b.y&&g.left<b.x&&g.left+256>b.x){c.push(a[d].grid[e][f]);continue a}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;this._viableLayers=[];for(var a in this.map.layers)this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"&&this._viableLayers.push(this.map.layers[a]);return this._viableLayers},resetLayers:function(a){this._viableLayers=null;var b=a.relatedTarget||a.toElement;b&&b.className!=="olTileImage"&&this.callbacks.out(this.map.viewPortDiv)},getInfoForClick:function(a){if(!a)return;var b=this.viableLayers(),c=wax.util.eventoffset(a),d=this.getTileStack(this.viableLayers(),c),e=null,f=null,g=this;for(var h=0;h<d.length;h++){if(!d[h].url)continue;this.gm.getGrid(d[h].url,function(a,b){if(!b)return;var e=b.tileFeature(c.x,c.y,d[h].frame||d[h].imgDiv,{format:g.clickAction});if(e)switch(g.clickAction){case"full":g.callbacks.click(e,d[h].layer.map.viewPortDiv,h);break;case"location":window.location=e}})}},getInfoForHover:function(a){if(!a)return;var b={format:"teaser"},c=this.viableLayers(),d=wax.util.eventoffset(a),e=this.getTileStack(this.viableLayers(),d),f=null,g=null,h=this;for(var i=0;i<e.length;i++){if(!e[i].url)continue;this.gm.getGrid(e[i].url,function(c,f){if(f&&e[i]){var g=f.tileFeature(d.x,d.y,e[i].frame||e[i].imgDiv,b);if(g){if(!e[i])return;g&&h.feature[i]!==g?(h.feature[i]=g,h.callbacks.out(e[i].layer.map.div),h.callbacks.over(g,e[i].layer.map.div,a)):g||(h.feature[i]=null,h.callbacks.out(e[i].layer.map.div))}else h.feature[i]&&h.callbacks.out(e[i].layer.map.div),h.feature[i]=null}})}},CLASS_NAME:"wax.ol.Interaction"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Legend=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Legend",legend:null,options:null,initialize:function(a){this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},activate:function(){return this.legend=new wax.Legend(this.map.viewPortDiv,this.options.container),OpenLayers.Control.prototype.activate.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate(),this.map.events.on({addlayer:this.setLegend,changelayer:this.setLegend,removelayer:this.setLegend,changebaselayer:this.setLegend,scope:this})},setLegend:function(){var a=[];for(var b=0;b<this.map.layers.length;b++){var c=this.map.layers[b];c&&c.getURL&&c.visibility&&a.push(c.getURL(new OpenLayers.Bounds))}this.legend.render(a)}});
|