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

📄 webthunderdetect.js

📁 驱动开发的一些资料
💻 JS
📖 第 1 页 / 共 2 页
字号:
function _xlThunderQtyPV(){try{vhref = "http://analytics-union.xunlei.com/PV?peerid=0&uri=http://thunderqtypv.union.xunlei.com&src=" + document.domain;image1 = new Image(1,1);image1.src=vhref;} catch(e) { }}

_xlThunderQtyPV();

var selectThunderType = "coWebThunder";		//default download client type
//var selectThunderType = "coThunder5";
var mustBeSelectedThunder = false;	
var thunder_isOpenNewWindow = 10;

isFun 	 = function(a){ return typeof a == "function"; };
isNull 	 = function(a){ return typeof a == "object" && !a; };
isNumber = function(a){ return typeof a == "number" && isFinite(a);};
isObject = function(a){ return (a && typeof a == "object") || isFun(a);};
isString = function(a){ return typeof a == "string";};
isArray  = function(a){ return isObject(a) && a.constructor == Array; };
isUndef  = function(a){ return typeof a == "undefined";};
DoNothing = function(){};


/* Decode the refrence URL */
function Decode(str){
	str = str.replace(/&lt/g,"<");
	str = str.replace(/&gt/g,">");
	str = str.replace(/&amp/g,"&");
	str = str.replace(/&quot/g,"\"");
	str = str.replace(/&apos/g,"\'");
	str = str.replace(/<br>/g,"\n");
	return str;
}

function wtd_ChangFolder(pid)
{
  if (pid >=0 && pid <=49999)
  {
      return "http://ftp.union.sandai.net/webthunder/union/webxl_g"+pid+".exe";
  }
  else if(pid >= 50000 && pid<=79999)
  {
      return "http://ftp.union.sandai.net/webthunder/union_1/webxl_g"+pid+".exe";
  }
    else if(pid >= 80000 && pid<=119999)
  {
      return "http://ftp.union.sandai.net/webthunder/union_2/webxl_g"+pid+".exe";
  }
      else if(pid >= 120000 && pid<=159999)
  {
      return "http://ftp.union.sandai.net/webthunder/union_3/webxl_g"+pid+".exe";
  }
  else
  {
      return "http://ftp.union.sandai.net/webthunder/union/webxl_g"+pid+".exe";
  }

}

function OnDownloadClick_Company(sDownloadURL,sResName, sRefPage, sPid, isOpenNewWindow, sType,selectType,sCompany)
{
	
	Thunder.companySetup(sCompany,sPid);

	OnDownloadClick(sDownloadURL,sResName, sRefPage, sPid, isOpenNewWindow, sType,selectType);
	return false;
}
function OnDownloadClick(sDownloadURL,sResName, sRefPage,sPid,isOpenNewWindow,sType,selectType){

	sPid=sPid?sPid:"";if(sType=="07") sPid="g"+sPid;
    sResName="";
	Thunder.infoType=10;
	Thunder.pId=sPid?sPid:"";
	try{
		if(selectThunderType=='coWebThunder'){
			selectType=3
		}else if(selectThunderType=='coThunder5'){
			selectType=4
		}
	}catch(e){
		if(selectType && !isNaN(selectType)) selectType=Number(selectType);		
		
	}
	if(selectType==3 || selectType==4){Thunder.thunderType=selectType;
	//if(selectType==3) Thunder.mustUseSelected=true;
	}
	
	if(typeof(isOpenNewWindow)!="boolean"){
		if(isNaN(isOpenNewWindow)) isOpenNewWindow=undefined; else isOpenNewWindow=Number(isOpenNewWindow);
		if(isOpenNewWindow!=2 && isOpenNewWindow!=10) isOpenNewWindow=undefined;		
	}
	
	if((isOpenNewWindow==true ||isOpenNewWindow==10) && isOpenNewWindow!=undefined)	
		Thunder.isOpenNew=true;
	else if((isOpenNewWindow==false ||isOpenNewWindow==2) && isOpenNewWindow!=undefined)
		Thunder.isOpenNew=false;

	return Thunder.download(sDownloadURL,sRefPage,sResName,sResName);
}

function OnDownloadClick_Simple(linkObj,isOpenNewWindow,selectType)
{
	var sDownload = linkObj.getAttribute("thunderHref");
	//var sResName = linkObj.getAttribute("thunderResTitle");
    var sResName ="";
	var sRefPage = location.href;
	var sPid = linkObj.getAttribute("thunderPid");
	var sType = linkObj.getAttribute("thunderType");
	var sCompany= linkObj.getAttribute("CompanyName");

	if (sCompany)
		Thunder.companySetup(sCompany,sPid);

	sPid=sPid?sPid:"";
	if(sType=="07") sPid="g"+sPid;	

	var selThunder,openNew;
	
	try{
		if(selectThunderType=='coWebThunder'){
			selThunder=3
		}else if(selectThunderType=='coThunder5'){
			selThunder=4
		}
	}catch(e){
		if(isOpenNewWindow){
			switch(isOpenNewWindow)
			{
				case 3:	case 4:
					selThunder=isOpenNewWindow;
			}
		}	

		if(!selThunder){

			if (!isNaN(selectType) && selectType){		
				
				selectType=Number(selectType);			

				if(selectType==3 || selectType==4)
					selThunder=selectType;
			}
		}
	}

	var oldTType,oldTOpen,oldMustUse;

	oldTType	=Thunder.thunderType;
	oldMustUse	=Thunder.mustUseSelected;
	if(selThunder)
	{

		Thunder.thunderType=selThunder;
		//if(selThunder==3)
			//Thunder.mustUseSelected=true;
	}	
	oldTOpen=Thunder.isOpenNew;
	Thunder.isOpenNew=((isOpenNewWindow==2)?false:((isOpenNewWindow==1)?true:Thunder.isOpenNew));

	

	Thunder.pId=sPid?sPid:"";
	Thunder.download(sDownload,sRefPage,sResName,sResName);
	
	Thunder.thunderType		=oldTType;
	Thunder.isOpenNew		=oldTOpen;
	Thunder.mustUseSelected	=oldMustUse;

	return false;
}

function ThunderNetwork_SetHref(linkObj)
{
	var tDownloadURL = linkObj.getAttribute("thunderHref");
	linkObj.href = tDownloadURL;
}

function ThunderNetwork_UnsetHref(linkObj)
{
	linkObj.href = "JavaScript:;";
}

// webthunder_G.js
// interface: OpenAddTask
// 5-23-2006
// for portal.xunlei.com
// need Thunder Server Version 1.0.1.22 at least

/* Call WebThunder Add Task Panel
** Parameters
** szParam [IN]  string specifies the download url , resource title and refrence url, split by {\r*\r} 
** Return Values
** int
** If call panel successfully  return  0
** If call panel failed        return  1    
** If ThunderServer uninstall  return  2
*/

/* Decode the refrence URL */



var Class = {
	create: function(){
		return function(){
			this.initialize.apply(this, arguments);
		}
	},	
	extend: function(destination, source){
		for (property in source) {
    		destination[property] = source[property];
  		}	
		return destination;
	}
}
var Delegate = {
	create: function (obj, func){
		var f = function()	{
			var target = arguments.callee.target;
			var func = arguments.callee.func;
			return func.apply(target, arguments);
		}
		f.target = obj;
		f.func = func;
		return f;
	}
};

/*Language info*/
var thunderLanguage=[];
thunderLanguage["WebThunderSetUpInfo"]	=unescape("%u6B64%u94FE%u63A5%u4E3A%u8FC5%u96F7%u4E13%u7528%u4E0B%u8F7D%u901A%u9053%uFF0C%u5FC5%u987B%u5B89%u88C5WEB%u8FC5%u96F7%u624D%u80FD%u8FDB%u884C%u4E0B%u8F7D%uFF0C%u5B89%u88C5%u540E%u8BF7%u91CD%u65B0%u8FDB%u5165%u6B64%u9875%u8FDB%u884C%u4E0B%u8F7D%u3002%u5F3A%u70C8%u5EFA%u8BAE%u60A8%u5B89%u88C5web%u8FC5%u96F7%uFF0C%u4F53%u9A8C%u6025%u901F%u4E0B%u8F7D%u7684%u4E50%u8DA3%uFF01%u70B9%u51FB%u786E%u5B9A%u5373%u523B%u5B89%u88C5web%u8FC5%u96F7");
thunderLanguage["Thunder5SetUpInfo"]	=unescape("%u6B64%u94FE%u63A5%u4E3A%u8FC5%u96F7%u4E13%u7528%u4E0B%u8F7D%u901A%u9053%uFF0C%u5FC5%u987B%u5B89%u88C5WEB%u8FC5%u96F7%u624D%u80FD%u8FDB%u884C%u4E0B%u8F7D%uFF0C%u5B89%u88C5%u540E%u8BF7%u91CD%u65B0%u8FDB%u5165%u6B64%u9875%u8FDB%u884C%u4E0B%u8F7D%u3002%u5F3A%u70C8%u5EFA%u8BAE%u60A8%u5B89%u88C5web%u8FC5%u96F7%uFF0C%u4F53%u9A8C%u6025%u901F%u4E0B%u8F7D%u7684%u4E50%u8DA3%uFF01%u70B9%u51FB%u786E%u5B9A%u5373%u523B%u5B89%u88C5web%u8FC5%u96F7");
thunderLanguage["AllSetUpInfo"]			=unescape("%u6B64%u94FE%u63A5%u4E3A%u8FC5%u96F7%u4E13%u7528%u4E0B%u8F7D%u901A%u9053%uFF0C%u5FC5%u987B%u5B89%u88C5WEB%u8FC5%u96F7%u6216%u8FC5%u96F75%u624D%u80FD%u8FDB%u884C%u4E0B%u8F7D%uFF0C%u5B89%u88C5%u540E%u8BF7%u91CD%u65B0%u8FDB%u5165%u6B64%u9875%u8FDB%u884C%u4E0B%u8F7D%u3002%u5F3A%u70C8%u5EFA%u8BAE%u60A8%u5B89%u88C5web%u8FC5%u96F7%uFF0C%u4F53%u9A8C%u6025%u901F%u4E0B%u8F7D%u7684%u4E50%u8DA3%uFF01%u70B9%u51FB%u786E%u5B9A%u5373%u523B%u5B89%u88C5web%u8FC5%u96F7");
thunderLanguage["MethodUnSupported"]	=unescape("%u4E0D%u652F%u6301%u6B64%u65B9%u6CD5%uFF0C%u8BF7%u5B89%u88C5%u6700%u65B0%u7684%u8FC5%u96F7%u5BA2%u6237%u7AEF");
thunderLanguage["FFDenied"]	=unescape("%u6B64%u64CD%u4F5C%u88AB%u6D4F%u89C8%u5668%u62D2%u7EDD%uFF01%0A%u8BF7%u5728%u6D4F%u89C8%u5668%u5730%u5740%u680F%u8F93%u5165%u201Cabout%3Aconfig%u201D%u5E76%u56DE%u8F66%0A%u7136%u540E%u5C06%5Bsigned.applets.codebase_principal_support%5D%u8BBE%u7F6E%u4E3A%27true%27");


var Thunder = {
	isIE:(navigator.userAgent.indexOf('MSIE')>0),
	isOpenNew:null,
	infoType:0,
	thunderType:0,	
	mustUseSelected:null,
	pId:"",
	judgeThunder:function(sid){
		 var webcop = [];
		 sid=sid?sid:this.pId;

		if(webcop[sid]==1){
			return 3; 			
		}
		else
			return false;

	},
	getInstance: function(th){		
		
		/*Get download style*/
		if(this.isOpenNew==null)
			try{this.isOpenNew=(thunder_isOpenNewWindow==10?true:false)}catch(e){}

		if(this.mustUseSelected==null)
			try{this.mustUseSelected=mustBeSelectedThunder;}catch(e){this.mustUseSelected=false;}
		/*Get download client type*/
		if(this.judgeThunder()){
			this.thunderType=this.judgeThunder()
			this.mustUseSelected=true;
		}else{
			if(!this.thunderType)
			{
				try{
					switch(selectThunderType)
					{
						case "coThunder5":
							this.thunderType=4;
							break;
						case "coWebThunder":
						default:
							this.thunderType=3;
					}
				}catch(e){this.thunderType=3;this.mustUseSelected=false;}
			}else{
				
			}
		}

		if(this.isIE){			
			var begi,endi;						
			if(this.thunderType==3) begi=0; else begi=1;
			if(this.mustUseSelected) endi=begi; else endi=1-begi;
			var strEx="i++";strJudge="i<=endi";
			if(endi<begi){strEx="i--";strJudge="i>=endi";}
			var opt = [Thunder.WebThunder,Thunder.Thunder5];
			for(var i=begi;eval(strJudge);eval(strEx))
			{	
				
				var tmpObj=opt[i].getInstance();				
				if(tmpObj!=null)
					return tmpObj;
				else
					continue;
			}

		}else{

			var oAtmp=Thunder.ffThunder.getInstance();			
			if(oAtmp){
				var clientType=oAtmp.getClientType();

				//No client has been seted up
				if(clientType==0) return null;
				if(this.mustUseSelected){					
					if((this.thunderType==4 && clientType==2)||(this.thunderType==3 && clientType==1))
						oAtmp=null				
				}else{

⌨️ 快捷键说明

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