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

📄 zpeditor.js

📁 zapatec suite 最新版 20070204,非常棒的ajax widgets 工具包
💻 JS
📖 第 1 页 / 共 5 页
字号:
if(elRef.form&&elRef.form.onSubmit!=null){elRef.form.onSubmit();}return((elRef.onclick!=null?elRef.onclick.call(ev):true)&&oldClickAction(ev)&&(elRef.form!=null?elRef.form.submit():true));};if(nodeName=='button'){config.text=elRef.value;}else if(nodeName=='img'){config.image=elRef.src;config.text=elRef.title||elRef.title;}else if(nodeName=='div'||nodeName=='span'){config.text=elRef.innerHTML;}else if(nodeName=='input'){config.text=elRef.value;if(elRef.type.toLowerCase()=='image'){config.image=elRef.src;config.clickAction=submitAction;}else if(elRef.type.toLowerCase()=='button'){}else if(elRef.type.toLowerCase()=='submit'){config.clickAction=submitAction;}else if(elRef.type.toLowerCase()=='reset'){config.clickAction=function(ev){(elRef.onclick!=null?elRef.onclick.call(ev):true)&&oldClickAction(ev)&&(elRef.form!=null?elRef.form.reset():true)};}else{return null;}}else{return null;}var button=new Zapatec.Button(config);Zapatec.Utils.insertAfter(elRef,button.getContainer());elRef.disabled=true;elRef.style.display='none';return button;};Zapatec.Button.setupAll=function(elRef,config){if(typeof(elRef)=='string'){elRef=document.getElementById(elRef);}if(elRef==null){return null;}var childs=elRef.all?elRef.all:elRef.getElementsByTagName("*");function cloneConfig(){var cfg={};for(var option in config){cfg[option]=config[option];}return cfg;}for(var ii=0;ii<childs.length;ii++){if(childs[ii].nodeType==1&&(childs[ii].nodeName.toLowerCase()=='button'||childs[ii].nodeName.toLowerCase()=='input'&&(childs[ii].type.toLowerCase()=='image'||childs[ii].type.toLowerCase()=='button'||childs[ii].type.toLowerCase()=='submit'||childs[ii].type.toLowerCase()=='reset'))){Zapatec.Button.setup(childs[ii],cloneConfig());}}};Zapatec.Button.prototype.destroy=function(){this.container.onmouseover=null;this.container.onmouseout=null;this.container.onmousedown=null;this.container.onmouseup=null;this.container.onclick=null;this.internalContainer=null;this.statusContainer=null;this.container=null;return null;};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();}this.indicator.innerHTML=message;this.show();};Zapatec.Indicator.prototype.stop=function(){this.active=false;this.hide(true);};Zapatec.Indicator.prototype.isActive=function(){return this.active;};Zapatec.Pane=function(objArgs){this.config={};if(arguments.length==0){objArgs={};}this.widgetType="pane";this.ready=false;this.loading=false;this.prepared=false;Zapatec.Utils.createProperty(this,"container",null);Zapatec.Utils.createProperty(this,"contentElement",null);Zapatec.Utils.createProperty(this,"iframeDocument",null);Zapatec.Pane.SUPERconstructor.call(this,objArgs);}Zapatec.Pane.id="Zapatec.Pane";Zapatec.inherit(Zapatec.Pane,Zapatec.Widget);Zapatec.Pane.prototype.init=function(objArgs){Zapatec.Utils.createProperty(this.config,"parent",document.body);this.config.theme=null;this.config.width=null;this.config.height=null;this.config.containerType="div";this.config.sourceType=null;this.config.source=null;this.config.autoContentWidth=false;this.config.autoContentHeight=false;this.config.onlyInit=false;this.config.showLoadingIndicator=false;this.config.overflow="auto";this.config.id=null;Zapatec.Pane.SUPERclass.init.call(this,objArgs);if(this.config.containerType==null){this.config.containerType="div";}if(!this.config.onlyInit){this.create(this.config.width,this.config.height);}var self=this;function update(){if(self.loader){self.loader.update();}}this.addEventListener("fetchSourceStart",update);this.addEventListener("fetchSourceEnd",update);}Zapatec.Pane.prototype.prepareHtml=function(){if(this.config.containerType.toLowerCase()=='iframe'){var iframe=document.createElement("iframe");iframe.src=Zapatec.zapatecPath+"pane_files/blank.html#"+this.id;this.container=iframe;iframe=null;}else if(this.config.containerType.toLowerCase()=='div'){this.container=document.createElement("div");if(this.config.id){this.container.id=this.config.id;}this.contentElement=this.container;}else if(this.config.parent&&this.config.parent.nodeType==1){this.container=this.config.parent;this.contentElement=this.container;}this.prepared=true;};Zapatec.Pane.prototype.create=function(width,height){if(!this.prepared){this.prepareHtml();}if(!(this.config.parent=Zapatec.Widget.getElementById(this.config.parent))){Zapatec.Log({description:"No reference to parent element."});return null;}if(this.config.parent.requestParentFor&&!(this.config.parent=this.config.parent.requestParentFor(this))){Zapatec.Log({description:"No reference to parent element after request to the Parent Widget!"});return null;}if(this.config.containerType.toLowerCase()=='div'||this.config.containerType.toLowerCase()=='iframe'){this.ready=false;this.config.parent.appendChild(this.container);if(this.config.containerType.toLowerCase()!='iframe'){this.initPane();}}else if(this.config.containerType.toLowerCase()=='current'){this.container=this.config.parent;this.contentElement=this.container;this.initPane();}else{Zapatec.Log({description:"Unknown container type: "+this.config.containerType+". Possible values: iframe|div"})}Zapatec.Utils.addClass(this.container,this.getClassName({prefix:"zpPane"}));if(width||this.config.width){this.setWidth(width||this.config.width);}if(height||this.config.height){this.setHeight(height||this.config.height);}this.getContainer().style.display="block";this.setPaneContent();};Zapatec.Pane.prototype.initPane=function(){if(this.config.containerType.toLowerCase()=='iframe'){var doc=null;var sameDomain=true;var url=this.getContainer().src;var anchorEl=document.createElement("a");var protocolSeparatorPos=url.indexOf("://");if(protocolSeparatorPos!=-1){var domainSeparatorPos=url.indexOf("/",protocolSeparatorPos+3);var domain=url.substring((protocolSeparatorPos>0?protocolSeparatorPos+3:0),(domainSeparatorPos>0?domainSeparatorPos:url.length));if(domain!=window.location.host){sameDomain=false;}}if(sameDomain){if(this.container.contentDocument!=null){doc=this.container.contentDocument;}else if(this.container.contentWindow&&this.container.contentWindow.document!=null){doc=this.container.contentWindow.document;}var self=this;anchorEl.href=url;url=anchorEl.href;if(doc==null||doc.body==null||(Zapatec.is_gecko&&url!=this.container.contentWindow.location.href)){setTimeout(function(){self.initPane()},50);return false;}this.iframeDocument=doc;this.contentElement=doc.body;if(typeof this.container.contentWindow.Zapatec!="object"&&typeof this.container.contentWindow.Zapatec!="function"){this.container.contentWindow.Zapatec={};this.container.contentWindow.Zapatec.windowLoaded=typeof(doc.readyState)!='undefined'?(doc.readyState=='loaded'||doc.readyState=='complete'):doc.getElementsByTagName!=null&&typeof(doc.getElementsByTagName('body')[0])!='undefined';Zapatec.Utils.addEvent(this.container.contentWindow,"load",function(){self.container.contentWindow.Zapatec.windowLoaded=true;});}if(!this.container.contentWindow.Zapatec||!this.container.contentWindow.Zapatec.windowLoaded){setTimeout(function(){self.initPane()},50);return false;}doc=null;}}if(this.config.overflow){this.getContainer().style.overflow=this.config.overflow;}this.ready=true;this.fireEvent("onReady",this);this.hideIndicator();this.loading=false;this.removeEvent("onReady");}Zapatec.Pane.prototype.getContainer=function(){return this.container;}Zapatec.Pane.prototype.getIframeDocument=function(){return this.iframeDocument;}Zapatec.Pane.prototype.getContentElement=function(){return this.contentElement;}Zapatec.Pane.prototype.isReady=function(){return this.ready;}

⌨️ 快捷键说明

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