PageSourceSearch

http://jjdb.sdenews.com/jjdb/public/swfObject.js

js sdenews.com collected 2026-10-02 16:29:20 UTC 8,155 bytes, 204 lines download raw bytes

1/**
2 * SWFObject v1.4.2: 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 */
10if(typeof deconcept == "undefined") var deconcept = new Object();
11if(typeof deconcept.util == "undefined") deconcept.util = new Object();
12if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
13deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
14	if (!document.getElementById) { return; }
15	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
16	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
17	this.params = new Object();
18	this.variables = new Object();
19	this.attributes = new Array();
20	if(swf) { this.setAttribute('swf', swf); }
21	if(id) { this.setAttribute('id', id); }
22	if(w) { this.setAttribute('width', w); }
23	if(h) { this.setAttribute('height', h); }
24	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
25	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
26	if(c) { this.addParam('bgcolor', c); }
27	var q = quality ? quality : 'high';
28	this.addParam('quality', q);
29	this.setAttribute('useExpressInstall', useExpressInstall);
30	this.setAttribute('doExpressInstall', false);
31	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
32	this.setAttribute('xiRedirectUrl', xir);
33	this.setAttribute('redirectUrl', '');
34	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
35}
36deconcept.SWFObject.prototype = {
37	setAttribute: function(name, value){
38		this.attributes[name] = value;
39	},
40	getAttribute: function(name){
41		return this.attributes[name];
42	},
43	addParam: function(name, value){
44		this.params[name] = value;
45	},
46	getParams: function(){
47		return this.params;
48	},
49	addVariable: function(name, value){
50		this.variables[name] = value;
51	},
52	getVariable: function(name){
53		return this.variables[name];
54	},
55	getVariables: function(){
56		return this.variables;
57	},
58	getVariablePairs: function(){
59		var variablePairs = new Array();
60		var key;
61		var variables = this.getVariables();
62		for(key in variables){
63			variablePairs.push(key +"="+ variables[key]);
64		}
65		return variablePairs;
66	},
67	getSWFHTML: function() {
68		var swfNode = "";
69		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
70			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
71			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
72			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
73			var params = this.getParams();
74			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
75			var pairs = this.getVariablePairs().join("&");
76			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
77			swfNode += '/>';
78		} else { // PC IE
79			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
80			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
81			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
82			var params = this.getParams();
83			for(var key in params) {
84			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
85			}
86			var pairs = this.getVariablePairs().join("&");
87			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
88			swfNode += "</object>";
89		}
90		return swfNode;
91	},
92	write: function(elementId){
93		if(this.getAttribute('useExpressInstall')) {
94			// check to see if we need to do an express install
95			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
96			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
97				this.setAttribute('doExpressInstall', true);
98				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
99				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
100				this.addVariable("MMdoctitle", document.title);
101			}
102		}
103		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
104			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
105			n.innerHTML = this.getSWFHTML();
106			return true;
107		}else{
108			if(this.getAttribute('redirectUrl') != "") {
109				document.location.replace(this.getAttribute('redirectUrl'));
110			}
111		}
112		return false;
113	}
114}
115
116/* ---- detection functions ---- */
117deconcept.SWFObjectUtil.getPlayerVersion = function(){
118	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
119	if(navigator.plugins && navigator.mimeTypes.length){
120		var x = navigator.plugins["Shockwave Flash"];
121		if(x && x.description) {
122			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
123		}
124	}else{
125		// do minor version lookup in IE, but avoid fp6 crashing issues
126		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
127		try{
128			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
129		}catch(e){
130			try {
131				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
132				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
133				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
134			} catch(e) {
135				if (PlayerVersion.major == 6) {
136					return PlayerVersion;
137				}
138			}
139			try {
140				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
141			} catch(e) {}
142		}
143		if (axo != null) {
144			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
145		}
146	}
147	return PlayerVersion;
148}
149deconcept.PlayerVersion = function(arrVersion){
150	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
151	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
152	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
153}
154deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
155	if(this.major < fv.major) return false;
156	if(this.major > fv.major) return true;
157	if(this.minor < fv.minor) return false;
158	if(this.minor > fv.minor) return true;
159	if(this.rev < fv.rev) return false;
160	return true;
161}
162/* ---- get value of query string param ---- */
163deconcept.util = {
164	getRequestParameter: function(param) {
165		var q = document.location.search || document.location.hash;
166		if(q) {
167			var pairs = q.substring(1).split("&");
168			for (var i=0; i < pairs.length; i++) {
169				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
170					return pairs[i].substring((pairs[i].indexOf("=")+1));
171				}
172			}
173		}
174		return "";
175	}
176}
177/* fix for video streaming bug */
178deconcept.SWFObjectUtil.cleanupSWFs = function() {
179	var objects = document.getElementsByTagName("OBJECT");
180	for (var i=0; i < objects.length; i++) {
181		objects[i].style.display = 'none';
182		for (var x in objects[i]) {
183			if (typeof objects[i][x] == 'function') {
184				objects[i][x] = null;
185			}
186		}
187	}
188}
189if (typeof window.onunload == 'function') {
190	var oldunload = window.onunload;
191		window.onunload = function() {
192		deconcept.SWFObjectUtil.cleanupSWFs();
193		oldunload();
194	}
195} else {
196	window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;
197}
198/* add Array.push if needed (ie5) */
199if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
200
201/* add some aliases for ease of use/backwards compatibility */
202var getQueryParamValue = deconcept.util.getRequestParameter;
203var FlashObject = deconcept.SWFObject; // for legacy support
204var SWFObject = deconcept.SWFObject;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.