PageSourceSearch

https://www.criquiers.fr/js/mediaboxAdv-1.2.4.js

js criquiers.fr collected 2026-10-03 02:46:14 UTC 38,856 bytes, 891 lines download raw bytes

1/*
2	mediaboxAdvanced v1.2.4 - The ultimate extension of Slimbox and Mediabox; an all-media script
3	updated 2010.06.15
4	(c) 2007-2010 John Einselen <http://iaian7.com>
5		based on
6	based on Slimbox v1.64 - The ultimate lightweight Lightbox clone
7	(c) 2007-2008 Christophe Beyls <http://www.digitalia.be>
8	MIT-style license.
9*/
10
11var Mediabox;
12
13(function() {
14	// Global variables, accessible to Mediabox only
15	var options, images, activeImage, prevImage, nextImage, top, mTop, left, mLeft, winWidth, winHeight, fx, preload, preloadPrev = new Image(), preloadNext = new Image(), foxfix = false, iefix = false,
16	// DOM elements
17	overlay, center, image, bottom, captionSplit, title, caption, prevLink, number, nextLink,
18	// Mediabox specific vars
19	URL, WH, WHL, elrel, mediaWidth, mediaHeight, mediaType = "none", mediaSplit, mediaId = "mediaBox", mediaFmt;
20
21	/*	Initialization	*/
22
23	window.addEvent("domready", function() {
24		// Create and append the Mediabox HTML code at the bottom of the document
25		document.id(document.body).adopt(
26			$$([
27				overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", close),
28				center = new Element("div", {id: "mbCenter"})
29			]).setStyle("display", "none")
30		);
31
32		image = new Element("div", {id: "mbImage"}).injectInside(center);
33		bottom = new Element("div", {id: "mbBottom"}).injectInside(center).adopt(
34			new Element("a", {id: "mbCloseLink", href: "#"}).addEvent("click", close),
35			prevLink = new Element("a", {id: "mbPrevLink", href: "#"}).addEvent("click", previous),
36			nextLink = new Element("a", {id: "mbNextLink", href: "#"}).addEvent("click", next),
37			title = new Element("div", {id: "mbTitle"}),
38			number = new Element("div", {id: "mbNumber"}),
39			caption = new Element("div", {id: "mbCaption"})
40		);
41
42		fx = {
43			overlay: new Fx.Tween(overlay, {property: "opacity", duration: 360}).set(0),
44			image: new Fx.Tween(image, {property: "opacity", duration: 360, onComplete: captionAnimate}),
45			bottom: new Fx.Tween(bottom, {property: "opacity", duration: 240}).set(0)
46		};
47	});
48
49	/*	API		*/
50
51	Mediabox = {
52		close: function(){ 
53			close();	// Thanks to Yosha on the google group for fixing the close function API!
54		}, 
55
56		open: function(_images, startImage, _options) {
57			options = $extend({
58				loop: false,					// Allows to navigate between first and last images
59				keyboard: true,					// Enables keyboard control; escape key, left arrow, and right arrow
60				alpha: true,					// Adds 'x', 'c', 'p', and 'n' when keyboard control is also set to true
61				stopKey: false,					// Stops all default keyboard actions while overlay is open (such as up/down arrows)
62													// Does not apply to iFrame content, does not affect mouse scrolling
63				overlayOpacity: 0.7,			// 1 is opaque, 0 is completely transparent (change the color in the CSS file)
64				resizeOpening: true,			// Determines if box opens small and grows (true) or starts at larger size (false)
65				resizeDuration: 240,			// Duration of each of the box resize animations (in milliseconds)
66				resizeTransition: false,		// Mootools transition effect (false leaves it at the default)
67				initialWidth: 320,				// Initial width of the box (in pixels)
68				initialHeight: 180,				// Initial height of the box (in pixels)
69				defaultWidth: 640,				// Default width of the box (in pixels) for undefined media (MP4, FLV, etc.)
70				defaultHeight: 360,				// Default height of the box (in pixels) for undefined media (MP4, FLV, etc.)
71				showCaption: true,				// Display the title and caption, true / false
72				showCounter: true,				// If true, a counter will only be shown if there is more than 1 image to display
73				counterText: '({x} sur {y})',	// Translate or change as you wish
74//			Image options
75				imgBackground: false,			// Embed images as CSS background (true) or <img> tag (false)
76												// ...a CSS background is naturally non-clickable, preventing downloads
77												// ...the IMG tag allows automatic scaling for smaller screens, minimal no-click code is included but does not work in Opera
78				imgPadding: 70,					// Clearance necessary for images larger than the window size (only used when imgBackgroun
78d is false)
79												// Change this number only if the CSS style is significantly divergent from the original, and requires different sizes
80//			Inline options
81//				overflow: 'auto',				// Sets CSS overflow of the overflow to allow for
82//			Global media options
83				scriptaccess: 'true',		// Allow script access to flash files
84				fullscreen: 'true',			// Use fullscreen
85				fullscreenNum: '1',			// 1 = true
86				autoplay: 'true',			// Plays the video as soon as it's opened
87				autoplayNum: '1',			// 1 = true
88				autoplayYes: 'yes',			// yes = true
89				volume: '100',				// 0-100, used for NonverBlaster and Quicktime players
90				medialoop: 'true',			// Loop video playback, true / false, used for NonverBlaster and Quicktime players
91				bgcolor: '#000000',			// Background color, used for flash and QT media
92				wmode: 'opaque',			// Background setting for Adobe Flash ('opaque' and 'transparent' are most common)
93//			NonverBlaster
94				useNB: true,				// use NonverBlaster (true) or JW Media Player (false) for .flv and .mp4 files
95				playerpath: 'typo3conf/ext/mediabox/res/NonverBlaster.swf',	// Path to NonverBlaster.swf
96				controlColor: '0xFFFFFF',	// set the controlbar color
97				controlBackColor: '0x000000',	// set the controlbar color
98				showTimecode: 'false',		// turn timecode display off or on
99//			JW Media Player settings and options
100				JWplayerpath: 'typo3conf/ext/mediabox/res/mediaplayer.swf',	// Path to the mediaplayer.swf or flvplayer.swf file
101				backcolor:	'000000',		// Base color for the controller, color name / hex value (0x000000)
102				frontcolor: '999999',		// Text and button color for the controller, color name / hex value (0x000000)
103				lightcolor: '000000',		// Rollover color for the controller, color name / hex value (0x000000)
104				screencolor: '000000',		// Rollover color for the controller, color name / hex value (0x000000)
105				controlbar: 'over',			// bottom, over, none (this setting is ignored when playing audio files)
106//			Quicktime options
107				controller: 'true',			// Show controller, true / false
108//			Flickr options
109				flInfo: 'true',				// Show title and info at video start
110//			Revver options
111				revverID: '187866',			// Revver affiliate ID, required for ad revinue sharing
112				revverFullscreen: 'true',	// Fullscreen option
113				revverBack: '000000',		// Background color
114				revverFront: 'ffffff',		// Foreground color
115				revverGrad: '000000',		// Gradation color
116//			Ustream options
117				usViewers: 'true',				// Show online viewer count (true/false)
118//			Youtube options
119				ytBorder: '0',				// Outline				(1=true, 0=false)
120				ytColor1: '000000',			// Outline color
121				ytColor2: '333333',			// Base interface color (highlight colors stay consistent)
122				ytQuality: '&ap=%2526fmt%3D18', // Leave empty for standard quality, use '&ap=%2526fmt%3D18' for high quality, and '&ap=%2526fmt%3D22' for HD (note that not all videos are availible in high quality, and very few in HD)
123				ytRel: '0',					// Show related videos	(1=true, 0=false)
124				ytInfo: '1',				// Show video info		(1=true, 0=false)
125				ytSearch: '0',				// Show search field	(1=true, 0=false)
126//			Viddyou options
127				vuPlayer: 'basic',			// Use 'full' or 'basic' players
128//			Vimeo options
129				vmTitle: '1',				// Show video title
130				vmByline: '1',				// Show byline
131				vmPortrait: '1',			// Show author portrait
132				vmColor: 'ffffff'			// Custom controller colors, hex value minus the # sign, defult is 5ca0b5
133			}, _options || {});
134
135			if ((Browser.Engine.gecko) && (Browser.Engine.version<19)) {	// Fixes Firefox 2 and Camino 1.6 incompatibility with opacity + flash
136				foxfix = true;
137				options.overlayOpacity = 1;
138				overlay.className = 'mbOverlayFF';
139			}
140/*
141			if ((Browser.Engine.gecko)) {	// Fixes Firefox 2 and Camino 1.6 incompatibility with opacity + flash
142				foxfix = true;
143				overlay.setStyle("position", "absolute");
144				if ((Browser.Engine.version<19)) {
145					options.overlayOpacity = 1;
146					overlay.className = 'mbOverlayFF';
147				}
148			}
149*/
150			if (typeof _images == "string") {	// The function is called for a single image, with URL and Title as first two arguments
151				_images = [[_images,startImage,_options]];
152				startImage = 0;
153			}
154
155			images = _images;
156			options.loop = options.loop && (images.length > 1);
157
158			if ((Browser.Engine.trident) && (Browser.Engine.version<5)) {	// Fixes IE 6 and earlier incompatibilities with CSS position: fixed;
159				iefix = true;
160				overlay.className = 'mbOverlayIE';
161				overlay.setStyle("position", "absolute");
162				position();
163			}
164			size();
165			setup(true);
166			top = window.getScrollTop() + (window.getHeight()/2);
167			left = window.getScrollLeft() + (window.getWidth()/2);
168			fx.resize = new Fx.Morph(center, $extend({duration: options.resizeDuration, onComplete: imageAnimate}, options.resizeTransition ? {transition: options.resizeTransition} : {}));
169			center.setStyles({top: top, left: left, width: options.initialWidth, height: options.initialHeight, marginTop: -(options.initialHeight/2), marginLeft: -(options.initialWidth/2), display: ""});
170			fx.overlay.start(options.overlayOpacity);
171			return changeImage(startImage);
172		}
173	};
174
175	Element.implement({
176		mediabox: function(_options, linkMapper) {
177			$$(this).mediabox(_options, linkMapper);	// The processing of a single element is similar to the processing of a collection with a single element
178
179			return this;
180		}
181	});
182
183	Elements.implement({
184		/*
185			options:	Optional options object, see Mediabox.open()
186			linkMapper:	Optional function taking a link DOM element and an index as arguments and returning an array containing 3 elements:
187						the image URL and the image caption (may contain HTML)
188			linksFilter:Optional function taking a link DOM element and an index as arguments and returning true if the element is part of
189						the image collection that will be shown on click, false if not. "this" refers to the element that was clicked.
190						This function must always return true when the DOM element argument is "this".
191		*/
192		mediabox: function(_options, linkMapper, linksFilter) {
193			linkMapper = linkMapper || function(el) {
194				elrel = el.rel.split(/[\[\]]/);
195				elrel = elrel[1];
196				return [el.href, el.title, elrel];
197			};
198
199			linksFilter = linksFilter || function() {
200				return true;
201			};
202
203			var links = this;
204
205			links.addEvent('contextmenu', function(e){
206				if (this.toString().match(/\.gif|\.jpg|\.jpeg|\.png/i)) e.stop();
207			});
208
209			links.removeEvents("click").addEvent("click", function() {
210				// Build the list of images that will be displayed
211				var filteredArray = links.filter(linksFilter, this);
212				var filteredLinks = [];
213				var filteredHrefs = [];
214
215				filteredArray.each(function(item, index){
216					if(filteredHrefs.indexOf(item.toString()) < 0) {
217						filteredLinks.include(filteredArray[index]);
218						filteredHrefs.include(filteredArray[index].toString());
219					};
220				});
221
222				return Mediabox.open(filteredLinks.map(linkMapper), filteredHrefs.indexOf(this.toString()), _options);
223			});
224
225			return links;
226		}
227	});
228
229	/*	Internal functions	*/
230
231	function position() {
232		overlay.setStyles({top: window.getScrollTop(), left: window.getScrollLeft()});
233	}
234
235	function size() {
236		winWidth = window.getWidth();
237		winHeight = window.getHeight();
238		overlay.setStyles({width: winWidth, height: winHeight});
239	}
240
241	function setup(open) {
242		// Hides on-page objects and embeds while the overlay is open, nessesary to counteract Firefox stupidity
243		if (Browser.Engine.gecko) {
244			["object", window.ie ? "select" : "embed"].forEach(function(tag) {
245				Array.forEach(document.getElementsByTagName(tag), function(el) {
246					if (open) el._mediabox = el.style.visibility;
247					el.style.visibility = open ? "hidden" : el._mediabox;
248				});
249			});
250		}
251
252		overlay.style.display = open ? "" : "none";
253
254		var fn = open ? "addEvent" : "removeEvent";
255		if (iefix) window[fn]("scroll", position);
256		window[fn]("resize", size);
257		if (options.keyboard) document[fn]("keydown", keyDown);
258	}
259
260	function keyDown(event) {
261		if (options.alpha) {
262			switch(event.code) {
263				case 27:	// Esc
264				case 88:	// 'x'
265				case 67:	// 'c'
266					close();
267					break;
268				case 37:	// Left arrow
269				case 80:	// 'p'
270					previous();
271					break;
272				case 39:	// Right arrow
273				case 78:	// 'n'
274					next();
275			}
276		} else {
277			switch(event.code) {
278				case 27:	// Esc
279					close();
280					break;
281				case 37:	// Left arrow
282					previous();
283					break;
284				case 39:	// Right arrow
285					next();
286			}
287		}
288		if (options.stopKey) { return false; };
289	}
290
291	function previous() {
292		return changeImage(prevImage);
293	}
294
295	function next() {
296		return changeImage(nextImage);
297	}
298
299	function changeImage(imageIndex) {
300		if (imageIndex >= 0) {
301			image.set('html', '');
302			activeImage = imageIndex;
303			prevImage = ((activeImage || !options.loop) ? activeImage : images.length) - 1;
304			nextImage = activeImage + 1;
305			if (nextImage == images.length) nextImage = options.loop ? 0 : -1;
306			stop();
307			center.className = "mbLoading";
308
309// MEDIABOX FORMATING
310			if (!images[imageIndex][2]) images[imageIndex][2] = '';	// Thanks to Leo Feyer for offering this fix
311			WH = images[imageIndex][2].split(' ');
312			WHL = WH.length;
313			if (WHL>1) {
314				mediaWidth = (WH[WHL-2].match("%")) ? (window.getWidth()*((WH[WHL-2].replace("%", ""))*0.01))+"px" : WH[WHL-2]+"px";
315				mediaHeight = (WH[WHL-1].match("%")) ? (window.getHeight()*((WH[WHL-1].replace("%", ""))*0.01))+"px" : WH[WHL-1]+"px";
316			} else {
317				mediaWidth = "";
318				mediaHeight = "";
319			}
320			URL = images[imageIndex][0];
321			URL = encodeURI(URL).replace("(","%28").replace(")","%29");
322			captionSplit = images[activeImage][1].split('::');
323
324// Quietube and yFrog support
325			if (URL.match(/quietube\.com/i)) {
326				mediaSplit = URL.split('v.php/');
327				URL = mediaSplit[1];
328			} else if (URL.match(/\/\/yfrog/i)) {
329				mediaType = (URL.substring(URL.length-1));
330				if (mediaType.match(/b|g|j|p|t/i)) mediaType = 'image';
331				if (mediaType == 's') mediaType = 'flash';
332				if (mediaType.match(/f|z/i)) mediaType = 'video';
333				URL = URL+":iphone";
334			}
335
336// MEDIA TYPES
337// IMAGES
338			if (URL.match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i) || mediaType == 'image') {
339				mediaType = 'img';
340				URL = URL.replace(/twitpic\.com/i, "twitpic.com/show/full");
341				preload = new Image();
342				preload.onload = startEffect;
343				preload.src = URL;
344// FLV, MP4
345			} else if (URL.match(/\.flv|\.mp4/i) || mediaType == 'video') {
346				mediaType = 'obj';
347				mediaWidth = mediaWidth || options.defaultWidth;
348				mediaHeight = mediaHeight || options.defaultHeight;
349				if (options.useNB) {
350				preload = new Swiff(''+options.playerpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer=6&showTimecode='+options.showTimecode+'&loop='+options.medialoop+'&controlColor='+options.controlColor+'&controlBackColor='+options.controlBackColor+'&defaultVolume='+options.volume+'&scaleIfFullScreen=true&showScalingButton=true&crop=false', {
351					id: 'MediaboxSWF',
352					width: mediaWidth,
353					height: mediaHeight,
354					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
355					});
356				} else {
357				preload = new Swiff(''+options.JWplayerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay+'&controlbar='+options.controlbar, {
358					id: 'MediaboxSWF',
359					width: mediaWidth,
360					height: mediaHeight,
361					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
362					});
363				}
364				startEffect();
365// MP3, AAC
366			} else if (URL.match(/\.mp3|\.aac|tweetmic\.com|tmic\.fm/i) || mediaType == 'audio') {
367				mediaType = 'obj';
368				mediaWidth = mediaWidth || options.defaultWidth;
369				mediaHeight = mediaHeight || "20px";
370				if (URL.match(/tweetmic\.com|tmic\.fm/i)) {
371					URL = URL.split('/');
372					URL[4] = URL[4] || URL[3];
373					URL = "http://media4.fjarnet.net/tweet/tweetmicapp-"+URL[4]+'.mp3';
374				}
375				if (options.useNB) {
376				preload = new Swiff(''+options.playerpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer=6&showTimecode='+options.showTimecode+'&loop='+options.medialoop+'&controlColor='+options.controlColor+'&controlBackColor='+options.controlBackColor+'&defaultVolume='+options.volume+'&scaleIfFullScreen=true&showScalingButton=true&crop=false', {
377					id: 'MediaboxSWF',
378					width: mediaWidth,
379					height: mediaHeight,
380					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
381					});
382				} else {
383				preload = new Swiff(''+options.JWplayerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay, {
384					id: 'MediaboxSWF',
385					width: mediaWidth,
386					height: mediaHeight,
387					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
388					});
389				}
390				startEffect();
391// SWF
392			} else if (URL.match(/\.swf/i) || mediaType == 'flash') {
393				mediaType = 'obj';
394				mediaWidth = mediaWidth || options.defaultWidth;
395				mediaHeight = mediaHeight || options.defaultHeight;
396				preload = new Swiff(URL, {
397					id: 'MediaboxSWF',
398					width: mediaWidth,
399					height: mediaHeight,
400					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
401					});
402				startEffect();
403// Quicktime
404			} else if (URL.match(/\.mov|\.m4v|\.m4a|\.aiff|\.avi|\.caf|\.dv|\.mid|\.m3u|\.mp3|\.mp2|\.mp4|\.qtz/i) || mediaType == 'qt') {
405				mediaType = 'qt';
406				mediaWidth = mediaWidth || options.defaultWidth;
407				mediaHeight = (parseInt(mediaHeight)+16)+"px" || options.defaultHeight;
408				preload = new Quickie(URL, {
409					id: 'MediaboxQT',
410					width: mediaWidth,
411					height: mediaHeight,
412					container: 'mbImage',
413					attributes: {controller: options.controller, autoplay: options.autoplay, volume: options.volume, loop: options.medialoop, bgcolor: options.bgcolor}
414					});
415				startEffect();
416// SOCIAL SITES
417// Blip.tv
418			} else if (URL.match(/blip\.tv/i)) {
419				mediaType = 'obj';
420				mediaWidth = mediaWidth || "640px";
421				mediaHeight = mediaHeight || "390px";
422				preload = new Swiff(URL, {
423					src: URL,
424					width: mediaWidth,
425					height: mediaHeight,
426					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
427					});
428				startEffect();
429// Break.com
430			} else if (URL.match(/break\.com/i)) {
431				mediaType = 'obj';
432				mediaWidth = mediaWidth || "464px";
433				mediaHeight = mediaHeight || "376px";
434				mediaId = URL.match(/\d{6}/g)
435				preload = new Swiff('http://embed.break.com/'+mediaId, {
436					width: mediaWidth,
437					height: mediaHeight,
438					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
439					});
440				startEffect();
441// DailyMotion
442			} else if (URL.match(/dailymotion\.com/i)) {
443				mediaType = 'obj';
444				mediaWidth = mediaWidth || "480px";
445				mediaHeight = mediaHeight || "381px";
446				preload = new Swiff(URL, {
447					id: mediaId,
448					width: mediaWidth,
449					height: mediaHeight,
450					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
451					});
452				startEffect();
453// Facebook
454			} else if (URL.match(/facebook\.com/i)) {
455				mediaType = 'obj';
456				mediaWidth = mediaWidth || "320px";
457				mediaHeight = mediaHeight || "240px";
458				mediaSplit = URL.split('v=');
459				mediaSplit = mediaSplit[1].split('&');
460				mediaId = mediaSplit[0];
461				preload = new Swiff('http://www.facebook.com/v/'+mediaId, {
462					movie: 'http://www.facebook.com/v/'+mediaId,
463					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
464					width: mediaWidth,
465					height: mediaHeight,
466					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
467					});
468				startEffect();
469// Flickr
470			} else if (URL.match(/flickr\.com/i)) {
471				mediaType = 'obj';
472				mediaWidth = mediaWidth || "500px";
473				mediaHeight = mediaHeight || "375px";
474				mediaSplit = URL.split('/');
475				mediaId = mediaSplit[5];
476				preload = new Swiff('http://www.flickr.com/apps/video/stewart.swf', {
477					id: mediaId,
478					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
479					width: mediaWidth,
480					height: mediaHeight,
481					params: {flashvars: 'photo_id='+mediaId+'&amp;show_info_box='+options.flInfo, wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
482					});
483				startEffect();
484// GameTrailers Video
485			} else if (URL.match(/gametrailers\.com/i)) {
486				mediaType = 'obj';
487				mediaWidth = mediaWidth || "480px";
488				mediaHeight = mediaHeight || "392px";
489				mediaId = URL.match(/\d{5}/g)
490				preload = new Swiff('http://www.gametrailers.com/remote_wrap.php?mid='+mediaId, {
491					id: mediaId,
492					width: mediaWidth,
493					height: mediaHeight,
494					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
495					});
496				startEffect();
497// Google Video
498			} else if (URL.match(/google\.com\/videoplay/i)) {
499				mediaType = 'obj';
500				mediaWidth = mediaWidth || "400px";
501				mediaHeight = mediaHeight || "326px";
502				mediaSplit = URL.split('=');
503				mediaId = mediaSplit[1];
504				preload = new Swiff('http://video.google.com/googleplayer.swf?docId='+mediaId+'&autoplay='+options.autoplayNum, {
505					id: mediaId,
506					width: mediaWidth,
507					height: mediaHeight,
508					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
509					});
510				startEffect();
511// Megavideo - Thanks to Robert Jandreu for suggesting this code!
512			} else if (URL.match(/megavideo\.com/i)) {
513				mediaType = 'obj';
514				mediaWidth = mediaWidth || "640px";
515				mediaHeight = mediaHeight || "360px";
516				mediaSplit = URL.split('=');
517				mediaId = mediaSplit[1];
518				preload = new Swiff('http://wwwstatic.megavideo.com/mv_player.swf?v='+mediaId, {
519					id: mediaId,
520					width: mediaWidth,
521					height: mediaHeight,
522					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
523					});
524				startEffect();
525// Metacafe
526			} else if (URL.match(/metacafe\.com\/watch/i)) {
527				mediaType = 'obj';
528				mediaWidth = mediaWidth || "400px";
529				mediaHeight = mediaHeight || "345px";
530				mediaSplit = URL.split('/');
531				mediaId = mediaSplit[4];
532				preload = new Swiff('http://www.metacafe.com/fplayer/'+mediaId+'/.swf?playerVars=autoPlay='+options.autoplayYes, {
533					id: mediaId,
534					width: mediaWidth,
535					height: mediaHeight,
536					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
537					});
538				startEffect();
539// Myspace
540			} else if (URL.match(/vids\.myspace\.com/i)) {
541				mediaType = 'obj';
542				mediaWidth = mediaWidth || "425px";
543				mediaHeight = mediaHeight || "360px";
544				preload = new Swiff(URL, {
545					id: mediaId,
546					width: mediaWidth,
547					height: mediaHeight,
548					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
549					});
550				startEffect();
551// Revver
552			} else if (URL.match(/revver\.com/i)) {
553				mediaType = 'obj';
554				mediaWidth = mediaWidth || "480px";
555				mediaHeight = mediaHeight || "392px";
556				mediaSplit = URL.split('/');
557				mediaId = mediaSplit[4];
558				preload = new Swiff('http://flash.revver.com/player/1.0/player.swf?mediaId='+mediaId+'&affiliateId='+options.revverID+'&allowFullScreen='+options.revverFullscreen+'&autoStart='+options.autoplay+'&backColor=#'+options.revverBack+'&frontColor=#'+options.revverFront+'&gradColor=#'+options.revverGrad+'&shareUrl=revver', {
559					id: mediaId,
560					width: mediaWidth,
561					height: mediaHeight,
562					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
563					});
564				startEffect();
565// Rutube
566			} else if (URL.match(/rutube\.ru/i)) {
567				mediaType = 'obj';
568				mediaWidth = mediaWidth || "470px";
569				mediaHeight = mediaHeight || "353px";
570				mediaSplit = URL.split('=');
571				mediaId = mediaSplit[1];
572				preload = new Swiff('http://video.rutube.ru/'+mediaId, {
573					movie: 'http://video.rutube.ru/'+mediaId,
574					width: mediaWidth,
575					height: mediaHeight,
576					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
577					});
578				startEffect();
579// Seesmic
580			} else if (URL.match(/seesmic\.com/i)) {
581				mediaType = 'obj';
582				mediaWidth = mediaWidth || "435px";
583				mediaHeight = mediaHeight || "355px";
584				mediaSplit = URL.split('/');
585				mediaId = mediaSplit[5];
586				preload = new Swiff('http://seesmic.com/Standalone.swf?video='+mediaId, {
587					id: mediaId,
588					width: mediaWidth,
589					height: mediaHeight,
590					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
591					});
592				startEffect();
593// Tudou
594			} else if (URL.match(/tudou\.com/i)) {
595				mediaType = 'obj';
596				mediaWidth = mediaWidth || "400px";
597				mediaHeight = mediaHeight || "340px";
598				mediaSplit = URL.split('/');
599				mediaId = mediaSplit[5];
600				preload = new Swiff('http://www.tudou.com/v/'+mediaId, {
601					width: mediaWidth,
602					height: mediaHeight,
603					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
604					});
605				startEffect();
606// Twitvcam
607			} else if (URL.match(/twitcam\.com/i)) {
608				mediaType = 'obj';
609				mediaWidth = mediaWidth || "320px";
610				mediaHeight = mediaHeight || "265px";
611				mediaSplit = URL.split('/');
612				mediaId = mediaSplit[3];
613				preload = new Swiff('http://static.livestream.com/chromelessPlayer/wrappers/TwitcamPlayer.swf?hash='+mediaId, {
614					width: mediaWidth,
615					height: mediaHeight,
616					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
617					});
618				startEffect();
619// Twitvid
620			} else if (URL.match(/twitvid\.com/i)) {
621				mediaType = 'obj';
622				mediaWidth = mediaWidth || "600px";
623				mediaHeight = mediaHeight || "338px";
624				mediaSplit = URL.split('/');
625				mediaId = mediaSplit[3];
626				preload = new Swiff('http://www.twitvid.com/player/'+mediaId, {
627					width: mediaWidth,
628					height: mediaHeight,
629					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
630					});
631				startEffect();
632// Ustream.tv
633			} else if (URL.match(/ustream\.tv/i)) {
634				mediaType = 'obj';
635				mediaWidth = mediaWidth || "400px";
636				mediaHeight = mediaHeight || "326px";
637				preload = new Swiff(URL+'&amp;viewcount='+options.usViewers+'&amp;autoplay='+options.autoplay, {
638					width: mediaWidth,
639					height: mediaHeight,
640					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
641					});
642				startEffect();
643// YouKu
644			} else if (URL.match(/youku\.com/i)) {
645				mediaType = 'obj';
646				mediaWidth = mediaWidth || "480px";
647				mediaHeight = mediaHeight || "400px";
648				mediaSplit = URL.split('id_');
649				mediaId = mediaSplit[1];
650				preload = new Swiff('http://player.youku.com/player.php/sid/'+mediaId+'=/v.swf', {
651					width: mediaWidth,
652					height: mediaHeight,
653					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
654					});
655				startEffect();
656// YouTube
657			} else if (URL.match(/youtube\.com\/watch/i)) {
658				mediaType = 'obj';
659				mediaSplit = URL.split('v=');
660				mediaId = mediaSplit[1];
661				if (mediaId.match(/fmt=18/i)) {
662					mediaFmt = '&ap=%2526fmt%3D18';
663					mediaWidth = mediaWidth || "560px";
664					mediaHeight = mediaHeight || "345px";
665				} else if (mediaId.match(/fmt=22/i)) {
666					mediaFmt = '&ap=%2526fmt%3D22';
667					mediaWidth = mediaWidth || "640px";
668					mediaHeight = mediaHeight || "385px";
669				} else {
670					mediaFmt = options.ytQuality;
671					mediaWidth = mediaWidth || "480px";
672					mediaHeight = mediaHeight || "295px";
673				}
674				preload = new Swiff('http://www.youtube.com/v/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+mediaFmt+'&border='+options.ytBorder+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2+'&rel='+options.ytRel+'&showinfo='+options.ytInfo+'&showsearch='+options.ytSearch, {
675					id: mediaId,
676					width: mediaWidth,
677					height: mediaHeight,
678					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
679					});
680				startEffect();
681// YouTube
682			} else if (URL.match(/youtube\.com\/view/i)) {
683				mediaType = 'obj';
684				mediaSplit = URL.split('p=');
685				mediaId = mediaSplit[1];
686				mediaWidth = mediaWidth || "480px";
687				mediaHeight = mediaHeight || "385px";
688				preload = new Swiff('http://www.youtube.com/p/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+mediaFmt+'&border='+options.ytBorder+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2+'&rel='+options.ytRel+'&showinfo='+options.ytInfo+'&showsearch='+options.ytSearch, {
689					id: mediaId,
690					width: mediaWidth,
691					height: mediaHeight,
692					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
693					});
694				startEffect();
695// Veoh
696			} else if (URL.match(/veoh\.com/i)) {
697				mediaType = 'obj';
698				mediaWidth = mediaWidth || "410px";
699				mediaHeight = mediaHeight || "341px";
700				URL = URL.replace('%3D','/');
701				mediaSplit = URL.split('watch/');
702				mediaId = mediaSplit[1];
703				preload = new Swiff('http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.5.2.1001&permalinkId='+mediaId+'&player=videodetail
703sembedded&videoAutoPlay='+options.AutoplayNum+'&id=anonymous', {
704					id: mediaId,
705					width: mediaWidth,
706					height: mediaHeight,
707					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
708					});
709				startEffect();
710// Viddler
711			} else if (URL.match(/viddler\.com/i)) {
712				mediaType = 'obj';
713				mediaWidth = mediaWidth || "437px";
714				mediaHeight = mediaHeight || "370px";
715				mediaSplit = URL.split('/');
716				mediaId = mediaSplit[4];
717				preload = new Swiff(URL, {
718					id: 'viddler_'+mediaId,
719					movie: URL,
720					classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
721					width: mediaWidth,
722					height: mediaHeight,
723					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen, id: 'viddler_'+mediaId, movie: URL}
724					});
725				startEffect();
726// Viddyou
727			} else if (URL.match(/viddyou\.com/i)) {
728				mediaType = 'obj';
729				mediaWidth = mediaWidth || "416px";
730				mediaHeight = mediaHeight || "312px";
731				mediaSplit = URL.split('=');
732				mediaId = mediaSplit[1];
733				preload = new Swiff('http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf', {
734					id: mediaId,
735					movie: 'http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf',
736					width: mediaWidth,
737					height: mediaHeight,
738					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
739					});
740				startEffect();
741// Vimeo
742			} else if (URL.match(/vimeo\.com/i)) {
743				mediaType = 'obj';
744				mediaWidth = mediaWidth || "640px";		// site defualt: 400px
745				mediaHeight = mediaHeight || "360px";	// site defualt: 225px
746				mediaSplit = URL.split('/');
747				mediaId = mediaSplit[3];
748				preload = new Swiff('http://www.vimeo.com/moogaloop.swf?clip_id='+mediaId+'&amp;server=www.vimeo.com&amp;fullscreen='+options.fullscreenNum+'&amp;autoplay='+options.autoplayNum+'&amp;show_title='+options.vmTitle+'&amp;show_byline='+options.vmByline+'&amp;show_portrait='+options.vmPortrait+'&amp;color='+options.vmColor, {
749					id: mediaId,
750					width: mediaWidth,
751					height: mediaHeight,
752					params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
753					});
754				startEffect();
755// 12seconds
756			} else if (URL.match(/12seconds\.tv/i)) {
757				mediaType = 'obj';
758				mediaWidth = mediaWidth || "430px";
759				mediaHeight = mediaHeight || "360px";
760				mediaSplit = URL.split('/');
761				mediaId = mediaSplit[5];
762				preload = new Swiff('http://embed.12seconds.tv/players/remotePlayer.swf', {
763					id: mediaId,
764					width: mediaWidth,
765					height: mediaHeight,
766					params: {flashvars: 'vid='+mediaId+'', wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
767					});
768				startEffect();
769// CONTENT TYPES
770// INLINE
771			} else if (URL.match(/\#mb_/i)) {
772				mediaType = 'inline';
773				mediaWidth = mediaWidth || options.defaultWidth;
774				mediaHeight = mediaHeight || options.defaultHeight;
775				URLsplit = URL.split('#');
776				preload = document.id(URLsplit[1]).get('html');
777				startEffect();
778// HTML
779			} else {
780				mediaType = 'url';
781				mediaWidth = mediaWidth || options.defaultWidth;
782				mediaHeight = mediaHeight || options.defaultHeight;
783				mediaId = "mediaId_"+new Date().getTime();	// Safari will not update iframe content with a static id.
784				preload = new Element('iframe', {
785					'src': URL,
786					'id': mediaId,
787					'width': mediaWidth,
788					'height': mediaHeight,
789//					'allowtransparency': 'true',
790					'frameborder': 0
791					});
792				startEffect();
793			}
794		}
795		return false;
796	}
797
798	function startEffect() {
799		if (mediaType == "img"){
800			mediaWidth = preload.width;
801			mediaHeight = preload.height;
802			if (options.imgBackground) {
803				image.setStyles({backgroundImage: "url("+URL+")", display: ""});
804			} else {	// Thanks to Dusan Medlin for fixing large 16x9 image errors in a 4x3 browser
805				if (mediaHeight >
805= winHeight-options.imgPadding && (mediaHeight / winHeight) >= (mediaWidth / winWidth)) {
806					mediaHeight = winHeight-options.imgPadding;
807					mediaWidth = preload.width = parseInt((mediaHeight/preload.height)*mediaWidth);
808					preload.height = mediaHeight;
809				} else if (mediaWidth >= winWidth-options.imgPadding && (mediaHeight / winHeight) < (mediaWidth / winWidth)) {
810					mediaWidth = winWidth-options.imgPadding;
811					mediaHeight = preload.height = parseInt((mediaWidth/preload.width)*mediaHeight);
812					preload.width = mediaWidth;
813				}
814				if (Browser.Engine.trident) preload = document.id(preload);
815				preload.addEvent('mousedown', function(e){ e.stop(); }).addEvent('contextmenu', function(e){ e.stop(); });
816				image.setStyles({backgroundImage: "none", display: ""});
817				preload.inject(image);
818			}
819		} else if (mediaType == "obj") {
820			if (Browser.Plugins.Flash.version<8) {
821				image.setStyles({backgroundImage: "none", display: ""});
822				image.set('html', '<div id="mbError"><b>Error</b><br/>Adobe Flash is either not installed or not up to date, please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" title="Get Flash" target="_new">Adobe.com</a> to download the free player.</div>');
823				mediaWidth = options.DefaultWidth;
824				mediaHeight = options.DefaultHeight;
825			} else {
826				image.setStyles({backgroundImage: "none", display: ""});
827				preload.inject(image);
828			}
829		} else if (mediaType == "qt") {
830			image.setStyles({backgroundImage: "none", display: ""});
831			preload;
832		} else if (mediaType == "inline") {
833//			center.setStyles({overflow: options.overflow});
834			image.setStyles({backgroundImage: "none", display: ""});
835			image.set('html', preload);
836		} else if (mediaType == "url") {
837			image.setStyles({backgroundImage: "none", display: ""});
838			preload.inject(image);
839		} else {
840			image.setStyles({backgroundImage: "none", display: ""});
841			image.set('html', '<div id="mbError"><b>Error</b><br/>A file type error has occoured, please visit <a href="iaian7.com/webcode/mediaboxAdvanced" title="mediaboxAdvanced" target="_new">iaian7.com</a> or contact the website author for more information.</div>');
842			mediaWidth = options.defaultWidth;
843			mediaHeight = options.defaultHeight;
844		}
845		image.setStyles({width: mediaWidth, height: mediaHeight});
846
847		title.set('html', (options.showCaption) ? captionSplit[0] : "");
848		caption.set('html', (options.showCaption && (captionSplit.length > 1)) ? captionSplit[1] : "");
849		number.set('html', (options.showCounter && (images.length > 1)) ? options.counterText.replace(/{x}/, activeImage + 1).replace(/{y}/, images.length) : "");
850
851		if ((prevImage >= 0) && (images[prevImage][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i))) preloadPrev.src = images[prevImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full");
852		if ((nextImage >= 0) && (images[nextImage][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i))) preloadNext.src = images[nextImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full");
853
854		mediaWidth = image.offsetWidth;
855		mediaHeight = image.offsetHeight+bottom.offsetHeight;
856		if (mediaHeight >= top+top-10) { mTop = -(top-10) } else { mTop = -(mediaHeight/2) };
857		if (mediaWidth >= left+left-10) { mLeft = -(left-10) } else { mLeft = -(mediaWidth/2) };
858		if (options.resizeOpening) { fx.resize.start({width: mediaWidth, height: mediaHeight, marginTop: mTop, marginLeft: mLeft});
859		} else { center.setStyles({width: mediaWidth, height: mediaHeight, marginTop: mTop, marginLeft: mLeft}); imageAnimate(); }
860	}
861
862	function imageAnimate() {
863		fx.image.start(1);
864	}
865
866	function captionAnimate() {
867		center.className = "";
868		if (prevImage >= 0) prevLink.style.display = "";
869		if (nextImage >= 0) nextLink.style.display = "";
870		fx.bottom.start(1);
871	}
872
873	function stop() {
874		if (preload) preload.onload = $empty;
875		fx.resize.cancel();
876		fx.image.cancel().set(0);
877		fx.bottom.cancel().set(0);
878		$$(prevLink, nextLink).setStyle("display", "none");
879	}
880
881	function close() {
882		if (activeImage >= 0) {
883			preload.onload = $empty;
884			image.set('html', '');
885			for (var f in fx) fx[f].cancel();
886			center.setStyle("display", "none");
887			fx.overlay.chain(setup).start(0);
888		}
889		return false;
890	}
891})();

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.