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

📄 ig_weblistbar2_2.js

📁 研究怎样通过手写代码来完成自动生成代码
💻 JS
📖 第 1 页 / 共 3 页
字号:
	this.setEnabled=iglbar_setEnabled;
	if(props[3]==1)
	{
		if((this.AllowGroupMoving = props[5]) == 1) if(!iglbar_moveLsnr)
		{
			iglbar_moveLsnr = true;
			ig_csom.addEventListener(window.document, "mousemove", iglbar_MoveGroup);
			ig_csom.addEventListener(window.document, "mouseup", iglbar_dropGroup);
		}
		this.HeaderClickAction=props[6];
		this.GroupExpandEffect=props[7];
	}
	var k, i = groups.length;
	for(var j = 0; j < i; j++)
	{
		var a = groups[j]; a.Control = this; a.i = j;//must be permanent
		if((k = iglbar_k(a.Key, i)) != null) groups[k] = a;
	}
	this.groupCount = i;//can be increased only
	this.update = function(group, item, p, v)
	{
		if(this.isInitializing)return;
		if(this.elemState == null) if((this.elemState = ig_csom.getElementById(this.uniqueID + "_hidden")) == null)
			return;
		if(this.state == null) this.state = new ig_xmlNode();
		var n = this.state.addNode("x", true);
		if(group != null)
		{
			n = n.addNode("Groups", true).addNode("i" + group.i, true);
			if(item != null)
				n = n.addNode("Items", true).addNode("i" + item.i, true);
		}
		n.setPropertyValue(p, "" + v);
		this.elemState.value = this.state.getText();
	}
	this.doPost = function(val)
	{
		if(this.isInitializing)return;
		try{if(document.activeElement != null) document.activeElement.fireEvent("onblur"); else window.blur();}catch(ex){}
		try{__doPostBack(this.uniqueID, val);}catch(ex){}
	}
	this.setGrText = function(gr, v)
	{
		var id = gr.Id + "_text";
		if(!gr.HeaderAppearance){this.setText(gr, id + "_bottom", v); id += "_top";}
		this.setText(gr, id, v);
	}
	this.setText = function(item, id, v)
	{
		var e = ig_csom.getElementById(id);
		if(!ig_csom.isArray(v) || e == null) return;
		item.txt = v;
		var gr = item.Group;
		if(gr == null){gr = item; item = null;}
		var t = v, n = e.childNodes;
		var i = (n == null) ? 0 : n.length;
		while(i-- > 0)
		{
			if(t == v && n[i].nodeName == "#text"){n[i].nodeValue = v; t = null;}
			else if(n[i].nodeName != "IMG") e.removeChild(n[i]);
		}
		if(t == v)try{e.innerHTML = " " + v + " ";}catch(ex){}
		this.update(gr, item, "Text", v);
	}
	if(this.SelectedItem!=null){
		//Use the setSelected method, so that any targetUrls get loaded.
		//this.SelectedItem.selected=true;
		this.SelectedItem.setSelected(true);
	}
	this.isInitializing=false;
	ig.addEventListener(window,"unload",iglbar_onUnload,false);
}

function iglbar_onUnload(){
	ig_dispose(iglbar_all);
}

function iglbar_Events(events){
	this.AfterGroupSelected=events[0];
	this.AfterGroupCollapsed=events[1];
	this.AfterGroupExpanded=events[2];
	this.AfterItemSelected=events[3];
	this.BeforeGroupSelected=events[4];
	this.BeforeGroupCollapsed=events[5];
	this.BeforeGroupExpanded=events[6];
	this.BeforeItemSelected=events[7];
	this.InitializeListbar=events[8];
	this.MouseOver=events[9];
	this.MouseOut=events[10];
	this.BeforeGroupMove=events[11];
	this.AfterGroupMove=events[12];
	this.GroupDrag=events[13];
	this.HeaderClick=events[14];
	this.HeaderDoubleClick=events[15];
}

function iglbar_HeaderStyle(style,xpndImage,image,leftImage,rightImage){
	this.ClassName=style;
	this.ExpansionIndicatorImageUrl=xpndImage;
	this.ImageUrl=image;
	this.LeftCornerImageUrl=leftImage;
	this.RightCornerImageUrl=rightImage;
}
function iglbar_Header(xpnd,clpse,hover,xpandId,imageId,leftId,rightId){
	this.ExpandedAppearance=xpnd;
	this.CollapsedAppearance=clpse;
	this.HoverAppearance=hover;
	this.ExpansionIndicator=ig_csom.getElementById(xpandId);
	this.Image=ig_csom.getElementById(imageId);
	this.LeftCornerImage=ig_csom.getElementById(leftId);
	this.RightCornerImage=ig_csom.getElementById(rightId);
}
function iglbar_ExplorerBarGroup(id,text,key,enabled,groupStyle,headerAppearance,itemIconStyle,itemSelectionStyle,expanded,targetUrl,targetFrame,items){
	this.Id=id;
	this.Element=ig_csom.getElementById(id+"_group");
	this.txt = text;
	this.getText=function(){return this.txt;}
	this.setText=function(v){this.Control.setGrText(this, v);}
	this.Key=key;
	this.enabled=enabled;
	this.getEnabled=function(){return this.enabled && this.Control.getEnabled();}
	this.setEnabled=iglbar_setEnabled;
	this.GroupStyleClassName=groupStyle;
	this.HeaderAppearance=headerAppearance;
	this.ItemIconStyle=itemIconStyle;
	this.ItemSelectionStyle=itemSelectionStyle;
	this.Items=items;
	this.Items.ValueChanged=false;
	this.TargetUrl=targetUrl;
	this.TargetFrame=targetFrame;
	this.findControl=function(id){
		return ig_csom.findControl(this.Element,id);
	}
	this.expanded=expanded;
	this.getExpanded=function(){return this.expanded;}
	this.setExpanded=iglbar_expandGroup;
	this.getVisibleIndex=iglbar_getVisibleIndex;
	var header=ig_csom.getElementById(id+"_header");
	if(header!=null)
	{
		this.HeaderAppearance.Element=header;
		this.HeaderAppearance.Id=id+"_header";
		//13-key/focus/over/out,click,dblclick
		iglbar_addLsnr(header, this, 13);
	}
	var k, i = (items == null) ? 0 : items.length;
	for(var j = 0; j < i; j++)
	{
		var a = items[j]; a.Group = this; a.i = j;//must be permanent
		if((k = iglbar_k(a.Key, i)) != null) items[k] = a;
	}
	this.itemCount = i;//can be increased only
	//2-mousedown
	iglbar_addLsnr(ig_csom.getElementById(id), this, 2);
}
function iglbar_ListbarGroup(id,text,key,enabled,groupStyle,buttonStyle,buttonHovStyle,buttonSelStyle,itemIconStyle,itemSelectionStyle,targetUrl,targetFrame,items){
	this.Id=id;
	this.Element=new Array(2);
	var e = ig_csom.getElementById(id+"_top");
	//5-key/focus/over/out,click
	iglbar_addLsnr(e, this, 5);
	this.Element[0] = e;
	e = ig_csom.getElementById(id+"_bottom");
	iglbar_addLsnr(e, this, 5);
	this.Element[1] = e;
	this.txt = text;
	this.getText=function(){return this.txt;}
	this.setText=function(v){this.Control.setGrText(this, v);}
	this.Key=key;
	this.enabled=enabled;
	this.getEnabled=function(){return this.enabled && this.Control.getEnabled();}
	this.setEnabled=iglbar_setEnabled;
	this.GroupStyleClassName=groupStyle;
	this.ButtonStyleClassName=buttonStyle;
	this.ButtonHoverStyleClassName=buttonHovStyle;
	this.ButtonSelectedStyleClassName=buttonSelStyle;
	this.ItemIconStyle=itemIconStyle;
	this.ItemSelectionStyle=itemSelectionStyle;
	this.Items=items;
	this.Items.ValueChanged=false;
	this.findControl=function(controlId){
		var grpIndex=this.Id.split("_");
		return ig_csom.findControl(ig_csom.getElementById(grpIndex[0]+"_Items_"+grpIndex[2]),controlId);
	}
	this.selected=false;
	this.getSelected=function(){return this.selected;}
	this.TargetUrl=targetUrl;
	this.TargetFrame=targetFrame;
	this.setSelected=iglbar_selectGroup;
	var k, i = (items == null) ? 0 : items.length;
	for(var j = 0; j < i; j++)
	{
		var a = items[j]; a.Group = this; a.i = j;//must be permanent
		if((k = iglbar_k(a.Key, i)) != null) items[k] = a;
	}
	this.itemCount = i;//can be increased only
}

function iglbar_Item(id,text,key,defStyle,hovStyle,selStyle,targetUrl,targetFrame,image,selectedImage,enabled){
	this.Id=id;
	this.Element=ig_csom.getElementById(id);
	this.txt = text;
	this.getText=function(){return this.txt;}
	this.setText=function(text){this.Group.Control.setText(this, this.Id, text);}
	this.Key=key;
	this.DefaultStyleClassName=defStyle;
	this.HoverStyleClassName=hovStyle;
	this.SelectedStyleClassName=selStyle;
	this.TargetUrl=targetUrl;
	this.TargetFrame=targetFrame;
	this.ImageUrl=image;
	this.SelectedImageUrl=selectedImage;
	this.getImage=function(){return ig_csom.getElementById(this.Id+"_img");}
	this.selected=false;
	this.setSelected=iglbar_selectItem;
	this.getSelected=function(){return this.selected;}
	this.enabled=enabled;
	this.getEnabled=function(){return this.enabled && this.Group.getEnabled();}
	this.setEnabled=iglbar_setEnabled;
	//3-key/focus/over/out,mousedown
	iglbar_addLsnr(this.Element, this, 3);
}
function iglbar_setEnabled(enabled){
	this.enabled=enabled;
	if(enabled)this.Element.removeAttribute("disabled");
	else this.Element.setAttribute("disabled","disabled");
}
function iglbar_toggleGroup(e,src){
	e = (e) ? e : ((window.event) ? window.event : "");	
	var group=iglbar_getGroupById(src.id);
	if(group == null) return;
	if(!group.getEnabled())return true;
	var oEvent;
	if(group.getExpanded())
		oEvent=iglbar_fireEvent(group.Control,group.Control.Events.BeforeGroupCollapsed[0],group,e);
	else oEvent=iglbar_fireEvent(group.Control,group.Control.Events.BeforeGroupExpanded[0],group,e);
	if(oEvent!=null&&oEvent.cancel) return;
	if(oEvent==null)oEvent=new ig_EventObject();
	oEvent.reset();
	group.setExpanded(!group.getExpanded(),true);
	if(group.getExpanded())
		iglbar_fireEvent(group.Control,group.Control.Events.AfterGroupExpanded[0],group,e,oEvent);
	else iglbar_fireEvent(group.Control,group.Control.Events.AfterGroupCollapsed[0],group,e,oEvent);
	if(oEvent.needPostBack||(group.getExpanded()&&group.Control.Events.AfterGroupExpanded[1])||((!group.getExpanded())&&group.Control.Events.AfterGroupCollapsed[1])) group.Control.doPost(group.Id + ":" + (group.getExpanded() ? "GroupExpanded" : "GroupCollapsed"));
	if(src.tagName=="IMG"){
		e.cancelBubble=true;
		return false;
	}
}
function iglbar_expandGroup(expand,byMouse){
	if((!this.getEnabled())&&byMouse)return;
	this.expanded=expand;
	if(expand){
		ig_csom.getElementById(this.Id+"_items").style.display="";
		this.HeaderAppearance.ExpansionIndicator.src=this.HeaderAppearance.ExpandedAppearance.ExpansionIndicatorImageUrl;
		ig_csom.getElementById(this.Id+"_header").className=this.HeaderAppearance.ExpandedAppearance.ClassName;
		if(this.HeaderAppearance.LeftCornerImage!=null)
			this.HeaderAppearance.LeftCornerImage.src=this.HeaderAppearance.ExpandedAppearance.LeftCornerImageUrl;
		if(this.HeaderAppearance.RightCornerImage!=null)
			this.HeaderAppearance.RightCornerImage.src=this.HeaderAppearance.ExpandedAppearance.RightCornerImageUrl;
		if(this.HeaderAppearance.Image!=null)
			this.HeaderAppearance.Image.src=this.HeaderAppearance.ExpandedAppearance.ImageUrl;
		var agt=navigator.userAgent.toLowerCase();
		var isWin98=(agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1);
		if(this.Control.GroupExpandEffect==0 && !isWin98 ){
			if(this.ExpandEffect==null)this.ExpandEffect=new iglbar_expandEffect(this);
			this.ExpandEffect.Expand(true);
		}
	}
	else{
		if(this.Control.GroupExpandEffect==0 && !isWin98){
			if(this.ExpandEffect==null)this.ExpandEffect=new iglbar_expandEffect(this);
			this.ExpandEffect.Expand(false);
		}else ig_csom.getElementById(this.Id+"_items").style.display="none";
		this.HeaderAppearance.ExpansionIndicator.src=this.HeaderAppearance.CollapsedAppearance.ExpansionIndicatorImageUrl;
		ig_csom.getElementById(this.Id+"_header").className=this.HeaderAppearance.CollapsedAppearance.ClassName;
		if(this.HeaderAppearance.LeftCornerImage!=null)
			this.HeaderAppearance.LeftCornerImage.src=this.HeaderAppearance.CollapsedAppearance.LeftCornerImageUrl;
		if(this.HeaderAppearance.RightCornerImage!=null)
			this.HeaderAppearance.RightCornerImage.src=this.HeaderAppearance.CollapsedAppearance.RightCornerImageUrl;
		if(this.HeaderAppearance.Image!=null)
			this.HeaderAppearance.Image.src=this.HeaderAppearance.CollapsedAppearance.ImageUrl;
	}
	this.Control.update(this, null, "Expanded", expand);
	if(byMouse)iglbar_groupHeaderMouseOver(window.event,this.HeaderAppearance.Element,this);
}

⌨️ 快捷键说明

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