PageSourceSearch

https://dv8house.com/rw_common/themes/split/javascript.js

js dv8house.com collected 2026-09-24 13:57:20 UTC 18,498 bytes, 570 lines download raw bytes

1/*
2 * RapidWeaver 3.5.0 theme functions.
3 * Script Version 2.1
4 * Updated 26 May 2006.
5 */
6
7
8
9/*
10 * Function to generate "open in new window" link as W3C compliant
11 */
12
13function externalLinks() {
14if (!document.getElementsByTagName) return; 
15var anchors = document.getElementsByTagName("a"); 
16for (var i=0; i<anchors.length; i++) { 
17var anchor = anchors[i]; 
18if (anchor.getAttribute("href") && 
19anchor.getAttribute("rel") == "external") 
20anchor.target = "_blank";
21} 
22} 
23
24/*
25 * Functions to generate OBJECT and EMBED tags for Flash content.
26 * Resource: http://blog.deconcept.com/swfobject/
27 *
28 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
29 * http://www.opensource.org/licenses/mit-license.php
30 */
31
32if(typeof deconcept == "undefined") var deconcept = new Object();
33if(typeof deconcept.util == "undefined") deconcept.util = new Object();
34if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
35deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
36	if (!document.createElement || !document.getElementById) { return; }
37	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
38	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
39	this.params = new Object();
40	this.variables = new Object();
41	this.attributes = new Array();
42	if(swf) { this.setAttribute('swf', swf); }
43	if(id) { this.setAttribute('id', id); }
44	if(w) { this.setAttribute('width', w); }
45	if(h) { this.setAttribute('height', h); }
46	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
47	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
48	if(c) { this.addParam('bgcolor', c); }
49	var q = quality ? quality : 'high';
50	this.addParam('quality', q);
51	this.setAttribute('useExpressInstall', useExpressInstall);
52	this.setAttribute('doExpressInstall', false);
53	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
54	this.setAttribute('xiRedirectUrl', xir);
55	this.setAttribute('redirectUrl', '');
56	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
57}
58deconcept.SWFObject.prototype = {
59	setAttribute: function(name, value){
60		this.attributes[name] = value;
61	},
62	getAttribute: function(name){
63		return this.attributes[name];
64	},
65	addParam: function(name, value){
66		this.params[name] = value;
67	},
68	getParams: function(){
69		return this.params;
70	},
71	addVariable: function(name, value){
72		this.variables[name] = value;
73	},
74	getVariable: function(name){
75		return this.variables[name];
76	},
77	getVariables: function(){
78		return this.variables;
79	},
80	getVariablePairs: function(){
81		var variablePairs = new Array();
82		var key;
83		var variables = this.getVariables();
84		for(key in variables){
85			variablePairs.push(key +"="+ variables[key]);
86		}
87		return variablePairs;
88	},
89	getSWFHTML: function() {
90		var swfNode = "";
91		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
92			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
93			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
94			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
95			var params = this.getParams();
96			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
97			var pairs = this.getVariablePairs().join("&");
98			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
99			swfNode += '/>';
100		} else { // PC IE
101			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
102			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
103			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
104			var params = this.getParams();
105			for(var key in params) {
106			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
107			}
108			var pairs = this.getVariablePairs().join("&");
109			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
110			swfNode += "</object>";
111		}
112		return swfNode;
113	},
114	write: function(elementId){
115		if(this.getAttribute('useExpressInstall')) {
116			// check to see if we need to do an express install
117			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
118			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
119				this.setAttribute('doExpressInstall', true);
120				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
121				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
122				this.addVariable("MMdoctitle", document.title);
123			}
124		}
125		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
126			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
127			n.innerHTML = this.getSWFHTML();
128			return true;
129		}else{
130			if(this.getAttribute('redirectUrl') != "") {
131				document.location.replace(this.getAttribute('redirectUrl'));
132			}
133		}
134		return false;
135	}
136}
137
138/* ---- detection functions ---- */
139deconcept.SWFObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
140	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
141	if(navigator.plugins && navigator.mimeTypes.length){
142		var x = navigator.plugins["Shockwave Flash"];
143		if(x && x.description) {
144			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
145		}
146	}else{
147		try{
148			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
149			for (var i=3; axo!=null; i++) {
150				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
151				PlayerVersion = new deconcept.PlayerVersion([i,0,0]);
152			}
153		}catch(e){}
154		if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
155		// this only does the minor rev lookup if the user's major version 
156		// is not 6 or we are checking for a specific minor or revision number
157		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
158		if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
159			try{
160				PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
161			}catch(e){}
162		}
163	}
164	return PlayerVersion;
165}
166deconcept.PlayerVersion = function(arrVersion){
167	this.major = parseInt(arrVersion[0]) != null ? parseInt(arrVersion[0]) : 0;
168	this.minor = parseInt(arrVersion[1]) || 0;
169	this.rev = parseInt(arrVersion[2]) || 0;
170}
171deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
172	if(this.major < fv.major) return false;
173	if(this.major > fv.major) return true;
174	if(this.minor < fv.minor) return false;
175	if(this.minor > fv.minor) return true;
176	if(this.rev < fv.rev) return false;
177	return true;
178}
179/* ---- get value of query string param ---- */
180deconcept.util = {
181	getRequestParameter: function(param){
182		var q = document.location.search || document.location.hash;
183		if(q){
184			var startIndex = q.indexOf(param +"=");
185			var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
186			if (q.length > 1 && startIndex > -1) {
187				return q.substring(q.indexOf("=", startIndex)+1, endIndex);
188			}
189		}
190		return "";
191	}
192}
193/* fix for video streaming bug */
194deconcept.SWFObjectUtil.cleanupSWFs = function() {
195	var objects = document.getElementsByTagName("OBJECT");
196	for (var i=0; i < objects.length; i++) {
197		for (var x in objects[i]) {
198			if (typeof objects[i][x] == 'function') {
199				objects[i][x] = null;
200			}
201		}
202	}
203}
204if (typeof window.onunload == 'function') {
205	var oldunload = window.onunload;
206		window.onunload = function() {
207		deconcept.SWFObjectUtil.cleanupSWFs();
208		oldunload();
209	}
210} else {
211	window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;
212}
213/* add Array.push if needed (ie5) */
214if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
215
216/* add some aliases for ease of use/backwards compatibility */
217var getQueryParamValue = deconcept.util.getRequestParameter;
218var FlashObject = deconcept.SWFObject; // for legacy support
219var SWFObject = deconcept.SWFObject;
220
221
222
223
224
225/*
226 * Functions to generate OBJECT and EMBED tags for QuickTime content.
227 * Resource: http://developer.apple.com/internet/ieembedfix.html
228 */
229
230/************** LOCALIZABLE GLOBAL VARIABLES ****************/
231
232var gArgCountErr =	'The "%%" function requires an even number of arguments.'
233				+	'\nArguments should be in the form "atttributeName", "attributeValue", ...';
234
235/******************** END LOCALIZABLE **********************/
236
237var gTagAttrs				= null;
238var gQTGeneratorVersion		= 1.0;
239
240function AC_QuickTimeVersion()	{ return gQTGeneratorVersion; }
241
242function _QTComplain(callingFcnName, errMsg)
243{
244    errMsg = errMsg.replace("%%", callingFcnName);
245	alert(errMsg);
246}
247
248function _QTAddAttribute(prefix, slotName, tagName)
249{
250	var		value;
251
252	value = gTagAttrs[prefix + slotName];
253	if ( null == value )
254		value = gTagAttrs[slotName];
255
256	if ( null != value )
257	{
258		if ( 0 == slotName.indexOf(prefix) && (null == tagName) )
259			tagName = slotName.substring(prefix.length); 
260		if ( null == tagName ) 
261			tagName = slotName;
262		return tagName + '="' + value + '" ';
263	}
264	else
265		return "";
266}
267
268function _QTAddObjectAttr(slotName, tagName)
269{
270	// don't bother if it is only for the embed tag
271	if ( 0 == slotName.indexOf("emb#") )
272		return "";
273
274	if ( 0 == slotName.indexOf("obj#") && (null == tagName) )
275		tagName = slotName.substring(4); 
276
277	return _QTAddAttribute("obj#", slotName, tagName);
278}
279
280function _QTAddEmbedAttr(slotName, tagName)
281{
282	// don't bother if it is only for the object tag
283	if ( 0 == slotName.indexOf("obj#") )
284		return "";
285
286	if ( 0 == slotName.indexOf("emb#") && (null == tagName) )
287		tagName = slotName.substring(4); 
288
289	return _QTAddAttribute("emb#", slotName, tagName);
290}
291
292
293function _QTAddObjectParam(slotName, generateXHTML)
294{
295	var		paramValue;
296	var		paramStr = "";
297	var		endTagChar = (generateXHTML) ? ' />' : '>';
298
299	if ( -1 == slotName.indexOf("emb#") )
300	{
301		// look for the OBJECT-only param first. if there is none, look for a generic one
302		paramValue = gTagAttrs["obj#" + slotName];
303		if ( null == paramValue )
304			paramValue = gTagAttrs[slotName];
305
306		if ( 0 == slotName.indexOf("obj#") )
307			slotName = slotName.substring(4); 
308	
309		if ( null != paramValue )
310			paramStr = '  <param name="' + slotName + '" value="' + paramValue + '"' + endTagChar + '\n';
311	}
312
313	return paramStr;
314}
315
316function _QTDeleteTagAttrs()
317{
318	for ( var ndx = 0; ndx < arguments.length; ndx++ )
319	{
320		var attrName = arguments[ndx];
321		delete gTagAttrs[attrName];
322		delete gTagAttrs["emb#" + attrName];
323		delete gTagAttrs["obj#" + attrName];
324	}
325}
326
327		
328
329// generate an embed and object tag, return as a string
330function _QTGenerate(callingFcnName, generateXHTML, args)
331{
332	// is the number of optional arguments even?
333	if ( args.length < 4 || (0 != (args.length % 2)) )
334	{
335		_QTComplain(callingFcnName, gArgCountErr);
336		return "";
337	}
338	
339	// allocate an array, fill in the required attributes with fixed place params and defaults
340	gTagAttrs = new Array();
341	gTagAttrs["src"] = args[0];
342	gTagAttrs["width"] = args[1];
343	gTagAttrs["height"] = args[2];
344	gTagAttrs["classid"] = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
345	gTagAttrs["pluginspage"] = "http://www.apple.com/quicktime/download/";
346
347	// set up codebase attribute with specified or default version before parsing args so
348	//  anything passed in will override
349	var activexVers = args[3]
350	if ( (null == activexVers) || ("" == activexVers) )
351		activexVers = "6,0,2,0";
352	gTagAttrs["codebase"] = "http://www.apple.com/qtactivex/qtplugin.cab#version=" + activexVers;
353
354	var	attrName,
355		attrValue;
356
357	// add all of the optional attributes to the array
358	for ( var ndx = 4; ndx < args.length; ndx += 2)
359	{
360		attrName = args[ndx].toLowerCase();
361		attrValue = args[ndx + 1];
362
363		// "name" and "id" should have the same value, the former goes in the embed and the later goes in
364		//  the object. use one array slot 
365		if ( "name" == attrName || "id" == attrName )
366			gTagAttrs["name"] = attrValue;
367
368		else 
369			gTagAttrs[attrName] = attrValue;
370	}
371
372	// init both tags with the required and "special" attributes
373	var objTag =  '<object '
374					+ _QTAddObjectAttr("classid")
375					+ _QTAddObjectAttr("width")
376					+ _QTAddObjectAttr("height")
377					+ _QTAddObjectAttr("codebase")
378					+ _QTAddObjectAttr("name", "id")
379					+ _QTAddObjectAttr("tabindex")
380					+ _QTAddObjectAttr("hspace")
381					+ _QTAddObjectAttr("vspace")
382					+ _QTAddObjectAttr("border")
383					+ _QTAddObjectAttr("align")
384					+ _QTAddObjectAttr("class")
385					+ _QTAddObjectAttr("title")
386					+ _QTAddObjectAttr("accesskey")
387					+ _QTAddObjectAttr("noexternaldata")
388					+ '>\n'
389					+ _QTAddObjectParam("src", generateXHTML);
390	var embedTag = '  <embed '
391					+ _QTAddEmbedAttr("src")
392					+ _QTAddEmbedAttr("width")
393					+ _QTAddEmbedAttr("height")
394					+ _QTAddEmbedAttr("pluginspage")
395					+ _QTAddEmbedAttr("name")
396					+ _QTAddEmbedAttr("align")
397					+ _QTAddEmbedAttr("tabindex");
398
399	// delete the attributes/params we have already added
400	_QTDeleteTagAttrs("src","width","height","pluginspage","classid","codebase","name","tabindex",
401					"hspace","vspace","border","align","noexternaldata","class","title","accesskey");
402
403	// and finally, add all of the remaining attributes to the embed and object
404	for ( var attrName in gTagAttrs )
405	{
406		attrValue = gTagAttrs[attrName];
407		if ( null != attrValue )
408		{
409			embedTag += _QTAddEmbedAttr(attrName);
410			objTag += _QTAddObjectParam(attrName, generateXHTML);
411		}
412	} 
413
414	// end both tags, we're done
415	return objTag + embedTag + '> </em' + 'bed>\n</ob' + 'ject' + '>';
416}
417
418// return the object/embed as a string
419function QT_GenerateOBJECTText()
420{
421	return _QTGenerate("QT_GenerateOBJECTText", false, arguments);
422}
423
424function QT_GenerateOBJECTText_XHTML()
425{
426	return _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments);
427}
428
429function QT_WriteOBJECT()
430{
431	document.writeln(_QTGenerate("QT_WriteOBJECT", false, arguments));
432}
433
434function QT_WriteOBJECT_XHTML()
435{
436	document.writeln(_QTGenerate("QT_WriteOBJECT_XHTML", true, arguments));
437}
438function addLoadEvent(func) {	
439  var oldonload = window.onload;	
440  if (typeof window.onload != 'function') {		
441    window.onload = func;	
442  } else {		
443    window.onload = function() {			
444      if (oldonload) {				
445        oldonload();			
446      }			
447      func();			
448    }		
449  }	
450}
451
452var getElementsByClassName = function (className, tag, elm){
453	if (document.getElementsByClassName) {
454		getElementsByClassName = function (className, tag, elm) {
455			elm = elm || document;
456			var elements = elm.getElementsByClassName(className),
457				nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
458				returnElements = [],
459				current;
460			for(var i=0, il=elements.length; i<il; i+=1){
461				current = elements[i];
462				if(!nodeName || nodeName.test(current.nodeName)) {
463					returnElements.push(current);
464				}
465			}
466			return returnElements;
467		};
468	}
469	else if (document.evaluate) {
470		getElementsByClassName = function (className, tag, elm) {
471			tag = tag || "*";
472			elm = elm || document;
473			var classes = className.split(" "),
474				classesToCheck = "",
475				xhtmlNamespace = "http://www.w3.org/1999/xhtml",
476				namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
477				returnElements = [],
478				elements,
479				node;
480			for(var j=0, jl=classes.length; j<jl; j+=1){
481				classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
482			}
483			try	{
484				elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
485			}
486			catch (e) {
487				elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
488			}
489			while ((node = elements.iterateNext())) {
490				returnElements.push(node);
491			}
492			return returnElements;
493		};
494	}
495	else {
496		getElementsByClassName = function (className, tag, elm) {
497			tag = tag || "*";
498			elm = elm || document;
499			var classes = className.split(" "),
500				classesToCheck = [],
501				elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
502				current,
503				returnElements = [],
504				match;
505			for(var k=0, kl=classes.length; k<kl; k+=1){
506				classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
507			}
508			for(var l=0, ll=elements.length; l<ll; l+=1){
509				current = elements[l];
510				match = false;
511				for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
512					match = classesToCheck[m].test(current.className);
513					if (!match) {
514						break;
515					}
516				}
517				if (match) {
518					returnElements.push(current);
519				}
520			}
521			return returnElements;
522		};
523	}
524	return getElementsByClassName(className, tag, elm);
525};
526
527
528
529function addToHeader() {
530	var theElement=document.getElementById('addToHeader');
531	var insertNode=document.getElementById('headerContainer');
532	if(theElement) {
533		var importedHeaderDiv=document.createElement('div');
534		importedHeaderDiv.setAttribute('id', 'importedHeader');
535		insertNode.insertBefore(importedHeaderDiv,insertNode.firstChild);
536		importedHeaderDiv.insertBefore(theElement, null);
537		theElement.style.display='block';
538		}
539	return;
540}
541
542function addToFooter() {
543	var theElement=document.getElementById('addToFooter');
544	var insertNode=document.getElementById('footerWrapper');
545	if(theElement) {
546		var importedFooterDiv=document.createElement('div');
547		importedFooterDiv.setAttribute('id', 'importedFooter');
548		insertNode.insertBefore(importedFooterDiv,insertNode.firstChild);
549		importedFooterDiv.insertBefore(theElement, null);
550		theElement.style.display='block';
551		}
552	return;
553}
554
555function addToSideNavTop() {
556	var theElement=document.getElementById('addToSideNavTop');
557	var insertNode=document.getElementById('aside');
558	if(theElement) {
559		var importedHeaderDiv=document.createElement('div');
560		importedHeaderDiv.setAttribute('id', 'importedSideBar');
561		insertNode.insertBefore(importedHeaderDiv,insertNode.firstChild);
562		importedHeaderDiv.insertBefore(theElement, null);
563		theElement.style.display='block';
564		}
565	return;
566}
567
568
569
570addLoadEvent(externalLinks);

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.