📄 ig_weblistbar2_2.js
字号:
function iglbar_Slide(expand){
clearInterval(this.ShrinkProcess);
this.Group.originalItemAreaStyleHeight = (this.Group.originalItemAreaStyleHeight==null ? this.ItemsArea.style.height : this.Group.originalItemAreaStyleHeight) ;
this.Group.originalItemAreaParentStyleHeight = (this.Group.originalItemAreaParentStyleHeight==null ? this.ItemsArea.offsetParent.style.height : this.Group.originalItemAreaParentStyleHeight);
if(this.Group.itemsHeight==null || (!expand && this.Group.itemsHeight!=this.ItemsArea.offsetHeight))this.Group.itemsHeight=this.ItemsArea.offsetHeight;
this.AlphaConstant=100/parseInt(this.Group.itemsHeight);
myid=this.Group.Id;
if(expand){
this.ItemsArea.offsetParent.style.filter="alpha(opacity=1)";
this.ItemsArea.style.height=1;
this.ItemsArea.offsetParent.style.height=1;
this.Opacity=1;
this.ShrinkProcess=setInterval("iglbar_SlideDown('"+myid+"')",10);
}
else{
if(ig_csom.IsIE) this.ItemsArea.style.overflowY="hidden";
else this.ItemsArea.style.overflow="hidden";
this.ItemsArea.offsetParent.style.filter="alpha(opacity=100)";
this.ItemsArea.style.height=this.Group.itemsHeight;
this.ItemsArea.offsetParent.style.height=this.Group.itemsHeight;
this.Opacity=100;
this.ShrinkProcess=setInterval("iglbar_SlideUp('"+myid+"')",10);
}
}
function iglbar_SlideDown(groupId){
var expandEffect=iglbar_getGroupById(groupId).ExpandEffect;
var curHeight=parseInt(expandEffect.ItemsArea.style.height);
if((parseInt(expandEffect.Group.itemsHeight)-curHeight)<11){
clearInterval(expandEffect.ShrinkProcess);
expandEffect.ItemsArea.style.height=expandEffect.Group.itemsHeight;//(6*(originalHeight/curHeight));
expandEffect.ItemsArea.offsetParent.style.height=expandEffect.ItemsArea.style.height;
if(expandEffect.ItemsArea.filters)expandEffect.ItemsArea.offsetParent.filters[0].opacity=100;
shrinkProcess=null;
expandEffect.ItemsArea.style.height = expandEffect.Group.originalItemAreaStyleHeight ;
expandEffect.ItemsArea.offsetParent.style.height = expandEffect.Group.originalItemAreaParentStyleHeight ;
expandEffect.Group.originalItemAreaStyleHeight = null;
expandEffect.Group.originalItemAreaParentStyleHeight = null;
if(ig_csom.IsIE) expandEffect.ItemsArea.style.overflowY="";
else expandEffect.ItemsArea.style.overflow="";
return;
}
expandEffect.ItemsArea.style.height=(parseInt(expandEffect.ItemsArea.style.height)+10);//(6*(originalHeight/curHeight));
expandEffect.ItemsArea.offsetParent.style.height=expandEffect.ItemsArea.style.height;
expandEffect.Opacity=expandEffect.Opacity+(10*expandEffect.AlphaConstant);
if(expandEffect.ItemsArea.filters)expandEffect.ItemsArea.offsetParent.filters[0].opacity=expandEffect.Opacity;//itemsArea.offsetParent.filters[0].opacity-alphaConst;
}
function iglbar_SlideUp(groupId){
var expandEffect=iglbar_getGroupById(groupId).ExpandEffect;
var curHeight=parseInt(expandEffect.ItemsArea.style.height);
if(curHeight<11){
clearInterval(expandEffect.ShrinkProcess);
expandEffect.ItemsArea.style.height=1;//(6*(originalHeight/curHeight));
expandEffect.ItemsArea.offsetParent.style.height=1;
if(expandEffect.ItemsArea.filters)expandEffect.ItemsArea.offsetParent.filters[0].opacity=0;
shrinkProcess=null;
ig_csom.getElementById(expandEffect.Group.Id+"_items").style.display="none";
return;
}
expandEffect.ItemsArea.style.height=(parseInt(expandEffect.ItemsArea.style.height)-10);//(6*(originalHeight/curHeight));
expandEffect.ItemsArea.offsetParent.style.height=expandEffect.ItemsArea.style.height;
expandEffect.Opacity=expandEffect.Opacity-(10*expandEffect.AlphaConstant);
if(expandEffect.ItemsArea.filters)expandEffect.ItemsArea.offsetParent.filters[0].opacity=expandEffect.Opacity;//itemsArea.offsetParent.filters[0].opacity-alphaConst;
}
function iglbar_expandEffect(group){
this.ShrinkProcess=0;
this.ItemsArea=ig_csom.getElementById(group.Id+"_items").firstChild;
while(this.ItemsArea!=null&&this.ItemsArea.tagName!="TD"){this.ItemsArea=this.ItemsArea.nextSibling;}
if(this.ItemsArea==null||this.ItemsArea.tagName!="TD")return;
this.ItemsArea=this.ItemsArea.firstChild;
while(this.ItemsArea!=null&&this.ItemsArea.tagName!="DIV"){this.ItemsArea=this.ItemsArea.nextSibling;}
this.Group=group;
this.Opacity=100;
this.Expand=iglbar_Slide;
}
function iglbar_selectGroup(select){
/*******
* We only care about group.Element[0] which is the button which appears in the top
* Group of buttons. Since this style is only applied when a group is selected, it
* will never be applied to the bottom list of groups.
******/
if(select){
this.Control.update(null, null, "SelectedGroup", this.i);
if(this.Control!=null&&this.Control.Events.AfterGroupSelected[1]) this.Control.doPost(this.Id+":GroupSelected");
if(this.Control.SelectedGroup!=null)this.Control.SelectedGroup.setSelected(false);
this.selected=true;
this.Control.SelectedGroup=this;
this.Element[0].className=this.ButtonSelectedStyleClassName;
this.Element[1].className=this.ButtonStyleClassName; //The button may not receive the mouseout event. In this case, we need to change the style back to the Default style manually.
iglbar_adjust(this.Control);
}else{
this.selected=false;
if(this.Control.SelectedGroup==this)this.Control.SelectedGroup=null;
this.Element[0].className=this.ButtonStyleClassName;
}
}
function iglbar_selectItem(select){
if(select){
this.Group.Control.update(null, null, "SelectedIndex", "" + this.Group.i + "i" + this.i);
if(this.Group.Control!=null&&this.Group.Control.Events.AfterItemSelected[1]) this.Group.Control.doPost(this.Id + ":ItemSelected");
if(this.Group.Control.SelectedItem!=null)this.Group.Control.SelectedItem.setSelected(false);
this.Group.Control.SelectedItem=this;
this.selected=true;
iglbar_navigate(this.TargetUrl,this.TargetFrame);
if(this.Group.ItemSelectionStyle==1&&this.getImage()!=null)
this.getImage().className=this.SelectedStyleClassName;
else this.Element.className=this.SelectedStyleClassName;
if(this.SelectedImageUrl!=null&&this.SelectedImageUrl.length>0)
this.getImage().src=this.SelectedImageUrl;
}else{
this.Group.Control.SelectedItem=null;
this.selected=false;
if(this.Group.ItemSelectionStyle==1&&this.getImage()!=null)
this.getImage().className=this.DefaultStyleClassName;
else this.Element.className=this.DefaultStyleClassName;
if(this.ImageUrl!=null&&this.ImageUrl.length>0)
this.getImage().src=this.ImageUrl;
}
}
function iglbar_pickupGroup(evt, src, group)
{
if(group.Control.AllowGroupMoving != 1 || !group.getEnabled())return;
iglbar_SourceGroup=group.Element;
var oEvent=iglbar_fireEvent(group.Control,group.Control.Events.BeforeGroupMove[0],group,evt);
if(oEvent!=null&&oEvent.cancel) return;
iglbar_CurrentX =(evt.pageX?evt.pageX:(evt.clientX + document.body.scrollLeft));
iglbar_CurrentY =(evt.pageY?evt.pageY:(evt.clientY + document.body.scrollTop));
if(ig_csom.IsIE){
iglbar_SourceGroup.onmouseup=iglbar_dropGroup;
iglbar_SourceGroup.setCapture();
}
ig_cancelEvent(evt);
iglbar_AllowMove=1;
}
function iglbar_MoveGroup(evt)
{
if(evt == null) if((evt = window.event) == null) return;
if(iglbar_AllowMove < 1) return;
if(evt.button == 0 && ig_csom.IsIE){iglbar_dropGroup(evt); return;}
NewX = evt.pageX?(evt.pageX):(document.body.scrollLeft+evt.clientX);
NewY = evt.pageY?(evt.pageY):(document.body.scrollTop+evt.clientY);
DistanceX = (NewX - iglbar_CurrentX);
DistanceY = (NewY - iglbar_CurrentY);
if(DistanceX>3||DistanceY>3||DistanceY<-3||DistanceX<-3)
iglbar_startDrag(evt);
if(iglbar_AllowMove==1)return;
var oGroup=iglbar_getGroupById(iglbar_SourceGroup.id);
if(oGroup.Control.Events.GroupDrag[0]!=null&&oGroup.Control.Events.GroupDrag[0].length>0){
var oEvent=new ig_EventObject();
oEvent.event=evt;
ig_fireEvent(oGroup.Control,oGroup.Control.Events.GroupDrag[0],oGroup,iglbar_CloneGroup,evt);
if(oEvent!=null&&oEvent.cancel){
iglbar_dropGroup(evt);
return;
}
}
ig_cancelEvent(evt);
iglbar_CurrentX = NewX;
iglbar_CurrentY = NewY;
iglbar_CloneGroup.style.left=(parseInt(iglbar_CloneGroup.style.left)+DistanceX).toString();//+"px";
iglbar_CloneGroup.style.top=(parseInt(iglbar_CloneGroup.style.top)+DistanceY).toString();//+"px";
}
function iglbar_startDrag(evt){
if(iglbar_AllowMove==2)return;
iglbar_AllowMove=2;
var groupPosition=iglbar_getPosition(iglbar_SourceGroup);
var width=iglbar_SourceGroup.offsetWidth;
iglbar_CloneGroup=iglbar_SourceGroup.cloneNode(true);
iglbar_CloneGroup.style.position="absolute";
iglbar_CloneGroup.style.left=groupPosition.x;
iglbar_CloneGroup.style.top=groupPosition.y;
iglbar_CloneGroup.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=50)";
iglbar_CloneGroup.style.width=width;
iglbar_CloneGroup.style.zIndex=1000;
document.body.appendChild(iglbar_CloneGroup);
document.body.style.cursor="move";
}
function iglbar_getPosition(el){
for (var lx=0,ly=0;el!=null;lx+=(el.offsetLeft-el.scrollLeft),ly+=(el.offsetTop-el.scrollTop),el=el.offsetParent);
return {x:lx+(window.pageXOffset?window.pageXOffset:(document.body.scrollLeft?document.body.scrollLeft:0)),y:(ly+(window.pageYOffset?window.pageYOffset:(document.body.scrollTop?document.body.scrollTop:0)))}
}
function iglbar_dropGroup(evt)
{
if(iglbar_AllowMove < 1) return;
if(evt == null) evt = window.event;
var group=iglbar_getGroupById(iglbar_SourceGroup.id);
if(ig_csom.IsIE){
iglbar_SourceGroup.onmouseup="";
iglbar_SourceGroup.releaseCapture();
}
if(iglbar_AllowMove==1) group = null;
iglbar_AllowMove=0;
if(group == null) return;
var listbar=iglbar_getListbarById(iglbar_SourceGroup.id);
var i=0;
var insertGroup=iglbar_SourceGroup;
var oldY=0;
while(listbar.Groups[i]!=null){
var newY=parseInt(iglbar_getPosition(listbar.Groups[i].Element).y);
if(newY<parseInt(iglbar_CloneGroup.style.top)&&newY>oldY&&insertGroup.tagName=="TABLE"){
insertGroup=listbar.Groups[i].Element;
oldY=newY;
}
i++;
}
document.body.removeChild(iglbar_CloneGroup);
if(iglbar_SourceGroup!=insertGroup||(iglbar_SourceGroup==insertGroup&&oldY==0))
{
if(oldY==0)
{
insertGroup.offsetParent.insertBefore(iglbar_SourceGroup,insertGroup.offsetParent.firstChild);
}else if(insertGroup.nextSibling)
{
insertAtElement=insertGroup.nextSibling;
while(insertAtElement!=null&&insertAtElement.tagName!="TABLE")insertAtElement=insertAtElement.nextSibling;
if(insertAtElement!=null&&insertAtElement.tagName=="TABLE")insertGroup.offsetParent.insertBefore(iglbar_SourceGroup,insertAtElement);
else insertGroup.offsetParent.appendChild(iglbar_SourceGroup);
}else insertGroup.offsetParent.appendChild(iglbar_SourceGroup);
var order = "";
i = -1;
//vs: needs more work
while(++i < listbar.groupCount) order += listbar.Groups[i].getVisibleIndex() + "i";
listbar.update(null, null, "GroupOrder", order);
}
var image=group.HeaderAppearance.Image;
if(image!=null)
{
image.style.visibility="hidden";
image.style.visibility="visible";
}
if(!(ig_csom.IsIE)){
iglbar_fixNetscapeImages(listbar.Groups);
}
document.body.style.cursor="default";
var oEvent=(iglbar_fireEvent(group.Control,group.Control.Events.AfterGroupMove[0],group,evt));
}
function iglbar_fixNetscapeImages(Groups){
var i=0;
if(Groups==null)return;
while(Groups[i]!=null){
if(Groups[i].HeaderAppearance.Image!=null){
Groups[i].HeaderAppearance.Image.style.visibility="hidden";
Groups[i].HeaderAppearance.Image.style.visibility="visible";
}
i++;
}
}
function iglbar_getVisibleIndex(){
var currentGroup=this.Element.offsetParent.firstChild;
var i=0;
while(currentGroup!=null&¤tGroup!=this.Element){if(currentGroup.tagName=="TABLE")i++;currentGroup=currentGroup.nextSibling}
return i;
}
function iglbar_fireEvent(listbar,name,target,browserEvent){
var oEvent;
if(name==null||name.length<=0)return null;
if(iglbar_fireEvent.arguments.length>4)
oEvent=iglbar_fireEvent.arguments[4];
else oEvent=new ig_EventObject();
oEvent.event=browserEvent;
ig_fireEvent(listbar,name,target,oEvent);
return oEvent;
}
function iglbar_k(k, ii)
{
var x = 0, i = -1, l = (k == null) ? 0 : k.length;
while(++i < l)
{
var d = k.charCodeAt(i) - 48;
if(d < 0 || d > 9) return k;
x = x * 10 + d;
}
return (x < ii) ? null : k;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -