⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paneset.js

📁 zapatec suite 最新版 20070204,非常棒的ajax widgets 工具包
💻 JS
📖 第 1 页 / 共 5 页
字号:
this._proceedDraggableElements("dragStart");var oPos=Zapatec.Utils.getMousePos(ev);var mouseX=oPos.pageX;var mouseY=oPos.pageY;this.makeMovable();this.startMove();var elements=Zapatec.Array(this.getMovableElements());elements.each(function(index,movable){if(Zapatec.isHtmlElement(movable)){movable.restorer.saveProp("style.zIndex");movable.style.zIndex=1000000+(parseInt(movable.style.zIndex,10)||0);self._proceedDragStyles(movable,"dragStart");if(config.eventCapture){movable.restorer.saveProp("style.cursor");movable.style.cursor="move";}}else if(Zapatec.isMovableObj(movable)){var elems=Zapatec.Array(movable.getMovableElements());elems.each(arguments.calee);}});Zapatec.Utils.cover.show(config.eventCapture?999999:2000000,"move",function(ev){return self.dragMove(ev);},function(ev){return self.dragEnd(ev);});this._setMovingPoint(mouseX,mouseY);this.fireEvent("onDragInit",ev);Zapatec.GlobalEvents.fireEvent("onDragInit",ev,this);if(config.stopEvent){return Zapatec.Utils.stopEvent(ev);}else{return true;}};Zapatec.Draggable.dragMove=function(ev){if(!this.isDragging()){return true;}ev=ev||window.event;if(this.fireEvent("beforeDragMove",ev)===false){return true;}if(Zapatec.GlobalEvents.fireEvent("beforeDragMove",ev,this)===false){return true;}if(Zapatec.Utils.cover.style.zIndex!=2000000){var config=this.getDragConfig();if(config.eventCapture&&(config.method=="dummy"||config.method=="copy")){var draggables=Zapatec.Array(this.getDraggableElements());draggables.each(function(index,draggable){draggable.restorer.restoreProp("style.zIndex");});}Zapatec.Utils.cover.style.zIndex=2000000;}var oPos=Zapatec.Utils.getMousePos(ev);var mouseX=oPos.pageX;var mouseY=oPos.pageY;var movePoint=this.getMovingPoint();this.moveFor(mouseX-movePoint.x,mouseY-movePoint.y);this._setMovingPoint(mouseX,mouseY);this.fireEvent("onDragMove",ev);Zapatec.GlobalEvents.fireEvent("onDragMove",ev,this);return Zapatec.Utils.stopEvent(ev);};Zapatec.Draggable.dragEnd=function(ev){if(!this.isDragging()){return true;}ev=ev||window.event;var self=this;if(this.fireEvent("beforeDragEnd",ev)===false){return true;}if(Zapatec.GlobalEvents.fireEvent("beforeDragEnd",ev,this)===false){return true;}var config=this.getDragConfig();if(config.eventCapture&&(config.method=="dummy"||config.method=="copy")){var draggables=Zapatec.Array(this.getDraggableElements());draggables.each(function(index,draggable){draggable.restorer.restoreProp("style.zIndex",true);});}var elements=Zapatec.Array(this.getMovableElements());elements.each(function(index,movable){if(Zapatec.isHtmlElement(movable)){movable.restorer.restoreProp("style.zIndex");movable.restorer.restoreProp("style.cursor");self._proceedDragStyles(movable,"dragEnd");}else if(Zapatec.isMovableObj(movable)){var elems=Zapatec.Array(movable.getMovableElements());elems.each(arguments.calee);}});this._proceedDraggableElements("dragEnd");Zapatec.Utils.cover.hide();this._setMovingPoint(null,null);this._setDragging(false);this.endMove();this.fireEvent("onDragEnd",ev);Zapatec.GlobalEvents.fireEvent("onDragEnd",ev,this);return Zapatec.Utils.stopEvent(ev);};Zapatec.Draggable.restorePos=function(){this.restoreOfMove();};Zapatec.Draggable.restoreOfDrag=function(){var listenersObj=this._getRestorer().getSavedProps()["dragListeners"];if(!listenersObj){return false;}this.restoreOfMove();var hooks=Zapatec.Array(this._getDraggableHooks());var draggables=Zapatec.Array(this.getDraggableElements());var self=this;var config=this.getDragConfig();hooks.each(function(index,hook){if(!Zapatec.isHtmlElement(hook)){return;}if(Zapatec.is_gecko){hook.style.setProperty("-moz-user-select","","");}Zapatec.Utils.removeEvent(hook,'mousedown',listenersObj.mousedown);if(config.eventCapture){Zapatec.Utils.removeEvent(hook,'mousemove',listenersObj.mousemove);Zapatec.Utils.removeEvent(hook,'mouseup',listenersObj.mouseup);}});draggables.each(function(index,draggable){if(!Zapatec.isHtmlElement(draggable)){return;}draggable.dragObj=null;});return true;};Zapatec.Draggable.getDraggableElements=function(){return this.getContainer();};Zapatec.Draggable._getDraggableHooks=function(){return this.getContainer();};Zapatec.Draggable.getContainer=function(){return this.getDragConfig().container;};Zapatec.Draggable.isDragging=function(){return this.dragging;};Zapatec.Draggable.canDrag=function(){return this.canDrag;};Zapatec.Draggable._setCanDrag=function(on){this.canDrag=on;};Zapatec.Draggable.getDragConfig=function(){return this.getConfiguration();};Zapatec.Draggable.setDragConfig=function(config){this.reconfigure(config);};Zapatec.Draggable._setDragging=function(on){this.dragging=on;};Zapatec.Draggable._handleCoordOverflow=function(limit,dimension){if(!this.isDragging()){Zapatec.Movable._handleCoordOverflow.call(this,limit,dimension);}return limit;};Zapatec.Draggable._getRestorer=function(){if(!this.restorer){this.restorer=new Zapatec.SRProp(this);}return this.restorer;};Zapatec.Draggable._proceedDraggableElements=function(dragState){var config=this.getDragConfig(),restorer=this._getRestorer(),copies=null,measurement=null,self=this,listenersObj=restorer.getProp("dragListeners");function toggleEvents(action,hooks,listenersObj){hooks.each(function(index,hook){Zapatec.Utils[action+"Event"](hook,"mousedown",listenersObj.mousedown);if(config.eventCapture){Zapatec.Utils[action+"Event"](hook,'mousemove',listenersObj.mousemove);Zapatec.Utils[action+"Event"](hook,'mouseup',listenersObj.mouseup);}});}switch(config.method){case"copy":case"dummy":{if(dragState=="dragStart"){var elements=Zapatec.Array(this.getDraggableElements());var hooks=Zapatec.Array(this._getDraggableHooks());copies=Zapatec.Array();toggleEvents("remove",hooks,listenersObj);elements.each(function(index,movable){if(Zapatec.isHtmlElement(movable)){var newNode=movable.cloneNode(config.copyChilds);newNode.dragObj=self;if(config.eventCapture){Zapatec.Utils.addEvent(newNode,'mousemove',listenersObj.mousemove);Zapatec.Utils.addEvent(newNode,'mouseup',listenersObj.mouseup);}movable.parentNode.insertBefore(newNode,movable);newNode.style.visibility="visible";copies.push(newNode);if(movable==self.getMovableMeasurement()){measurement=newNode;}}else if(Zapatec.isMovableObj(movable)){var elems=Zapatec.Array(movable.getMovableElements());elems.each(arguments.calee);}});toggleEvents("add",hooks,listenersObj);if(!measurement){measurement=this.getMovableMeasurement();}restorer.saveProp("getMovableElements");restorer.saveProp("isMovableSafely()");this._setMovableSafely(false);this.getMovableElements=function(resetArray){var arr=copies;copies=resetArray?null:copies;return arr;};restorer.saveProp("getMovableMeasurement");this.getMovableMeasurement=function(){return measurement;};}else if(dragState=="dragEnd"){var elements=Zapatec.Array(this.getMovableElements(true));elements.each(function(index,movable){if(config.method=="dummy"){movable.parentNode.removeChild(movable);}movable.dragObj=null;if(config.eventCapture){Zapatec.Utils.removeEvent(movable,'mousemove',listenersObj.mousemove);Zapatec.Utils.removeEvent(movable,'mouseup',listenersObj.mouseup);}});this.restoreOfMove();restorer.restoreProp("getMovableElements");this._setMovableSafely(restorer.getProp("isMovableSafely()"));restorer.restoreProp("isMovableSafely()");restorer.restoreProp("getMovableMeasurement");}break;}default:{break;}}};Zapatec.Draggable._proceedDragStyles=function(movable,dragState){var config=this.getDragConfig();if(config.overwriteCSS){if(dragState=="dragStart"){movable.restorer.saveProp("className");movable.className=config.overwriteCSS;}else if(dragState=="dragEnd"){movable.restorer.restoreProp("className");}}if(config.dragCSS){if(dragState=="dragStart"){Zapatec.Utils.addClass(movable,config.dragCSS);}else if(dragState=="dragEnd"){Zapatec.Utils.removeClass(movable,config.dragCSS);}}};Zapatec.Draggable._setMovingPoint=function(x,y){var movingPoint=this._getMovingPointObject();if(x===null||y===null){movingPoint.x=null;movingPoint.y=null;movingPoint.offsetX=null;movingPoint.offsetY=null;return;}if(movingPoint.x===null||movingPoint.y===null){var pos=this.getPagePosition();movingPoint.x=x;movingPoint.y=y;movingPoint.offsetX=x-pos.x;movingPoint.offsetY=y-pos.y;}else{var pos=this.getPagePosition();movingPoint.x=pos.x+movingPoint.offsetX;movingPoint.y=pos.y+movingPoint.offsetY;}return;};Zapatec.Draggable.getMovingPoint=function(){var movingPoint=this._getMovingPointObject();return{x:movingPoint.x,y:movingPoint.y};};Zapatec.Draggable._getMovingPointObject=function(){if(!this.movingPoint||typeof this.movingPoint!="object"){this.movingPoint={x:null,y:null,offsetX:null,offsetY:null};}return this.movingPoint;};Zapatec.Utils.Draggable=function(config){if(arguments.length>1){var args=arguments[1];args.container=config;config=args;}if(typeof config.left!="undefined"||typeof config.right!="undefined"||typeof config.top!="undefined"||typeof config.bottom!="undefined"){config.limit={minX:config.left,maxX:config.right,minY:config.top,maxY:config.bottom};}if(config.dragLayer){config.moveLayer=config.dragLayer;}if(!config.eventListeners){config.eventListeners={};}if(config.beforeDragInit){config.eventListeners.beforeDragInit=config.beforeDragInit;}if(config.beforeDragMove){config.eventListeners.beforeDragMove=config.beforeDragMove;}if(config.beforeDragEnd){config.eventListeners.beforeDragEnd=config.beforeDragEnd;}if(config.onDragInit){config.eventListeners.onDragInit=config.onDragInit;}if(config.onDragMove){config.eventListeners.onDragMove=config.onDragMove;}if(config.onDragEnd){config.eventListeners.onDragEnd=config.onDragEnd;}if(config.stopEv){config.stopEvent=config.stopEv;}config=Zapatec.Hash.remove(config,"left","top","right","bottom","dragLayer","beforeDragInit","beforeDragMove","beforeDragEnd","onDragInit","onDragMove","onDragEnd","stopEv");Zapatec.Utils.Draggable.SUPERconstructor.call(this,config);};Zapatec.Utils.Draggable.id="Zapatec.Utils.Draggable";Zapatec.inherit(Zapatec.Utils.Draggable,Zapatec.Utils.Movable);Zapatec.implement(Zapatec.Utils.Draggable,"Zapatec.Draggable");Zapatec.Utils.Draggable.prototype.init=function(config){Zapatec.Utils.Draggable.SUPERclass.init.call(this,config);this.makeDraggable();};Zapatec.Utils.Draggable.prototype.configure=function(config){this.defineConfigOption("method","cut");this.defineConfigOption("stopEvent",true);this.defineConfigOption("eventCapture",false);this.defineConfigOption("handler",null);this.defineConfigOption("dragCSS",null);this.defineConfigOption("overwriteCSS",null);this.defineConfigOption("copyChilds",true);this.defineConfigOption("makeMovable",false);Zapatec.Utils.Draggable.SUPERclass.configure.call(this,config);config=this.getConfiguration();if(Zapatec.is_opera){config.eventCapture=true;}config.handler=Zapatec.Widget.getElementById(config.handler);config.handler=Zapatec.Utils.img2div(config.handler);if(!Zapatec.isHtmlElement(config.handler)){config.handler=config.container;}};Zapatec.Utils.Draggable.prototype.reconfigure=function(config){Zapatec.Utils.Draggable.SUPERclass.reconfigure.call(this,config);};Zapatec.Utils.Draggable.prototype.getDraggableElements=function(){return this.movableElements;};Zapatec.Utils.Draggable.prototype._getDraggableHooks=function(){return this.getConfiguration().handler;};Zapatec.Utils.initDragObjects=function(className,el,recursive,config){if(!className)return;var elements=Zapatec.Utils.getElementsByAttribute('className',className,el,recursive,true);return Zapatec.Utils.applyToElements(Zapatec.Utils.Draggable,elements,config);}Zapatec.Modal=function(config){if(arguments.length==0){config={};}this.visible=false;Zapatec.Modal.SUPERconstructor.call(this,config);}Zapatec.Modal.id="Zapatec.Indicator";Zapatec.inherit(Zapatec.Modal,Zapatec.Widget);Zapatec.Modal.prototype.init=function(config){Zapatec.Modal.SUPERclass.init.call(this,config);};Zapatec.Modal.prototype.configure=function(config){this.defineConfigOption("zIndex",1000);this.defineConfigOption("x",null);this.defineConfigOption("y",null);this.defineConfigOption("width",null);this.defineConfigOption("height",null);this.defineConfigOption("container",window);this.defineConfigOption("fixed",false);Zapatec.Modal.SUPERclass.configure.call(this,config);config=this.getConfiguration();if(config.container!=window){config.x=null;config.y=null;config.width=null;config.height=null;config.fixed=false;}};Zapatec.Modal.prototype.create=function(){var config=this.getConfiguration();config.container=Zapatec.Widget.getElementById(config.container)||window;this.WCH=Zapatec.Utils.createWCH();if(Zapatec.windowLoaded){this.container=Zapatec.Utils.createElement("div",document.body);}else{document.write('<div id="zpModalContainer"></div>');this.container=document.getElementById('zpModalContainer');}this.container.className=this.getClassName({prefix:"zpModal"+(Zapatec.is_opera?"Opera":"")})var st=this.container.style;st.dispaly="none";st.position="absolute";st.zIndex=config.zIndex;};Zapatec.Modal.prototype.show=function(zIndex){if(!this.container){this.create();}zIndex=zIndex||this.config.zIndex;this.container.style.zIndex=zIndex;if(this.WCH){this.WCH.style.visibility="";this.WCH.style.zIndex=zIndex-1;}this.container.style.display="block";this.visible=true;var config=this.getConfiguration();if(config.container!=window){var self=this;var update=function(){self.update();}if(!this.interval){this.interval=setInterval(update,100);}this.update();}else{var dim=Zapatec.Utils.getWindowSize();var width=config.width||dim.width;var height=config.height||dim.height;var x=config.x||Zapatec.Utils.getPageScrollX();var y=config.y||Zapatec.Utils.getPageScrollY();this.setWidth(width);this.setHeight(height);this.setPosition(x,y);}if(this.config.fixed==true){Zapatec.FixateOnScreen.register(this.container);if(this.WCH){Zapatec.FixateOnScreen.register(this.WCH);}}};Zapatec.Modal.prototype.update=function(){var config=this.getConfiguration();if(config.container!=window&&this.visible){var offs=Zapatec.Utils.getElementOffset(config.container);this.setWidth(offs.width);this.setHeight(offs.height);this.setPosition(offs.x,offs.y);}};Zapatec.Modal.prototype.hide=function(destroy){var config=this.getConfiguration();if(config.fixed==true){Zapatec.FixateOnScreen.unregister(this.container);if(this.WCH){Zapatec.FixateOnScreen.unregister(this.WCH);}}if(config.container!=window){clearInterval(this.interval);this.interval=null;}if(this.container)this.container.style.display="none";Zapatec.Utils.hideWCH(this.WCH);if(destroy){if(this.WCH){if(this.WCH.outerHTML){this.WCH.outerHTML="";}else{Zapatec.Utils.destroy(this.WCH);}}if(this.container.outerHTML){this.container.outerHTML="";}else{Zapatec.Utils.destroy(this.container);}this.WCH=null;this.container=null;}this.visible=false;};Zapatec.Modal.prototype.setWidth=function(width){if(!this.container){return;}if(Zapatec.Utils.setWidth){Zapatec.Utils.setWidth(this.container,width);Zapatec.Utils.setWidth(this.WCH,width);}else{this.container.style.width=width+"px";if(this.WCH){this.WCH.style.width=width+"px";}}};Zapatec.Modal.prototype.setHeight=function(height){if(!this.container){return;}if(Zapatec.Utils.setHeight){Zapatec.Utils.setHeight(this.container,height);Zapatec.Utils.setHeight(this.WCH,height);}else{this.container.style.height=height+"px";if(this.WCH){this.WCH.style.height=height+"px";}}};Zapatec.Modal.prototype.setPosition=function(x,y){if(!this.container){return;}if(Zapatec.Utils.moveTo){Zapatec.Utils.moveTo(this.container,x,y);Zapatec.Utils.moveTo(this.WCH,x,y);}else{this.container.style.left=x+"px";this.container.style.top=y+"px";if(this.WCH){this.WCH.style.left=x+"px";this.WCH.style.top=y+"px";}}};Zapatec.Indicator=function(config){if(arguments.length==0){config={};}this.active=false;Zapatec.Indicator.SUPERconstructor.call(this,config);}Zapatec.Indicator.id="Zapatec.Indicator";Zapatec.inherit(Zapatec.Indicator,Zapatec.Modal);Zapatec.Indicator.prototype.init=function(config){Zapatec.Indicator.SUPERclass.init.call(this,config);};Zapatec.Indicator.prototype.configure=function(config){this.defineConfigOption("themePath",Zapatec.zapatecPath+"../zpextra/themes/indicator/");Zapatec.Indicator.SUPERclass.configure.call(this,config);};Zapatec.Indicator.prototype.create=function(){Zapatec.Indicator.SUPERclass.create.call(this);this.indicator=Zapatec.Utils.createElement("div",this.container);this.indicator.className="zpIndicator";var st=this.indicator.style;st.position="absolute";st.zIndex=this.getConfiguration().zIndex;st.backgroundColor="#aaaaaa";};Zapatec.Indicator.prototype.setWidth=function(width){if(!this.container){return;}Zapatec.Indicator.SUPERclass.setWidth.call(this,width);var left=Math.round((this.container.offsetWidth-this.indicator.offsetWidth)/2);this.indicator.style.left=left+"px";};Zapatec.Indicator.prototype.setHeight=function(height){if(!this.container){return;}Zapatec.Indicator.SUPERclass.setHeight.call(this,height);var top=Math.round((this.container.offsetHeight-this.indicator.offsetHeight)/2);this.indicator.style.top=top+"px";};Zapatec.Indicator.prototype.hide=function(destroy){if(destroy){this.indicator=null;}Zapatec.Indicator.SUPERclass.hide.call(this,destroy);};Zapatec.Indicator.prototype.start=function(message){this.active=true;if(!this.indicator){this.create();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -