L.Control.WMSLegend=L.Control.extend({options:{position:"topright",uri:""},onAdd:function(){var t=L.DomEvent.stopPropagation;return this.container=L.DomUtil.create("div","leaflet-control-wms-legend"),this.img=L.DomUtil.create("img","wms-legend",this.container),this.img.src=this.options.uri,this.img.alt="Legend",L.DomEvent.on(this.img,"click",this._click,this).on(this.container,"click",this._click,this).on(this.img,"mousedown",t).on(this.img,"dblclick",t).on(this.img,"click",L.DomEvent.preventDefault).on(this.img,"click",t),this.height=null,this.width=null,this.container},_click:function(t){L.DomEvent.stopPropagation(t),L.DomEvent.preventDefault(t),"none"===window.getComputedStyle(this.img).display?(this.container.style.height=this.height+"px",this.container.style.width=this.width+"px",this.img.style.display=this.displayStyle):(null===this.width&&null===this.height&&(this.height=this.container.offsetHeight,this.width=this.container.offsetWidth),this.displayStyle=this.img.style.display,this.img.style.display="none",this.container.style.height="20px",this.container.style.width="20px")}}),L.wmsLegend=function(t){var i=new L.Control.WMSLegend;return i.options.uri=t,map.addControl(i),i};