!function(t){var n=function(t){this.init(t)};n.prototype={init:function(n){var i={id:"",title:{text:"",classname:""},content:{text:[],classname:""},point:{lng:0,lat:0},type:[],level:15,zoom:!1};if(this.opts=t.extend({},i,n),!this.opts.id)throw"id不能为空";this.rendermap()},rendermap:function(){var t=this.opts,n=t.id,i=t.level||15,o=this.map=new bmap.map(n),e=this.point=new bmap.point(t.point.lng,t.point.lat);o.centerandzoom(e,i),this.addcontrol()},addcontrol:function(){var t=this.opts,n=this.map,i=t.type,o=t.zoom;if(n.addcontrol(new bmap.navigationcontrol),n.addcontrol(new bmap.scalecontrol),n.addcontrol(new bmap.overviewmapcontrol),o&&n.enablescrollwheelzoom(!0),i.length>0){var e=this.getmaptype(i);n.addcontrol(new bmap.maptypecontrol({maptypes:e}))}this.createmarker()},getmaptype:function(n){var i=[],o={"地图":bmap_normal_map,"卫星":bmap_satellite_map,"三维":bmap_perspective_map};return t.each(n,function(t,n){n in o&&i.push(o[n])}),i},createmarker:function(){var t=this,n=this.map,i=this.point,o=new bmap.marker(i),e=this.opts.icon;e&&e.url&&(o=new bmap.marker(i,{icon:new bmap.icon(e.url,new bmap.size(e.width,e.height))})),n.addoverlay(o),this.renderinfowindow(),o.addeventlistener("click",function(){t.openinfowindow()})},renderinfowindow:function(){this.map,this.point;var n=this.opts,i=n.content.text,o="";i.length>0&&t.each(i,function(t,i){o+='
'+i+"
"});this.infowindow=new bmap.infowindow(o,{width:n.width||0,height:n.height||0,title:'
'+n.title.text+"
"});this.openinfowindow()},openinfowindow:function(){var t=this.map,n=this.point,i=this.infowindow;i.isopen()||t.openinfowindow(i,n)}},window.baidumap=n}(jquery);