web/res/js/swfobject.js
changeset 5 e6218e56f418
child 54 9d9d7733172a
equal deleted inserted replaced
4:8f5900b5603a 5:e6218e56f418
       
     1 /**
       
     2  * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
       
     3  *
       
     4  * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
       
     5  * http://www.opensource.org/licenses/mit-license.php
       
     6  *
       
     7  * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
       
     8  *   legal reasons.
       
     9  */
       
    10 if(typeof deconcept=="undefined") {
       
    11 	var deconcept=new Object();
       
    12 }
       
    13 if(typeof deconcept.util=="undefined") { 
       
    14 	deconcept.util=new Object();
       
    15 }
       
    16 if(typeof deconcept.SWFObjectUtil=="undefined"){
       
    17 	deconcept.SWFObjectUtil=new Object();
       
    18 }
       
    19 deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
       
    20 	if(!document.getElementById){
       
    21 		return;
       
    22 	}
       
    23 	this.DETECT_KEY=_b?_b:"detectflash";
       
    24 	this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
       
    25 	this.params=new Object();
       
    26 	this.variables=new Object();
       
    27 	this.attributes=new Array();
       
    28 	if(_1){this.setAttribute("swf",_1);}
       
    29 	if(id){this.setAttribute("id",id);}
       
    30 	if(w){this.setAttribute("width",w);}
       
    31 	if(h){this.setAttribute("height",h);}
       
    32 	if(_5){
       
    33 		this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));
       
    34 	}
       
    35 	this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
       
    36 	if(c){this.addParam("bgcolor",c);}
       
    37 	var q=_8?_8:"high";
       
    38 	this.addParam("quality",q);
       
    39 	this.setAttribute("useExpressInstall",_7);
       
    40 	this.setAttribute("doExpressInstall",false);
       
    41 	var _d=(_9)?_9:window.location;
       
    42 	this.setAttribute("xiRedirectUrl",_d);
       
    43 	this.setAttribute("redirectUrl","");
       
    44 	if(_a){
       
    45 		this.setAttribute("redirectUrl",_a);
       
    46 	}
       
    47 };
       
    48 
       
    49 deconcept.SWFObject.prototype={
       
    50 	setAttribute:function(_e,_f){
       
    51 		this.attributes[_e]=_f;
       
    52 	},getAttribute:function(_10){
       
    53 		return this.attributes[_10];
       
    54 	},addParam:function(_11,_12){
       
    55 		this.params[_11]=_12;
       
    56 	},getParams:function(){
       
    57 		return this.params;
       
    58 	},addVariable:function(_13,_14){
       
    59 		this.variables[_13]=_14;
       
    60 	},getVariable:function(_15){
       
    61 		return this.variables[_15];
       
    62 	},getVariables:function(){
       
    63 		return this.variables;
       
    64 	},getVariablePairs:function(){
       
    65 		var _16=new Array();
       
    66 		var key;
       
    67 		var _18=this.getVariables();
       
    68 		for(key in _18){
       
    69 			_16.push(key+"="+_18[key]);
       
    70 		}
       
    71 		return _16;
       
    72 	},getSWFHTML:function(){
       
    73 		var _19="";
       
    74 		if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
       
    75 			if(this.getAttribute("doExpressInstall")){
       
    76 				this.addVariable("MMplayerType","PlugIn");
       
    77 			}
       
    78 			_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
       
    79 			_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
       
    80 			var _1a=this.getParams();
       
    81 			for(var key in _1a){
       
    82 				_19+=[key]+"=\""+_1a[key]+"\" ";
       
    83 			}
       
    84 			var _1c=this.getVariablePairs().join("&");
       
    85 			if(_1c.length>0){
       
    86 				_19+="flashvars=\""+_1c+"\"";}_19+="/>";
       
    87 			}
       
    88 			else {
       
    89 				if(this.getAttribute("doExpressInstall")) {
       
    90 					this.addVariable("MMplayerType","ActiveX");
       
    91 				}
       
    92 				_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
       
    93 				_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
       
    94 				var _1d=this.getParams();
       
    95 				for(var key in _1d){
       
    96 					_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";
       
    97 				}
       
    98 				var _1f=this.getVariablePairs().join("&");
       
    99 				if(_1f.length>0){
       
   100 					_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";
       
   101 				}
       
   102 				_19+="</object>";
       
   103 			}
       
   104 			return _19;
       
   105 		},write:function(_20){
       
   106 			if(this.getAttribute("useExpressInstall")){
       
   107 				var _21=new deconcept.PlayerVersion([6,0,65]);
       
   108 				if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
       
   109 					this.setAttribute("doExpressInstall",true);
       
   110 					this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
       
   111 					document.title=document.title.slice(0,47)+" - Flash Player Installation";
       
   112 					this.addVariable("MMdoctitle",document.title);
       
   113 				}
       
   114 			}
       
   115 			if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
       
   116 				var n=(typeof _20=="string")?document.getElementById(_20):_20;
       
   117 				n.innerHTML=this.getSWFHTML();
       
   118 				return true;
       
   119 			}
       
   120 			else {
       
   121 				if(this.getAttribute("redirectUrl")!="") {
       
   122 					document.location.replace(this.getAttribute("redirectUrl"));
       
   123 				}
       
   124 			}
       
   125 			return false;
       
   126 		}
       
   127 	};
       
   128 	deconcept.SWFObjectUtil.getPlayerVersion=function(){
       
   129 		var _23=new deconcept.PlayerVersion([0,0,0]);
       
   130 		if(navigator.plugins&&navigator.mimeTypes.length){
       
   131 			var x=navigator.plugins["Shockwave Flash"];
       
   132 			if(x&&x.description){
       
   133 				_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));
       
   134 			}
       
   135 		}
       
   136 		else {
       
   137 			try {
       
   138 				var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
       
   139 			}
       
   140 			catch(e) { 
       
   141 				try { 
       
   142 				var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
       
   143 _23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
       
   144 catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
       
   145 catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
       
   146 return _23;};
       
   147 deconcept.PlayerVersion=function(_27){
       
   148 this.major=_27[0]!=null?parseInt(_27[0]):0;
       
   149 this.minor=_27[1]!=null?parseInt(_27[1]):0;
       
   150 this.rev=_27[2]!=null?parseInt(_27[2]):0;
       
   151 };
       
   152 deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
       
   153 if(this.major<fv.major){return false;}
       
   154 if(this.major>fv.major){return true;}
       
   155 if(this.minor<fv.minor){return false;}
       
   156 if(this.minor>fv.minor){return true;}
       
   157 if(this.rev<fv.rev){
       
   158 return false;
       
   159 }return true;};
       
   160 deconcept.util={getRequestParameter:function(_29){
       
   161 var q=document.location.search||document.location.hash;
       
   162 if(q){var _2b=q.substring(1).split("&");
       
   163 for(var i=0;i<_2b.length;i++){
       
   164 if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
       
   165 return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
       
   166 return "";}};
       
   167 deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
       
   168 var _2d=document.getElementsByTagName("OBJECT");
       
   169 for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
       
   170 if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
       
   171 deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
       
   172 __flash_savedUnloadHandler=function(){};
       
   173 if(typeof window.onunload=="function"){
       
   174 var _30=window.onunload;
       
   175 window.onunload=function(){
       
   176 deconcept.SWFObjectUtil.cleanupSWFs();_30();};
       
   177 }else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
       
   178 if(typeof window.onbeforeunload=="function"){
       
   179 var oldBeforeUnload=window.onbeforeunload;
       
   180 window.onbeforeunload=function(){
       
   181 deconcept.SWFObjectUtil.prepUnload();
       
   182 oldBeforeUnload();};
       
   183 }else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
       
   184 if(Array.prototype.push==null){
       
   185 Array.prototype.push=function(_31){
       
   186 this[this.length]=_31;
       
   187 return this.length;};}
       
   188 var getQueryParamValue=deconcept.util.getRequestParameter;
       
   189 var FlashObject=deconcept.SWFObject;
       
   190 var SWFObject=deconcept.SWFObject;