ProcessIconToolbar.min.js 1.8 KB

1
  1. MWF.widget=MWF.widget||{};MWF.widget.ProcessIconToolbar=MWF.PITB=new Class({css:{toolbarNodeHide:{width:16,paddingTop:4,paddingLeft:2,paddingRight:2,paddingBottom:0,top:0,left:0,position:"relative",display:"none"},toolbarNodeShow:{borderWidth:1,borderStyle:"solid",borderColor:"#ccc",width:16,paddingTop:4,paddingLeft:2,paddingRight:2,paddingBottom:0,backgroundColor:"#fff",top:0,left:0,position:"relative",display:"block"},img:{cursor:"pointer",marginBottom:4,borderWidth:0,width:16,height:16}},node:null,targetNode:null,initialize:function(t){this.targetNode=t;this.node=new Element("div",{styles:this.css.toolbarNodeHide}).inject(this.targetNode);var o=this;this.targetNode.addEvents({mouseover:function(t){o._mouseOver.apply(o,[this,t])},mousemove:function(t){o._mouseOver.apply(o,[this,t])},mouseout:function(t){o._mouseOut.apply(o,[this,t])}});this.targetNode.store("tools",this)},addTool:function(t,o,e,i){var s=this;this.css.img.background="url("+t+") no-repeat center center";var d=new Element("div",{title:o,styles:this.css.img}).inject(this.node);d.addEvents({click:function(t){if(e){e.apply(i,[s,this,t])}}})},_mouseOver:function(t,o){this.show()},_mouseOut:function(t,o){this.hide()},_setNodePosition:function(){var t=this.node.getAllPrevious();var o=0;for(var e=0;e<t.length;e++){o+=t[e].getSize().y}var i=this.targetNode.getSize();var s=0-o;var d=i.x-16;this.node.setStyles({top:s,left:d});this.css.toolbarNodeHide.top=s;this.css.toolbarNodeHide.left=d;this.css.toolbarNodeShow.top=s;this.css.toolbarNodeShow.left=d},show:function(){this._setNodePosition();if(!this.morph){this.morph=new Fx.Morph(this.node)}window.status="show";this.node.setStyle("display","block")},hide:function(){this._setNodePosition();if(!this.morph){this.morph=new Fx.Morph(this.node)}window.status="hide";this.node.setStyle("display","none")}});