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

📄 ig_webpanel.js

📁 研究怎样通过手写代码来完成自动生成代码
💻 JS
📖 第 1 页 / 共 2 页
字号:
	var element=ig.getSourceElement(evt);
	if(!element.__isEventReady){
		while(element!=null && !element.__isEventReady && element.tagName!="BODY")element=element.parentNode;
	}
	return (element!=null?element.__callBackObject:null);
}
function igpnl_addCallBackHandler(objectToCallBack,element,eventName,functionHandler)
{
	element.__callBackObject=objectToCallBack;
	element.__isEventReady=true;
	ig.addEventListener(element,eventName,functionHandler,false);
}
function ig_PanelHeader(panel,element,props)
{
	this._panel				=panel;
	this._element			=element;
	this._imageElement		=ig.getElementById(this._element.id+"_img");
	this._expandedClass		=props[0];
	this._collapsedClass	=props[1];
	this._hoverClass		=props[2];
	
	ig.createHoverBehavior(this._panel,this._element,this.onMouseOver,this.onMouseOut);
	igpnl_addCallBackHandler(this._panel,this._imageElement,"click",this.onButtonClick);
	igpnl_addCallBackHandler(this._panel,this._element,"dblclick",this.onHeaderDoubleClick);
}
function igpnl_onSubmit(){
	if(ig_all&&ig_all.length){
		for(var control in ig_all)
		{
			if(control.Type=="WebPanel" && typeof control.updatePostField=="Function")
			{
				control.updatePostField();
			}
		}
	}
}
function igpnl_slide(expand,evt){
	this._event=evt;
	if(this._shrinkProcess)igpnl_endSlide(!expand,this);
	this._panel._originalContentAreaHeight = (this._panel._originalContentAreaHeight==null ? this._contentArea.style.height : this._panel._originalContentAreaHeight);
	this._panel._originalContentAreaParentHeight = (this._panel._originalContentAreaParentHeight==null ? this._contentArea.offsetParent.style.height : this._panel._originalContentAreaParentHeight);		
	if(this._panel._contentHeight==null || (!expand && this._panel._contentHeight!=this._contentArea.offsetHeight))this._panel._contentHeight=this._contentArea.offsetHeight;
	this._alphaConstant=100/parseInt(this._panel._contentHeight);
	myid=this._panel._id;
	var originalFilterString=this._contentArea.currentStyle?this._contentArea.currentStyle.filter:this._contentArea.style.filter;
	if(expand){
		if(this._contentArea.filters)
			if(!this._contentArea.filters["alpha"]){
				this._contentArea.style.filter=originalFilterString+" alpha(opacity=1)";
			}else{
				this._contentArea.filters["alpha"].enabled=true;
			}
		this._contentArea.style.height=1;
 		this._opacity=1;
		this._shrinkProcess=setInterval("igpnl_slideDown('"+myid+"')",10);
	}
	else{
		if(ig_csom.IsIE)
		{
			this._panel._header._element.style.height=this._panel._header._element.offsetHeight;
			this._contentArea.firstChild.style.overflowY="hidden";
		}
		else{
			this._contentArea.firstChild.style.overflow="hidden";
		}	
		if(this._contentArea.filters)
			if(!this._contentArea.filters["alpha"]){
				this._contentArea.style.filter=originalFilterString+" alpha(opacity=100)";
			}else{
				this._contentArea.filters["alpha"].enabled=true;
			}

		this._contentArea.style.height=this._panel._contentHeight;
		this._panel._element.style.height=this._panel._element.offsetHeight;
 		this._opacity=100;
		this._shrinkProcess=setInterval("igpnl_slideUp('"+myid+"')",10);
	}
}
function igpnl_slideDown(id){
	var expandEffect=igpnl_getPanelById(id)._expandEffectGenerator;
	var curHeight=parseInt(expandEffect._contentArea.style.height);

	if((parseInt(expandEffect._panel._contentHeight)-curHeight)<11){
		igpnl_endSlide(true,expandEffect);
		return;
	}
	expandEffect._contentArea.style.height=(parseInt(expandEffect._contentArea.style.height)+10);
	expandEffect._panel._element.style.height=(parseInt(expandEffect._panel._element.style.height)+10);
	expandEffect._opacity=expandEffect._opacity+(10*expandEffect._alphaConstant);
	if(expandEffect._contentArea.filters&&expandEffect._contentArea.filters["alpha"])expandEffect._contentArea.filters["alpha"].opacity=expandEffect._opacity;
}
function igpnl_slideUp(id){
	var expandEffect=igpnl_getPanelById(id)._expandEffectGenerator;
	var curHeight=parseInt(expandEffect._contentArea.style.height);
	if(curHeight<11){
		igpnl_endSlide(false,expandEffect);
		return;
	}
	expandEffect._contentArea.style.height=(parseInt(expandEffect._contentArea.style.height)-10);
	expandEffect._panel._element.style.height=(parseInt(expandEffect._panel._element.style.height)-10);
	expandEffect._opacity=expandEffect._opacity-(10*expandEffect._alphaConstant);
	if(expandEffect._contentArea.filters&&expandEffect._contentArea.filters["alpha"])expandEffect._contentArea.filters["alpha"].opacity=expandEffect._opacity;
}
function igpnl_endSlide(expanding,expandEffect){
	if(expanding){
		clearInterval(expandEffect._shrinkProcess);
		expandEffect._contentArea.style.height=expandEffect._panel._contentHeight;
		if(expandEffect._contentArea.filters&&expandEffect._contentArea.filters["alpha"])
		{
			expandEffect._contentArea.filters["alpha"].opacity=100;
			expandEffect._contentArea.filters["alpha"].enabled=false;
		}
		expandEffect._shrinkProcess=null;
		
		expandEffect._contentArea.style.height = expandEffect._panel._originalContentAreaHeight;
		expandEffect._panel._element.style.height = expandEffect._panel._originalContentAreaParentHeight;
		
		expandEffect._panel._originalContentAreaHeight = null; 
		expandEffect._panel._originalContentAreaParentHeight  = null;
		
		if(ig_csom.IsIE)	expandEffect._contentArea.firstChild.style.overflowY=expandEffect._originalOverflow;
		else  expandEffect._contentArea.firstChild.style.overflow=expandEffect._originalOverflow;
		expandEffect._panel.adjustSizes(true);		
		expandEffect._panel.notifyExpandComplete(expandEffect._event);
		return;
	}
	else{
		clearInterval(expandEffect._shrinkProcess);
		expandEffect._contentArea.style.height=1;
		if(expandEffect._contentArea.filters&&expandEffect._contentArea.filters["alpha"])expandEffect._contentArea.filters["alpha"].opacity=0;
		expandEffect._shrinkProcess=null;
		expandEffect._contentArea.style.display="none";
		expandEffect._panel.adjustSizes(false);
		expandEffect._panel._element.style.height=expandEffect._closedHeight;
		expandEffect._panel.notifyExpandComplete(expandEffect._event);
		return;
	}
}
function igpnl_ExpandEffectGenerator(panel){
	this._shrinkProcess=0;
	this._contentArea=panel._contentPanelElement;
	this._panel=panel;
	this._opacity=100;
	this._closedHeight=panel._header._element.offsetHeight;
	this._originalOverflow=(ig_csom.IsIE?this._contentArea.firstChild.style.overflowY:this._contentArea.firstChild.overflow);
	this.expand=igpnl_slide;
}

⌨️ 快捷键说明

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