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

📄 brocade.js

📁 使用php+js编写的brocade简单demo
💻 JS
📖 第 1 页 / 共 4 页
字号:
bc.a.ForString = Class.create(); bc.a.ForString.prototype = Object.extend(bc.a.ForSync,{}); 
bc.a.ForArray = Class.create(); bc.a.ForArray.prototype = Object.extend({ 	_trans: function(t) { 	try{ 	return this.errorMessage||t.split(","); 	}catch(e){ 	throw e; 	} 	} },bc.a.ForSync); 
bc.a.ForHash = Class.create(); bc.a.ForHash.prototype = Object.extend({ 	_trans: function(t) { 	try{ 	var a ; 	t=t.replace(/\\/g,''); 	eval("a={"+t.replace(/=+/g,': ')+"}"); 	return this.errorMessage||$H(a); 	}catch(e){ 	throw e; 	} 	} },bc.a.ForSync); 
bc.a.Html = Class.create(); bc.a.Html.prototype = Object.extend(new bc.a.Base(),{ 	initialize: function(url,options) { 	this.url = url; 	this.setOptions(options); 	this.options.eventType = options.eventType ? options.eventType : "click"; 		if(!this._catchEvent(this.el)) 	this.el(null); 		}, 	el: function(e) { 	if(this.options.preFunction) 	if(!this.options.preFunction())	return ; 	this.sendUpdateRequest(this.options.target); 		},  	handler:function(request) {  	if(this.options.postFunction){  	this.options.postFunction(request);  	}  	this.ri(false);  	},  	error:function(n,e){  	var obj=this;  	setTimeout(obj.ff(e),300);  	this.ri(false);  	},  	ff:function(e){  	$(this.options.target).innerHTML="";  	$(this.options.target).innerHTML='<iframe src="javascript:void(0);" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" name="'+this.options.target+'#ep" id="'+this.options.target+'#ep"></iframe>';  	Position.clone(this.options.target,this.options.target+"#ep");  	var ep=frames[this.options.target+"#ep"];  	ep.document.clear();  	ep.document.write(e);  	ep.document.close();  	}, 	indicator:function(b){  	if(this.options.indicator)  	this.options.indicator(b,$(this.options.target));  	else  	this._indicator(b);  	} });  
bc.w.Component = function(){}; bc.w.Component.prototype = { 		version: "0.1.011", 		type: "bc.w.Component", 		setProperties: function(options) {  this._p = this.properties = Object.extend({},options || {}); 	}, 		paint: function(id, options) { 	this.id=id;  	this._e= $(id);  	this.setProperties(options);  	 	 	if(this.properties.parent && $(this.properties.parent)){  	this.parent = $(this.properties.parent);  	}  	if(!this._e){  	if(this.parent){  	new Insertion.Bottom(this.parent,"<div id='"+id+"'></div>");  	}else{  	this._e = document.createElement("div");  	this._e.id = id;  	document.body.appendChild(this._e);  	}  	 	this._e= this._e || $(id);  	}  	this.element=this._e;  	this.style=this._e.style; 
 	this.setStyle=function(t){Element.setStyle(this._e,t)}.bind(this); 
 	this.getStyle=function(t){return Element.getStyle(this._e,t);}.bind(this); 
 	this.hasClassName=function(c){return Element.hasClassName(this._e,c);}; 
 	this.addClassName=function(c){Element.addClassName(this._e,c);}; 
 	this.removeClassName=function(c){Element.removeClassName(this._e,c);}; 
 	this.scrollTo=function(){Element.scrollTo(this._e);}; 
 	this.toggle=function(){Element.toggle(this._e)}; 
 	this.getDimensions=function(){return Element.getDimensions(this._e)};  	if(this.properties.className)  	this.addClassName(this.properties.className);  	this.scrollListener=this.obscr.bindAsEventListener(this); 	this.resizeListener=this.rs2mx.bindAsEventListener(this);  		var ua = navigator.userAgent;  	if(parseFloat(ua.substring(ua.indexOf("MSIE ") + 5, ua.indexOf(";", ua.indexOf("MSIE ")))) <=6){  	this.isFixIE=true;  	} 	}, 		setWidth:function(w){ 	var d=this._getBdr(this._e); 	var e=this._getPdg(this._e); 	this.setStyle({width:parseInt(w)-d[0]+"px"}); 	}, 		setHeight:function(h){ 	var d=this._getBdr(this._e); 	var e=this._getPdg(this._e); 	this.setStyle({height:parseInt(h)-d[1]-e[1]+"px"}); 	}, 		show : function(){ 	if(this.mask) 	Element.show(this.mask); 	Element.show(this._e); 	if(this.onShow) 	this.onShow(); 	}, 		hide:function(){ 	Element.hide(this._e); 	if(this.mask) 	Element.hide(this.mask); 	}, 		isShow : function(){ 	if(Element.visible(this._e)) 	return true; 	else 	return false; 	}, 		fixIE:function(){ 	if(!this.isFixIE) 	return; 	if(null==this.mask){ 	new Insertion.After(this._e,  	 '<iframe id="'+this.type+':'+this.id+'_mask" '+ 	 'style="position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);background:none;" ' +	 'src="javascript:void(0)" frameborder="0" scrolling="no"></iframe>'); 	 	this.mask = $(this.type+':'+this.id+'_mask'); 	} 	 Element.show(this.mask); 	Position.clone(this._e,this.mask); 		}, 	center:function(){ 	}, 		max:function(){ 	if(this.parent && !this.parent.size){ 	this.parent.size = Element.getDimensions(this.parent); 	this.parent.real = Position.cumulativeOffset(this.parent); 	} 	if(!this.isMax){ 	if(!this.parent){ 	window.scroll(0,0); 	Event.observe(window,"scroll",this.scrollListener); 	Event.observe(window,"resize",this.resizeListener); 	} 	if(this.properties.dragable){ 	this.real=[parseInt(this._e.style.left),parseInt(this._e.style.top)]; 	this.size = this.getDimensions(); 	}else 	this.real=Position.realOffset(this._e); 	Position.absolutize(this._e); 	this._cacheM=this.getStyle("margin"); 	this.setStyle({margin:'0px'}); 	var a=this._getBdr(this._e); 	var b=this._getPdg(this._e); 	var fixw=b[0]; 	var fixh=b[1]; 	if(this.parent){ 	var c=this._getPdg(this.parent); 	var d=this._getBdr(this.parent); 	fixw += c[0]+d[0]; 	fixh += c[1]+d[1]; 	} 	if(!this.isFixIE){ 	fixw += a[0]; 	fixh += a[1]; 	} 	if(this.parent){ 	this.setStyle({ 	top:this.parent.real[1]+d[0]/2+"px", 	left:this.parent.real[0]+d[1]/2+"px", 	width:this.parent.size.width-fixw+"px", 	height:this.parent.size.height-fixh+"px" 	}); 	}else{ 	var sz=Scroll.view(); 	this.setStyle({ 	top:'0px', 	left:'0px', 	width:sz[0]-fixw+"px", 	height:sz[1]-fixh+"px" 	}); 	} 	this.setStyle({zIndex:99999}); 		this.fixIE(); 	 if(this.onResize) 	this.onResize(); 	this.isMax=true; 	}else{ 	if(!this.properties.dragable) 	Position.relativize(this._e); 	if(null != this._cacheM) 	this.setStyle({margin:this._cacheM}); 	if(!this.parent){ 	Event.stopObserving(window,"scroll",this.scrollListener); 	Event.stopObserving(window,"resize",this.resizeListener); 	} 	t=new Scroll.position(); 	if(this.parent && !this.properties.dragable){ 	this.style.top="0px";	this.style.left=this.real[0]+"px"; 	}else{ 	this.style.top=this.real[1]+"px"; 	this.style.left=this.real[0]+"px"; 	if(this.properties.dragable) 	this.setStyle({width:this.size.width,height:this.size.height}); 	} 		this.style.zIndex=1; 	if(this.mask){ 	this.mask.style.zIndex = 0; 	Position.clone(this._e,this.mask); 	} 	if(this.onResize) 	this.onResize(); 	this.isMax = false; 	} 		}, 	min:function(){ 	}, 		rs2mx:function(){ 	var sz=Scroll.view(); 	var d=this._getBdr(this._e); 	var e=this._getPdg(this._e); 	this.setStyle({width:sz[0]-d[0]-e[0]+"px"}); 	this.setStyle({height:sz[1]-d[1]-e[1]+"px"}); 	}, 		obscr:function(evt){ 	var t=new Scroll.position(); 	var w=new Scroll.view(); 	this.style.top=t[1]+"px"; 	this.style.left=t[0]+"px"; 	}, 		getElement : function () { 	return this._e; 	}, 		setContent: function(c){ 		this._e.innerHTML = c; 	}, 		addChild : function (c) { 	this._e.appendChild(c instanceof bc.w.Component?c._e:$(c)); 	return c; 	}, 		removeChild : function (c) { 	this._e.remove(c instanceof bc.w.Component?c._e:$(c)); 	}, 		addEventListener:function(eventType,f){  	Event.observe(this._e,eventType,f);  	},  	 	removeEventListener:function(eventType,f){  	Event.stopObserving(this._e,eventType,f);  	},  	_getBdr:function(_e){ 	return [ 	parseInt(_e.style.borderRightWidth||'0')+parseInt(_e.style.borderLeftWidth||'0'), 	parseInt(_e.style.borderTopWidth||'0')+parseInt(_e.style.borderBottomWidth||'0'), 	]; 	}, 	_getPdg:function(_e){ 	return [ 	parseInt(_e.style.paddingLeft||'0')+parseInt(_e.style.paddingRight||'0'), 	parseInt(_e.style.paddingTop||'0')+parseInt(_e.style.paddingBottom||'0'), 	]; 	}, 	_getMgn:function(_e){ 	return [ 	parseInt(_e.style.marginLeft||'0')+parseInt(_e.style.marginRight||'0'), 	parseInt(_e.style.marginTop||'0')+parseInt(_e.style.marginBottom||'0'), 	]; 	}, 		_getWsp:function(e){ 	var b,p,m,v,h; 	b=this._getBdr(e); 	p=this._getPdg(e); 	m=this._getMgn(e); 	h=b[0]+p[0]+m[0]; 	v=b[1]+p[1]+m[1]; 	return [v,h]; 	}, 		equals:function(t){ 	if(!t.type || !t.toString) 	return false; 	if(t.type!=this.type) 	return false; 	if(t.id!=this.id) 	return false; 	return true; 	}, 	hashCode:function(s){ 	var h = 0; 	 var len = s.length; 	 for (var i = 0; i < len; i++) { 	 h = 31*h + s.charCodeAt(i); 	 }  return h; 	}, 		remove:function(){ 	Element.remove(this._e); 	if(this.mask) 	Element.remove(this.mask); 	}, 		toString: function(){ 	return this.type + ':' + this.id; 	} }; 
bc.w.Container = Class.create(); bc.w.Container.prototype = Object.extend(new bc.w.Component(),{ 	version: "0.1.000", 	type: "bc.w.Container", 	initialize: function(id,options) { 	this.paint(id,options); 	} });  

⌨️ 快捷键说明

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