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

📄 paneset.js

📁 zapatec suite 最新版 20070204,非常棒的ajax widgets 工具包
💻 JS
📖 第 1 页 / 共 5 页
字号:
/* * * Copyright (c) 2004-2005 by Zapatec, Inc. * http://www.zapatec.com * 1700 MLK Way, Berkeley, California, * 94709, U.S.A. * All rights reserved. * * */Zapatec.panesetPath = Zapatec.getPath("Zapatec.PaneSetWidget");Zapatec.Array=function(arr){if(!Zapatec.isArray(arr)){var array=[];for(var i=0;i<arguments.length;++i){array.push(arguments[i]);}arr=array;}arr.clear=function(){Zapatec.Array.clear(this);};arr.compact=function(){var compact=Zapatec.Array.compact(this);return Zapatec.Array(compact);};arr.indexOf=function(value){return Zapatec.Array.indexOf(this,value);};arr.without=function(){var args=[].slice.call(arguments,0);args.unshift(this);var without=Zapatec.Array.without.apply(Zapatec.Array,args);return Zapatec.Array(without);};arr.remove=function(){var args=[].slice.call(arguments,0);args.unshift(this);var cut=Zapatec.Array.remove.apply(Zapatec.Array,args);return Zapatec.Array(cut);};arr.each=function(func,reverse){var result;for(var index=reverse?this.length-1:0;reverse?(index>=0):(index<this.length);reverse?--index:++index){if(typeof func=="function"){result=func(index,this[index],this);if(result=="break"){break;}}}if(result=="break"){return false;}return true;};arr.isZpArray=true;return arr;};Zapatec.Array.compact=function(arr){var newArr=[];for(var item=0;item<arr.length;++item){if(arr[item]!==null&&typeof arr[item]!="undefined"){newArr.push(arr[item]);}}return newArr;};Zapatec.Array.clear=function(arr){arr.length=0;};Zapatec.Array.indexOf=function(arr,value){for(var item=0;item<arr.length;++item){if(arr[item]===value){return item;}}return-1;};Zapatec.Array.without=function(arr){var newArr=[],without;for(var item=0;item<arr.length;++item){without=false;for(var value=1;value<arguments.length;++value){if(arr[item]===arguments[value]){without=true;break;}}if(!without){newArr.push(arr[item]);}}return newArr;};Zapatec.Array.remove=function(arr){var newArr=[],without,value,start=1;if(arguments[1]&&arguments[1].length&&typeof arguments[1]=="object"){args=arguments[1];start=0;}else{args=arguments;}for(var item=0;item<arr.length;++item){without=false;for(value=start;value<args.length;++value){if(item===args[value]){without=true;break;}}if(!without){newArr.push(arr[item]);}}return newArr;};Zapatec.Hash=function(hash){if(!hash||typeof hash!="object"){hash={};}hash.hashRemove=function(){var args=[].slice.call(arguments,0);args.unshift(this);var without=Zapatec.Hash.remove.apply(Zapatec.Hash,args);return Zapatec.Hash(without);};hash.hashEach=function(func){var result=null;for(var prop in this){if(prop=="hashRemove"||prop=="hashEach"||prop=="hashIsEmpty"||prop=="isZpHash"){continue;}if(typeof Object.prototype[prop]!="undefined"){continue;}result=func(prop,this[prop],this);if(result=="break"){break;}}if(result=="break"){return false;}return true;};hash.hashIsEmpty=function(){var empty=true;this.hashEach(function(){empty=false;return"break";});return empty;};hash.isZpHash=true;return hash;};Zapatec.Hash.remove=function(hash){var newHash={},without,value,start=1;if(arguments[1]&&arguments[1].length&&typeof arguments[1]=="object"){args=arguments[1];start=0;}else{args=arguments;}for(var item in hash){without=false;for(value=start;value<args.length;++value){if(item===args[value]){without=true;break;}}if(!without){newHash[item]=hash[item];}}return newHash;};Zapatec.Hash.getByPath=function(hash,path){if(!path||typeof path!="string"){Zapatec.Log({description:"Not a path passed to Zapatec.Hash.getByPath function!",type:"warning"});return{result:false};}var paths=path.split(".");if(!paths.length){Zapatec.Log({description:"Wrong path passed to Zapatec.Hash.getByPath function!",type:"warning"});return{result:false};}var item=0;var value=hash;var name="";var scope=null;while(paths[item]){if(value===null||typeof value=="undefined"){Zapatec.Log({description:"Incorrect path passed to Zapatec.Hash.getByPath function!",type:"warning"});return{result:false};}name=paths[item].replace(/(\(\)|\[[^\[\]]+\])+/,"");try{scope=value;value=value[name];}catch(e){Zapatec.Log({description:"Incorrect path passed to Zapatec.Hash.getByPath function!",type:"warning"});return{result:false};}paths[item]=paths[item].replace(name,"");while(paths[item]!=""){name=paths[item].match(/(\(\)|\[[^\[\]]+\])/)[1];if(name&&/\(\)$/.test(name)){try{value=value.call(scope||value);scope=null;}catch(e){Zapatec.Log({description:"Incorrect path passed to Zapatec.Hash.getByPath function!",type:"warning"});return{result:false};}}else if(name&&/\[["']?[^\[\]"']+["']?\]$/.test(name)){try{value=value[name.match(/\[["']?([^\[\]"']+)["']?\]/)[1]];scope=null;}catch(e){Zapatec.Log({description:"Incorrect path passed to Zapatec.Hash.getByPath function!",type:"warning"});return{result:false};}}paths[item]=paths[item].replace(name,"");}++item;}if(typeof value=="undefined"){Zapatec.Log({description:"Incorrect path passed to Zapatec.Hash.getByPath function!",type:"warning"});return{result:false};}return{result:true,value:value};};Zapatec.Hash.setByPath=function(hash,path,val){if(!path||typeof path!="string"){Zapatec.Log({description:"Not a path passed to Zapatec.Hash.setByPath function!",type:"warning"});return false;}var paths=path.split(".");if(!paths.length){Zapatec.Log({description:"Wrong path passed to Zapatec.Hash.setByPath function!",type:"warning"});return false;}var lastItem=paths[paths.length-1];var obj=hash;var getPath=paths.slice(0,-1).join(".");var arrIndexReg=/\[[^\[\]]+\]$/;if(arrIndexReg.test(lastItem)){getPath+=(getPath==""?"":".")+lastItem.replace(arrIndexReg,"");lastItem=lastItem.match(/\[["']?([^\[\]"']+)["']?\]$/)[1];}if(getPath!=""){var obj=Zapatec.Hash.getByPath(hash,getPath).value;}try{obj[lastItem]=val;}catch(e){Zapatec.Log({description:"Incorrect path passed to Zapatec.Hash.setByPath function!",type:"warning"});return false;}return true;};Zapatec.isHtmlElement=function(el){if(!el||el.nodeType!=1){return false;}return true;};Zapatec.isSizableObj=function(obj){if(obj&&obj.hasInterface&&obj.hasInterface("Zapatec.Sizable")){return true;}return false;};Zapatec.isMovableObj=function(obj){if(obj&&obj.hasInterface&&obj.hasInterface("Zapatec.Movable")){return true;}return false;};Zapatec.isArray=function(arr){if(arr&&typeof arr=="object"&&arr.constructor==Array){return true;}return false;};Zapatec.isDate=function(date){if(date&&typeof date=="object"&&date.constructor==Date){return true;}return false;};Zapatec.SRProp=function(obj){this.obj=obj;this.savedProps=new Zapatec.Hash();Zapatec.Utils.createProperty(obj,"restorer",this);}Zapatec.SRProp.prototype.getSavedProps=function(){return this.savedProps;};Zapatec.SRProp.prototype.getObject=function(){return this.obj;};Zapatec.SRProp.prototype.saveProp=function(propName){if(typeof propName!="string"){return false;}var value=Zapatec.Hash.getByPath(this.getObject(),propName);if(value.result){if(typeof this.getProp(propName)!="undefined"){var prop=this.getSavedProps()[propName]=Zapatec.Array(this.getSavedProps()[propName]);prop.push(value.value);prop.combination=true;Zapatec.Log({description:"The property '"+propName+"' now contains more than one value!",type:"warning"});}else{this.getSavedProps()[propName]=value.value;}return true;}else{return false;}}Zapatec.SRProp.prototype.saveProps=function(){var result=[];for(var i=0;i<arguments.length;++i){if(this.saveProp(arguments[i])){result.push(arguments[i]);}}return result;}Zapatec.SRProp.prototype.restoreProp=function(propName){if(typeof propName!="string"||typeof this.getSavedProps()[propName]=="undefined"){return false;}var prop=this.getSavedProps()[propName];var combination=false,nextSibling=null;if(Zapatec.isArray(prop)&&prop.combination){prop=prop[prop.length-1];combination=true;}if(propName.match(/parentNode$/)!==null&&prop&&typeof prop=="object"&&prop.appendChild){nextSibling=this.getSavedProps()[propName.replace(/parentNode/,"nextSibling")]||null;if(nextSibling&&nextSibling.parentNode==prop){prop.insertBefore(this.getObject(),nextSibling);}else{prop.appendChild(this.getObject());}this.savedProps=this.getSavedProps().hashRemove(propName.replace(/parentNode/,"nextSibling"));}else{if(!Zapatec.Hash.setByPath(this.getObject(),propName,prop)){return false;}}if(!combination){this.savedProps=this.getSavedProps().hashRemove(propName);}else{prop=this.getSavedProps()[propName];this.getSavedProps()[propName]=Zapatec.Array.without(prop,prop.length-1);}return true;}

⌨️ 快捷键说明

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