You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
5.9 KiB

/**/_jsload2 && _jsload2('menu', 'x.object.extend(cd.prototype,{ra:function(a,b){if(this.C)return q;this.D=a;this.Ml=b||p;this.Ba();var c=this,d=a.B.Xb;b&&b.z.jf&&(d="pointer");this.C.style.cursor=d;this.Cd&&(this.Cd.style.cursor=d);x.M(document,"mousedown",function(){c.C&&c.U()});x.M(this.C,"click",function(a){c.U();oa(a)});d=this.k.Ua;d||(d=a.Ua);this.Ml?this.Ml.addEventListener("rightclick",function(a){c.C&&c.NJ(a)}):a.addEventListener("rightclickex",function(a){c.C&&(!a.cb&&!a.Bb)&&c.NJ(a)});for(var d=0,e=this.ya.length;d<e;d++)"menuitem"== this.ya[d].Lb&&this.ya[d].ra(a,this),"divider"==this.ya[d].Lb&&(this.Ge[this.ya[d].Vj].K=Db(this.C,"<div class=\'BMap_cmDivider\'></div>"));this.ys()},Ab:function(){this.D&&(this.ra(this.D,this.Ml),this.Th&&(this.Th=q,this.show()))},remove:function(){this.C&&(this.C.parentNode.removeChild(this.C),this.C=p);this.Cd&&(this.Cd.parentNode.removeChild(this.Cd),this.Cd=p);for(var a=0,b=this.ya.length;a<b;a++)"menuitem"==this.ya[a].Lb&&(this.ya[a].C=p);this.D=this.Ml=p},Ba:function(){this.C=Db(this.D.Ua,"<div unselectable=\'on\'></div>"); this.C.className="BMap_contextMenu";var a=this.C.style;a.font="12px "+I.fontFamily;9>x.da.ma?this.Cd=Db(this.D.Ua,"<div class=\'BMap_cmShadow\'></div>"):a.aW=a.hQ=a.WebkitBoxShadow="1px 2px 6px #666";return this.C},Rw:function(a){if(a&&!("menuitem"!=a.Lb||""==a.Yg||0>=a.dj)){for(var b=0,c=this.ya.length;b<c;b++)if(this.ya[b]===a)return;this.ya.push(a);this.Jf.push(a);this.D&&(a.ra(this.D,this),x.K.Ta(a.Ld(),"BMap_cmLstItem"),1<this.ya.length?"menuitem"==this.ya[this.ya.length-2].Lb&&x.K.Tb(this.ya[this.ya.length- 2].Ld(),"BMap_cmLstItem"):"menuitem"==this.ya[0].Lb&&x.K.Ta(this.ya[0].Ld(),"BMap_cmFstItem"),this.ys())}},removeItem:function(a){if(a&&"menuitem"==a.Lb){for(var b=0,c=this.ya.length;b<c;b++)this.ya[b]===a&&(this.ya[b].remove(),this.ya.splice(b,1),c--);b=0;for(c=this.Jf.length;b<c;b++)this.Jf[b]===a&&(this.Jf[b].remove(),this.Jf.splice(b,1),c--);this.C&&(0<this.ya.length&&"menuitem"==this.ya[this.ya.length-1].Lb&&x.K.Ta(this.ya[this.ya.length-1].Ld(),"BMap_cmLstItem"),this.ys())}},vC:function(){this.ya.push({Lb:"divider", Vj:this.Ge.length});this.Ge.push({K:p});this.C&&(this.Ge[this.Ge.length-1].K=Db(this.C,"<div class=\'BMap_cmDivider\'></div>"),this.ys())},LF:function(a){if(this.Ge[a]){this.Ge[a].K&&this.Ge[a].K.parentNode&&this.Ge[a].K.parentNode.removeChild(this.Ge[a].K);for(var b=0,c=this.ya.length;b<c;b++)this.ya[b]&&("divider"==this.ya[b].Lb&&this.ya[b].Vj==a)&&(this.ya.splice(b,1),c--),this.ya[b]&&("divider"==this.ya[b].Lb&&this.ya[b].Vj>a)&&this.ya[b].Vj--;this.Ge.splice(a,1);this.ys()}},ta:function(a,b){this.C.style.left= a+"px";this.C.style.top=b+"px";this.Cd&&(this.Cd.style.left=a+1+"px",this.Cd.style.top=b+2+"px")},show:function(){if(this.Th!=o&&0!=this.Jf.length){this.Th=o;this.C&&(this.C.style.visibility="visible");this.Cd&&(this.Cd.style.visibility="visible");var a=new N("onopen");a.point=this.wx;a.pixel=this.Ks;this.dispatchEvent(a)}},U:function(){if(this.Th!=q){this.Th=q;this.C&&(this.C.style.visibility="hidden");this.Cd&&(this.Cd.style.visibility="hidden");var a=new N("onclose");a.point=this.wx;a.pixel=this.Ks; this.dispatchEvent(a)}},H_:function(a){if(a&&(this.k.cursor=a,this.C&&(this.C.style.cursor=this.k.cursor),this.Cd))this.Cd.style.cursor=this.k.cursor},ys:function(){this.C&&this.Cd&&(this.Cd.style.width=this.C.offsetWidth+"px",this.Cd.style.height=this.C.offsetHeight+"px")},NJ:function(a){if(0!=this.Jf.length){this.Ks=a.Wa;this.wx=this.D.Rb(this.Ks);var b=this.Ld().offsetHeight,c=this.Ld().offsetWidth,d=a.Wa.x,e=a.Wa.y;a.Wa.x+c>this.D.width&&(d=a.Wa.x-c);a.Wa.y+b>this.D.height&&(e=a.Wa.y-b);this.ta(d, e);this.show()}}});U(og,{addItem:og.Rw,removeItem:og.removeItem,addSeparator:og.vC,removeSeparator:og.LF});x.object.extend(fd.prototype,{ra:function(a,b){if(this.C)return q;this.D=a;this.Lh=b;b.Ld()&&(this.Ba(),this.ca(),this.Ph||(this.Ph=o,this.disable()));return o},remove:function(){this.C&&(this.C.parentNode.removeChild(this.C),this.C=p);this.D=this.Lh=p},Ab:function(){this.Lh&&this.D&&this.ra(this.D,this.Lh)},Ba:function(){var a=this.k.Vm?"<div"+(this.k.id?" id=\'"+this.k.id+"\'":"")+" unselectable=\'on\'><div style=\'width: 17px;height: 17px;margin-right: 3px;display: inline-block;zoom: 1;*display: inline;vertical-align: middle;background: url("+ this.k.Vm+") no-repeat;\'></div><span style=\'vertical-align: middle;\'>"+this.Yg+"</span></div>":"<div"+(this.k.id?" id=\'"+this.k.id+"\'":"")+" unselectable=\'on\'><span>"+this.Yg+"</span></div>";this.C=Db(this.Lh.Ld(),a);this.k.Vm?(this.Mv=this.C.firstChild,this.ss=this.C.lastChild):this.ss=this.C;a=this.C.style;a.padding="2px 6px";a.margin="0 2px";a.fontSize="14px";a.MozUserSelect="none";a.lineHeight="17px";a.width=this.k.width+"px";this.Ph?(a.color="#000",a.cursor="pointer"):(a.color="#aaa",a.cursor= this.D.B.Xb);return this.C},ca:function(){var a=this;x.M(this.C,"click",function(b){a.Ph?a.fA&&a.fA.call&&a.fA.call(a,a.Lh.wx,a.Lh.Ks,a.Lh.Ml):oa(b)});x.M(this.C,"mousedown",function(a){oa(a)});x.M(this.C,"mouseover",function(){a.Ph&&(a.C.style.color="#6688cc")});x.M(this.C,"mouseout",function(){a.Ph&&(a.C.style.color="#000")})},tu:function(a){a&&(this.Yg=a+"",this.ss&&(this.ss.innerHTML="<span>"+this.Yg+"</span>"))},Vb:function(a){a&&(this.k.Vm=a,this.Mv?this.Mv.style.background="url("+a+")":(this.C.innerHTML= "<div"+(this.k.id?" id=\'"+this.k.id+"\'":"")+" unselectable=\'on\'><div style=\'width: 17px;height: 17px;margin-right: 3px;display: inline-block;zoom: 1;*display: inline;vertical-align: middle;background: url("+this.k.Vm+") no-repeat;\'></div><span style=\'vertical-align: middle;\'>"+this.Yg+"</span></div>",this.Mv=this.C.firstChild,this.ss=this.C.lastChild))},enable:function(){this.Ph=o;this.C&&(this.C.style.color="#000",this.C.style.cursor="pointer")},disable:function(){this.Ph=q;this.C&&(this.C.style.color= "#aaa",this.C.style.cursor=this.D.B.Xb)}});U(pg,{setIcon:pg.Vb,setText:pg.tu,enable:pg.enable,disable:pg.disable}); ');