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

📄 680.js

📁 包括电子政务系统的架构设计、工作流引擎的设计与开发、工作流图形定义工具的设计与开发等
💻 JS
📖 第 1 页 / 共 2 页
字号:
<!--[346,1,680] published at 2009-04-10 19:15:49 from #221 by 1430-->/**---------------------------------------------------------------------------
* browser determine;
*/
{
	var ua = navigator.userAgent;
	var $IE = (navigator.appName == "Microsoft Internet Explorer");
	var $IE5 = $IE && (ua.indexOf('MSIE 5') != -1);
	var $IE5_0 = $IE && (ua.indexOf('MSIE 5.0') != -1);
	var $Gecko = ua.indexOf('Gecko') != -1;
	var $Safari = ua.indexOf('Safari') != -1;
	var $Opera = ua.indexOf('Opera') != -1;
	var $Mac = ua.indexOf('Mac') != -1;
	var $NS7 = ua.indexOf('Netscape/7') != -1;
	var $NS71 = ua.indexOf('Netscape/7.1') != -1;
	if ($Opera) {
		$IE = true;
		$Gecko = false;
		$Safari =  false;
	}
	if ($IE5) {
	        $IE = true;
	        $Gecko = false;
	        $Safari =  false;
	}
}
function $_t(root,tag,id){
	var ar=root.getElementsByTagName(tag);
	for (var i=0;i<ar.length;i++){
		if (ar[i].id==id) return ar[i];
	}
	return null;
}
function _(root){
	var ids=arguments;
	var i0=0;
	if (typeof(root) == 'string') root = document;
	else i0=1;
	for (var i=i0;i<ids.length;i++){
		var s=root.getElementsByTagName("*");
		var has=false;
		for (var j=0;j<s.length;j++){
			if (s[j].id==ids[i]){
				root=s[j];
				has=true;
				break;
			}
		}
		if (!has) return null;
	}
	return root;
}
//util
function $dele(o,fn,rv){
	var r = function (){
		var s=arguments.callee;
		var args = [];
		for (var i=0;i<s.length;i++) args[i]=s[i];
		var argStr = args.join(",");
		if (argStr.length > 0) argStr=","+argStr;
		var callStr="s.thiz[s.fn]("+argStr+")";
		var v=eval(callStr);
		if (s.rv!=null) {
			return s.rv;
		}	else {
			return v;
		}
	}
	r.thiz=o;
	r.fn=fn;
	r.rv=rv;
	return r;
}
function $ge(e){
	if (e!=null) return e;
	if ($IE) {
		return window.event;
	}	else return e;
}
/**
* get event for a element;
*/
function $gte(e,ev){
	if (!e.getElementById) e=e.ownerDocument;
	if ($IE) {
		return ev!=null ? ev : e.parentWindow.event;
	} else {
		return ev;
		throw new Error("this method can only execute in IE");
	}
}
function $addEL(n,e,l,b){
	if ($IE){
		if (n["$__listener_"+e]==null){
			var lst=function (e){
				var f=arguments.callee;
				var ar=f.fList;
				e=$ge(e);
				for (var i=0;i<ar.length;i++){					
					ar[i](e);
				}
			}
			lst.fList=[];			
			n["$__listener_"+e]=lst;
			n["on"+e]=n["$__listener_"+e];
		}
		var fList=n["$__listener_"+e].fList;
		fList[fList.length]=l;
	} else {
		n.addEventListener(e,l,b);
	}
}
function $cancelEvent (e) {
	if ($IE) {
		e.returnValue = false;
		e.cancelBubble = true;
	} else
		e.preventDefault();
};
function $cpAttr(o,p){
	for (var i in p){
		var s=p[i];
		o[i]=s;
	}
	return o;
}
function $getValue(v,d){
	return v==null ? d : v;
}
var $gv=$getValue;
var $dom={
	parseInt : function(s) {
		if (s == null || s == '' || typeof(s)=='undefined')
			return 0;
		return parseInt(s);
	},
	getClientSize : function(n){
		if ($IE){
			//ts("this is ie");
			var s= {x:n.clientLeft,y:n.clientTop};
			s.l=s.x;
			s.t=s.y;
			s.r=n.clientRight;
			s.b=n.clientBottom;
			s.w=n.clientWidth;
			s.h=n.clientHeight;
			//tr("calculated client size");
			return s;
		} else {
			var t=n.style;
			if (t.borderLeftWidth.length==0 || t.borderTopWidth.length==0 || t.borderRightWidth.length==0 || t.borderBottomWidth.length==0){
				var l=n.offsetWidth;
				t.borderLeftWidth="0px";
				l-=n.offsetWidth;
				var r=n.offsetWidth;
				t.borderRightWidth="0px";
				r-=n.offsetWidth;
				var o=n.offsetHeight;
				t.borderTopWidth="0px";
				o-=n.offsetHeight;
				var b=n.offsetHeight;
				t.borderBottomWidth="0px";
				b-=n.offsetHeight;
				t.borderLeftWidth=l+"px";
				t.borderTopWidth=o+"px";
				t.borderRightWidth=r+"px";
				t.borderBottomWidth=b+"px";
				var s={l:l,r:r,t:o,b:b,x:l,y:o};
				return s;
			} else {
				var s= {
						x: this.parseInt(n.style.borderLeftWidth),
						y: this.parseInt(n.style.borderTopWidth),
						r: this.parseInt(n.style.borderRightWidth),
						b: this.parseInt(n.style.borderBottomWidth)
					};
				s.l=s.x;
				s.t=s.y;
				return s;
			}
		}
	},
	getSize : function (n,withMargin){
		var c={
			x : n.offsetWidth != null ? n.offsetWidth : 0,
			y : n.offsetHeight != null ? n.offsetHeight : 0
		};
		//c.x=this.parseInt(c.x);
		//c.y=this.parseInt(c.y);
		//tr("get size for : "+n.id);
		//tra(c);
		if (withMargin) {
			var m=this.getMargin(n);
			c.x+=m.l+m.r;
			c.y+=m.t+m.b;
		}
		//tra(m);
		//tr("get size for : "+n.id);
		//tra(c);
		return c; 
	},
	setSize : function(elmt,x,y,withMargin){
		//tf("$dom::setSize");
		//if (elmt==undefined || elmt.style.display=="none") return;
		if ($IE){
			if (withMargin){				
				var m=this.getMargin(elmt);
				x-=m.l+m.r;
				y-=m.t+m.b;				
			}			
			elmt.style.width=x;			
			elmt.style.height=y;			
		} else {
			var clientSize=this.getClientSize(elmt);
			var dx=clientSize.l+clientSize.r;
			var dy=clientSize.t+clientSize.b;
			elmt.style.width=x-dx+"px";
			elmt.style.height=y-dy+"px";
		}
	},
	/**
	* get the context position relative to its parent.
	*/
	getPosition : function (elmt,withMargin){
		var c;
		c={
			x:elmt.offsetLeft,
			y:elmt.offsetTop
		};
		//c.x=this.parseInt(c.x);
		//c.y=this.parseInt(c.y);
		if (withMargin){
			var m=this.getMargin(elmt);
			c.x-=m.l;
			c.y-=m.t;
		}
		return c;
	},
	setPosition : function (elmt,x,y,withMargin){
		//tf("$dom::setPosition");
		if (withMargin){
			//var m=this.getMargin(elmt);
			//x-=m.l;
			//y-=m.t;
		}	
		elmt.style.left=x+"px";
		elmt.style.top=y+"px";
	},
	setAlpha : function (n,a){
		return;
		n.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+a*100+");";
		n.style.opacity = a;
		n.style.MozOpacity = a;
	}
}
var $motion={
	smooth : function (s, e, t){
		if (t>1) t=1;
		return (e - s) * t + s;
	}
}
// this is a default config object.
/*
var $config={
	width 			: 300,
	height 			: 200,
	bottom			: 0,
	right			: 10,
	display			: true,
	contentUrl		: "http://bbs.sina.com.cn/tuijian/gundong.html",
	time : {
		slideIn			: 10,
		hold			: 10,
		slideOut		: 10
	}
}
*/
/**
* PopUp class used to pop a message up.
* Usage : 
* var pp = new PopUp(id, popup_config_obj);
* pp.create();
* ....
* pp.show();
*/
function PopUp(id, config){
	this.id=id;
	var c = this.config = config;
	c.width 	= $gv(c.width,300);
	c.height 	= $gv(c.height,200);
	c.bottom 	= $gv(c.bottom,0);
	c.right 	= $gv(c.right,20);
	c.display 	= $gv(c.display,true);
	c.contentUrl= $gv(c.contentUrl,"");
	c.motionFunc= $gv(c.motionFunc,$motion.smooth);
	c.position	= {x:0,y:0};
	var t=c.time;
	t.slideIn	= $gv(t.slideIn,10);
	t.hold		= $gv(t.hold,10);
	t.slideOut	= $gv(t.slideOut,10);
	t.slideIn 	*= 1000;
	t.hold		*= 1000;
	t.slideOut	*= 1000;
	this.container = document.body;
	this.popup = null;
	this.content = null;
	this.switchButton = null;
	this.moveTargetPosition = 0;
	this.startMoveTime = null;
	this.startPosition = null;
	this.status = PopUp.STOP;
	this.intervalHandle = null;
	this.mm = "max";
	this.imgMin1 = "http://i2.sinaimg.cn/blog/mini/08olympic/blogrecommend_hz_004.gif";
	this.imgMin2 = "http://i1.sinaimg.cn/blog/mini/08olympic/yzq_001.gif";
	this.imgMax = "http://i2.sinaimg.cn/blog/mini/08olympic/blogrecommend_hz_003.gif";
}
//static members
PopUp.STOP = 0;
PopUp.MOVE_DOWN = 1;
PopUp.MOVE_UP = 2;
PopUp.SWITCH_TO_MIN = PopUp.MOVE_DOWN | 4;
PopUp.SWITCH_TO_MAX = PopUp.MOVE_UP | 8;
var __o={
	create : function (){
		var doc=document;
		var c=this.config;	
		//create popup holder & config it.
		var p = this.popup = doc.createElement("div");
		this.container.appendChild(p);
		p.id=this.id;
		p.style.cssText="position:absolute;\
						z-index:9000;\
						overflow:hidden;\
						border:0px solid #f00;\
						";
		$dom.setSize(p, c.width, c.height);
		//create popup content holder & config it.
		var t = this.content = doc.createElement("div");

⌨️ 快捷键说明

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