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

📄 jsballoon.js

📁 原有短信通道业务处理流程是流水线模式,也就是一个线程处理完所有业务,后面的数据需要等待前面的数据处理完后方再次处理
💻 JS
📖 第 1 页 / 共 3 页
字号:
		Balloon content note: 
			Because SELECT objects are what's known as windowed controles
			they need to be hidden when balloons are shown, otherwise they will always be on top
			(they ignore zIndex attribute). It is normally done automatically by this control.
			Sometimes, however, you may want to place a drop-down inside the balloon itself.
			To override this default behaviour add an balloonMember expando attirbute to 
			the SELECT you are placing withing.
			
			- e.g. <SELECT id=select1 name=select1 balloonMember=true>
			
		Syntax:
			(start code)
			object.Show({[title:vTitle]
						 [,message:vMessage]
						 [,footer:vFooter]
						 [,top:vTop]
						 [,left:vLeft]
						 [,anchor:vAnchor]
						 [,icon:vIcon]
						 });
			(end)
						 
		Possible Values:
			vTitle - *string* Optional title text for the balloon.
			vMessage - *string* Optional. Message body for the balloon.
			vFooter - *string* Optional. Test displayed at the bottom of the balloon on a separate line.
			vTop - *integer* Optional. Offset from the top of the screen or top of an anchor.
			vLeft - *integer* Optional. Offset from the left of the screen or left of an anchor.
			vAnchor - *object* Optional. Reference to the object that the balloon should use as reference for location. 
			vIcon - *string* Optional. Possible icon values may include one of the values below (case sensitive):
				 - Exclaim - pre-defined, triangle with an exclamation point.
				 - Stop - pre-defined, red circle with a white x inside.
				 - Info - pre-defined, white balloon with a letter "i" inside *Default*
				 - Help - a question mark inside a blue circle.
				 - a relative path to a custom icon.
			
		Examples:
			
			- balloonObj.Show({title:'JavaScript Balloon Example',message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications.',anchor:tableCellObj, icon:'Info'});
			- balloonObj1.Show({title:'JavaScript Balloon Example',message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications.',anchor:tableCellObj});
			- balloonObj2.Show({message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications. ',anchor:tableCellObj});
	
	*/
	function Show()
	{
		var title;
		var message='';
		var icon='';
		var footer='';
		var btop=0, bleft=0;
		var atop=0, aleft=0;
		var anchor;
		var direction='SE';

		// Updates
		blbWidth=String(this.width);
		titleFontStyle=this.titleFontStyle;
		messageFontStyle=this.messageFontStyle;
		footerFontStyle=this.footerFontStyle;
		transShowFilter=this.transShowFilter;
		transHideFilter=this.transHideFilter;
		transShow=this.transShow;
		transHide=this.transHide;
		autoHide=this.autoHide;
		autoHideInterval=this.autoHideInterval;
		autoAway=this.autoAway;

		if(document.readyState!='complete')
		{
			alert('Document needs to fully load before you may show JSBalloons.');
			return;
		}
		
		if(Show.arguments.length>0)
		{
			var oArg=Show.arguments[0];
			
			if(oArg.title!=null)
			{
				title=oArg.title;
			}
			
			if(oArg.message!=null)
			{
				message=oArg.message;
			}
			
			if(oArg.icon!=null)
			{
				icon=oArg.icon;
				
				switch(icon)
				{
					case 'Exclaim':
						icon = JSBalloonPath+'images/exclaim.ico';
						SoundFx = 'Exclaim';
						break;
						
					case 'Stop':
						icon = JSBalloonPath+'images/stop.ico';
						SoundFx = 'Stop';
						break;
						
					case 'Info':
						icon = JSBalloonPath+'images/info.ico';
						SoundFx = 'Info';
						break;
					
					case 'Help':
						icon = JSBalloonPath+'images/help.ico';
						SoundFx = 'Info';
						break;
						
					default:
						SoundFx = 'Info';
				}
			}

			if(oArg.footer!=null)
			{
				footer=oArg.footer;
			}
			
			if(oArg.top!=null)
			{
				btop=oArg.top;
			}
			
			if(oArg.left!=null)
			{
				bleft=oArg.left;
			}
			
			if(oArg.anchor!=null)
			{
				anchor=oArg.anchor;
				atop=getTop(anchor);
				aleft=getLeft(anchor);
			}
		}
		
		// Figure out the best direction for the pointer
		
		// Assume SE
		var ret=balloonInfrastructure(balloonBody(	title, 
													icon, 
													message, 
													footer, 
													this.titleFontStyle,
													this.messageFontStyle,
													this.footerFontStyle,
													this.showCloseBox), direction);
		
		// Populate the contents
		balloonDIV.innerHTML=ret;
		
		var btnClose=balloonDIV.children[0].children[0].children[1].children[0].children[0].children[0].children[0].children[2].children[0];
		btnClose.onclick=this.Hide;
		
		// check if the object is already initialized
		if(typeof(childID)!='object')
		{
			childID=document.body.appendChild(balloonDIV);	
		}
		
		if(anchor!=null)
		{

			balloonDIV.style.left = aleft+bleft;
			balloonDIV.style.top = (atop-balloonDIV.offsetHeight)+btop;
		}
		else
		{
			balloonDIV.style.left = bleft;
			balloonDIV.style.top = btop;		
		}
		
		
		var bAdjustedLeft=parseInt(balloonDIV.style.left, 10);
		var showSE;

	
		if(document.body.offsetWidth < (bAdjustedLeft+balloonDIV.offsetWidth+20))
		{		
			direction='SW';
			
			ret=balloonInfrastructure(balloonBody(	title, 
													icon, 
													message, 
													footer, 
													this.titleFontStyle,
													this.messageFontStyle,
													this.footerFontStyle,
													this.showCloseBox), direction);
			balloonDIV.innerHTML=ret;

			balloonDIV.style.left = bAdjustedLeft-balloonDIV.offsetWidth+20;
			showSE=false;
		}
		else
		{
			direction='SE';
			showSE=true;
		} 
		
		if(parseInt(balloonDIV.style.top, 10)<0)
		{
			if(showSE)
			{
				direction='NE';
				ret=balloonInfrastructure(balloonBody(	title, 
													icon, 
													message, 
													footer, 
													this.titleFontStyle,
													this.messageFontStyle,
													this.footerFontStyle,
													this.showCloseBox), direction);
				balloonDIV.innerHTML=ret;
			}
			else
			{
				direction='NW';
				ret=balloonInfrastructure(balloonBody(	title, 
													icon, 
													message, 
													footer, 
													this.titleFontStyle,
													this.messageFontStyle,
													this.footerFontStyle,
													this.showCloseBox), direction);
				balloonDIV.innerHTML=ret;
			}
			balloonDIV.style.top = parseInt(balloonDIV.style.top, 10)+balloonDIV.offsetHeight;
			if(anchor!=null)
			{
				balloonDIV.style.top = parseInt(balloonDIV.style.top, 10)+anchor.offsetHeight
			}
		}			
		
		if(this.showCloseBox)
		{
			if(direction=='SE' || direction=='SW')
			{
				btnClose=balloonDIV.children[0].children[0].children[1].children[0].children[0].children[0].children[0].children[2].children[0];
			}
			else
			{
				btnClose=balloonDIV.children[0].children[0].children[2].children[0].children[0].children[0].children[0].children[2].children[0];
			}
			btnClose.onclick=this.Hide;
		}
		
		// Adjust all srollers
		var scrollOffsets=ScrollOffsets(anchor);
		balloonDIV.style.top=parseInt(balloonDIV.style.top, 10)-scrollOffsets[0];
		balloonDIV.style.left=parseInt(balloonDIV.style.left, 10)-scrollOffsets[1];
		
		// Hide any overlapping selects
		SuppressSelects();
		
		// Show balloon
		if(this.transShow)
		{
			balloonDIV.style.filter=this.transShowFilter+' '+this.transHideFilter;
			if(balloonDIV.filters(0).status==2 || balloonDIV.filters(0).status==1)
			{
				balloonDIV.filters(0).Stop();
			}
			balloonDIV.filters(0).Apply();
			balloonDIV.style.visibility='visible';
			balloonDIV.filters(0).Play();
		}
		else
		{
			balloonDIV.style.visibility='visible';
		}
					
		// Init autohide if true
		if(this.autoHide)
		{
			clearTimeout(this.tmrBalloonPopup);
			transHide=this.transHide;
			this.tmrBalloonPopup=setTimeout(this.Hide, this.autoHideInterval);
		}
		
		if(this.autoAway)
		{
			balloonDIV.onmouseover=Hide;
		}
		else
		{
			balloonDIV.onmouseover='';
		}
	}
	
	/*	Function: Hide
			Hide a visible balloon.
			Call this function to immediately initiate the hiding of the instantiated balloon 
			with the predefined transition in <transHideFilter> depending on the setting of <transHide>.
	*/
	function Hide()
	{
		if(balloonDIV.style.visibility=='hidden')
		{
			return;
		}

		if(transHide)
		{
			if(balloonDIV.filters(1).status==2 || balloonDIV.filters(1).status==1)
			{
				balloonDIV.filters(1).Stop();
			}
			balloonDIV.filters(1).Apply();
			balloonDIV.style.visibility='hidden';
			balloonDIV.filters(1).Play();
		}
		else
		{
			balloonDIV.style.visibility='hidden';
		}	
		
		RestoreSelects();
	}
	
	// Private

	function SuppressSelects()
	{
		var selObjects=document.getElementsByTagName("SELECT");
		
		for(var i=0;i<selObjects.length;i++)
		{	
			if(selObjects[i].balloonMember!='true')
			{

⌨️ 快捷键说明

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