}
}
}
this.openWindow(url);
}
}
Thunder.WebThunder = Class.create();
Thunder.WebThunder.getInstance = function(){
if (isUndef(this._thunder))
{
//Web app initialized here
try{
this._thunder = new Thunder.WebThunder();
}catch(e){
this._thunder=null;
}
}
return this._thunder;
}
Thunder.WebThunder.prototype = {
initialize: function(){
try{
this.__thunder = this.getThunder();
}catch(e){
throw(e);
}
},
getThunder:function(){
try{
return new ActiveXObject("ThunderServer.webThunder.1");
}catch(e){
throw(e);
}
},
/*get server build version*/
getVersion: function(){
return parseInt(this.__thunder.GetVersion().split(".")[3]);
},
download: function(cid,url,refer,name,stat){
if ((url.indexOf("mms://") != -1) || (url.indexOf("rtsp://")!= -1))
{
return true;
}else{
this.__thunder.CallAddTask2(Decode(url),Decode(stat),Decode(refer),1, "", Decode(name),document.cookie);
//this.__thunder.CallAddTask(Decode(url),Decode(stat),Decode(refer),1, "", Decode(name));
return false;
}
}
}
Thunder.Thunder5 = Class.create();
Thunder.Thunder5.getInstance = function(){
if (isUndef(this._thunder))
{
try{
this._thunder = new Thunder.Thunder5();}
catch(e){
this._thunder = null;}
}
return this._thunder;
}
Thunder.Thunder5.prototype = {
initialize: function(){
try{
this.__thunder = new ActiveXObject("ThunderAgent.Agent.1");
}catch(e){throw(e);}
},
download: function(cid, url, refer, name, stat){
try{
name=name?name:"";
this.addTask('', url, refer, name, stat);
this.commitTasks();
}catch(e){
alert(e.message);
}
},
addTask: function(cid, url, refer, name, stat){
var _addTask = [
Delegate.create(this, function(){this.__thunder.AddTask4(url, "", "", name, refer, -1, 0, -1, document.cookie, cid, stat);}),
Delegate.create(this, function(){this.__thunder.AddTask3(url, "", "", name, refer, -1, 0, -1, document.cookie, cid);}),
Delegate.create(this, function(){this.__thunder.AddTask2(url, "", "", name, refer, -1, 0, -1, document.cookie);}),
Delegate.create(this, function(){this.__thunder.AddTask(url, "", "", name, refer, -1, 0, -1);})
];
for (var i=0; i<_addTask.length; i++){
try{
_addTask[i]();
return;
}catch(e){
}
}
throw thunderLanguage["MethodUnSupported"];
},
commitTasks: function(){
var _commitTasks = [
Delegate.create(this, function(){this.__thunder.CommitTasks2(1);}),
Delegate.create(this, function(){this.__thunder.CommitTasks();})
];
for (var i=0; i<_commitTasks.length; i++){
try{
_commitTasks[i]();
return;
}catch(e){
}
}
throw thunderLanguage["MethodUnSupported"];
}
}
Thunder.ffThunder= Class.create();
Thunder.ffThunder.getInstance=function(){
if(isUndef(this._thObj) || this._thObj==0){
//thunder Object for firefox initialized here
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
try{
this._thObj = new Thunder.ffThunder();}
catch(e){
this._thObj = null;
}
}catch(e){
alert(thunderLanguage["FFDenied"]);
this._thObj = 0;
}
}
return this._thObj;
}
Thunder.ffThunder.prototype={
initialize:function(){
if(isUndef(this.__thObj)){
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}catch(e){
this.__thObj = '';
}
try{
this.__thObj = Components.classes["@xunlei.com/ThunderLoader;1"].createInstance();
this.__thObj = this.__thObj.QueryInterface(Components.interfaces.IThunderDownload);
}catch(err){
throw(err);
}
}
return this.__thObj;
},
getClientType:function(){
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
if(!isUndef(this.__thObj))
{
return this.__thObj.GetThunderClientInfo();
}else{
return 0;
}
},
getVersion:function(t){
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
if(!isUndef(this.__thObj))
{
var ct=this.__thObj.getClientType();
t=t?t:ct;
switch(t)
{
case 2:
case 3:
return this.__thObj.GetClientBuildVersion(1);
break;
case 1:
return this.__thObj.GetClientBuildVersion(2);
}
}
return "";
},
download:function(cid,url,refer,name,stat,type){
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
type=type?type:2;
var stype=this.getClientType();
if(stype==3) stype=type;
if(stype==1) cid='';
name=name?name:"";
stat=stat?stat:"";
this.__thObj.CallThunderClient(stype,url,refer,stat,"",name,cid,document.cookie);
}
Back to home |
File page
Subscribe |
Register |
Login
| N