1/* 2 mediaboxAdvanced v1.1.1 - The ultimate extension of Slimbox and Mediabox; an all-media script 3 updated 2009.08.08 4 (c) 2007-2009 John Einselen <http://iaian7.com> 5 based on 6 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 15 // Global variables, accessible to Mediabox only 16 var options, images, activeImage, prevImage, nextImage, top, left, fx, preload, preloadPrev = new Image(), preloadNext = new Image(), foxfix = false, iefix = false, 17 // DOM elements 18 overlay, center, image, bottom, captionSplit, title, caption, prevLink, number, nextLink, downloadLink, 19 // Mediabox specific vars 20 URL, WH, WHL, elrel, mediaWidth, mediaHeight, mediaType = "none", mediaSplit, mediaId = "mediaBox", mediaFmt, 21 qtHeight, changedDims = false, embed = false, closeLink, homepageLink; 22 23 /* 24 Initialization 25 */ 26 27 //URL = filteredLinks.map(linkMapper)[filteredHrefs.indexOf(this.toString())][0]; 28 if( null == URL ) 29 { 30 URL = ""; 31 } 32 33 window.addEvent("domready", function() { 34 // Create and append the Mediabox HTML code at the bottom of the document 35 $(document.body).adopt( 36 $$([ 37 overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", close), 38 center = new Element("div", {id: "mbCenter"}) 39 ]).setStyle("display", "none") 40 ); 41 42 image = new Element("div", {id: "mbImage", class: "video-js-box" }).injectInside(center); 43 bottom = new Element("div", {id: "mbBottom"}).injectInside(center).adopt( 44 homepageLink = new Element("a", {id: "mbHomepageLink", href: "#", style: "display:none"}).addEvent("click", homepageClick), 45 closeLink = new Element("a", {id: "mbCloseLink", href: "#"}).addEvent("click", close), 46 nextLink = new Element("a", {id: "mbNextLink", href: "#"}).addEvent("click", next), 47 prevLink = new Element("a", {id: "mbPrevLink", href: "#"}).addEvent("click", previous), 48 downloadLink = new Element("a", {id: "mbDownloadLink", href: "#"}).addEvent("click", downloadClick), 49 title = new Element("div", {id: "mbTitle"}), 50 number = new Element("div", {id: "mbNumber"}), 51 caption = new Element("div", {id: "mbCaption"}) 52 ); 53 54 fx = { 55 overlay: new Fx.Tween(overlay, {property: "opacity", duration: 360}).set(0), 56 image: new Fx.Tween(image, {property: "opacity", duration: 360, onComplete: captionAnimate}), 57 bottom: new Fx.Tween(bottom, {property: "opacity", duration: 240}).set(0) 58 }; 59 }); 60 61 /* 62 API 63 */ 64 65 Mediabox = { 66 close: function(){ 67 close(); // Thanks to Yosha on the google group for fixing the close function API! 68 }, 69 70 embed: function( _images, startImage, _options, _homeUrl ) 71 { 72 embed = true; 73 74 homepageLink.href = "//www.hd-trailers.net/"; 75 homepageLink.style.display = 'inline'; 76 homepageLink.target = '_top'; 77 78 this.open( _images, startImage, _options ); 79 80 URL = _homeUrl; 81 downloadLink.href = URL; 82 downloadLink.target = '_top'; 83 }, 84 85 open: function(_images, startImage, _options) { 86 options = $extend({ 87 loop: false, // Allows to navigate between first and last images 88 stopKey: true, // Prevents default keyboard action (such as up/down arrows), in lieu of the shortcuts 89 // Does not apply to iFrame content 90 // Does not affect mouse scrolling 91 overlayOpacity: 0.7, // 1 is opaque, 0 is completely transparent (change the color in the CSS file) 92 // Remember that Firefox 2 and Camino 1.6 on the Mac require a background .png set in the CSS 93 resizeOpening: true, // Determines if box opens small and grows (true) or start full size (false) 94 resizeDuration: 240, // Duration of each of the box resize animations (in milliseconds) 95 resizeTransition: false, // Mootools transition effect (false leaves it at the default) 96 initialWidth: 320, // Initial width of the box (in pixels) 97 initialHeight: 180, // Initial height of the box (in pixels) 98 defaultWidth: 640, // Default width of the box (in pixels) for undefined media (MP4, FLV, etc.) 99 defaultHeight: 360, // Default height of the box (in pixels) for undefined media (MP4, FLV, etc.) 100 padding: 10, 101 showCaption: true, // Display the title and caption, true / false 102// animateCaption: true, // Animate the caption, true / false 103 showCounter: true, // If true, a counter will only be shown if there is more than 1 image to display 104 counterText: '({x} of {y})', // Translate or change as you wish 105// Global media options 106 scriptaccess: 'true', // Allow script access to flash files 107 fullscreen: 'true', // Use fullscreen 108 fullscreenNum: '1', // 1 = true 109 autoplay: 'true', // Plays the video as soon as it's opened 110 autoplayNum: '1', // 1 = true 111 autoplayYes: 'yes', // yes = true 112 autoplayHTML5: 'autoplay', // autoplay = true 113// volume: '50', // 0-100 (not currently implemented)
114 bgcolor: '#000000', // Background color, used for both flash and QT media 115 wmode: 'opaque', // Background setting for Adobe Flash ('opaque' and 'transparent' are most common) 116// JW Media Player settings and options 117 playerpath: '//static.hd-trailers.net/mediaplayer/player.swf', // Path to the mediaplayer.swf or flvplayer.swf file 118 backcolor: '000000', // Base color for the controller, color name / hex value (0x000000) 119 frontcolor: 'ffffff', // Text and button color for the controller, color name / hex value (0x000000) 120 lightcolor: 'ff0000', // Rollover color for the controller, color name / hex value (0x000000) 121 screencolor: '000000', // Rollover color for the controller, color name / hex value (0x000000) 122 controlbar: 'over', // bottom, over, none (this setting is ignored when playing audio files) 123 buffer: '6', // number of seconds of the file that has to be loaded before starting. 124 icons: 'true', // set this to false to hide the play button and buffering icon in the middle of the video. 125// NonverBlaster 126 useNB: false, // use NonverBlaster in place of the JW Media Player for .flv and .mp4 files 127 NBpath: '/js/NonverBlaster.swf', // Path to NonverBlaster.swf 128 NBloop: 'true', // Loop video playback, true / false 129 controllerColor: '0x777777', // set the controlbar colour 130 showTimecode: 'false', // turn timecode display off or on 131// Quicktime options 132 controller: 'true', // Show controller, true / false 133// Flickr options 134 flInfo: 'true', // Show title and info at video start 135// Revver options 136 revverID: '187866', // Revver affiliate ID, required for ad revinue sharing 137 revverFullscreen: 'true', // Fullscreen option 138 revverBack: '000000', // Background colour 139 revverFront: 'ffffff', // Foreground colour 140 revverGrad: '000000', // Gradation colour 141// Ustream options 142 usViewers: 'true', // Show online viewer count (true/false) 143// Youtube options 144 ytBorder: '0', // Outline (1=true, 0=false) 145 ytColor1: '000000', // Outline colour 146 ytColor2: '333333', // Base interface colour (highlight colours stay consistent) 147 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) 148 ytRel: '0', // Show related videos (1=true, 0=false) 149 ytInfo: '1', // Show video info (1=true, 0=false) 150 ytSearch: '0', // Show search field (1=true, 0=false) 151// Viddyou options 152 vuPlayer: 'basic', // Use 'full' or 'basic' players 153// Vimeo options 154 vmTitle: '1', // Show video title 155 vmByline: '1', // Show byline 156 vmPortrait: '1', // Show author portrait 157 vmColor: 'ffffff' // Custom controller colours, hex value minus the # sign, defult is 5ca0b5 158 }, _options || {}); 159 160 if ((Browser.Engine.gecko) && (Browser.Engine.version<19)) { // Fixes Firefox 2 and Camino 1.6 incompatibility with opacity + flash 161 foxfix = true; 162 options.overlayOpacity = 1; 163 overlay.className = 'mbOverlayFF'; 164 } 165/* 166 if ((Browser.Engine.gecko)) { // Fixes Firefox 2 and Camino 1.6 incompatibility with opacity + flash 167 foxfix = true; 168 overlay.setStyle("position", "absolute"); 169 if ((Browser.Engine.version<19)) { 170 options.overlayOpacity = 1; 171 overlay.className = 'mbOverlayFF'; 172 } 173 } 174*/ 175 176 if (typeof _images == "string") { // The function is called for a single image, with URL and Title as first two arguments 177 _images = [[_images,startImage,_options]]; 178 startImage = 0; 179 } 180 181 images = _images; 182 options.loop = options.loop && (images.length > 1); 183 184 if( embed ) 185 {
186 options.autoplay = 'false'; 187 options.autoplayNum = '0'; 188 options.autoplayYes = 'no'; 189 options.autoplayHTML5 = null; 190 191 options.overlayOpacity = 0; 192 193 closeLink.style.display = 'none'; 194 } 195 196 if ((Browser.Engine.trident) && (Browser.Engine.version<5)) { // Fixes IE 6 and earlier incompatibilities with CSS position: fixed; 197 iefix = true; 198 overlay.className = 'mbOverlayIE'; 199 overlay.setStyle("position", "absolute"); 200 position(); 201 } 202 size(); 203 setup(true); 204 top = window.getScrollTop() + (window.getHeight()/2); 205 left = window.getScrollLeft() + (window.getWidth()/2); 206 fx.resize = new Fx.Morph(center, $extend({duration: options.resizeDuration, onComplete: imageAnimate}, options.resizeTransition ? {transition: options.resizeTransition} : {})); 207 center.setStyles({top: top, left: left, width: options.initialWidth, height: options.initialHeight, marginTop: -(options.initialHeight/2 + options.padding), marginLeft: -(options.initialWidth/2 + options.padding), display: ""}); 208 fx.overlay.start(options.overlayOpacity); 209 return changeImage(startImage); 210 } 211 }; 212 213 Element.implement({ 214 mediabox: function(_options, linkMapper) { 215 $$(this).mediabox(_options, linkMapper); // The processing of a single element is similar to the processing of a collection with a single element 216 217 return this; 218 } 219 }); 220 221 Elements.implement({ 222 /* 223 options: Optional options object, see Mediabox.open() 224 linkMapper: Optional function taking a link DOM element and an index as arguments and returning an array containing 3 elements: 225 the image URL and the image caption (may contain HTML) 226 linksFilter: Optional function taking a link DOM element and an index as arguments and returning true if the element is part of 227 the image collection that will be shown on click, false if not. "this" refers to the element that was clicked. 228 This function must always return true when the DOM element argument is "this". 229 */ 230 mediabox: function(_options, linkMapper, linksFilter) { 231 linkMapper = linkMapper || function(el) { 232 elrel = el.rel.split(/[\[\]]/); 233 elrel = elrel[1]; 234 return [el.href, el.title, elrel]; 235 }; 236 237 linksFilter = linksFilter || function() { 238 return true; 239 }; 240 241 var links = this; 242 243 links.removeEvents("click").addEvent("click", function() { 244 // Build the list of images that will be displayed 245 var filteredArray = links.filter(linksFilter, this); 246 var filteredLinks = []; 247 var filteredHrefs = []; 248 249 filteredArray.each(function(item, index){ 250 if(filteredHrefs.indexOf(item.toString()) < 0) { 251 filteredLinks.include(filteredArray[index]); 252 filteredHrefs.include(filteredArray[index].toString()); 253 }; 254 }); 255 256 return Mediabox.open(filteredLinks.map(linkMapper), filteredHrefs.indexOf(this.toString()), _options); 257 }); 258 259 return links; 260 } 261 }); 262 263 /* 264 Internal functions 265 */ 266 267 function position() { 268 overlay.setStyles({top: window.getScrollTop(), left: window.getScrollLeft()}); 269 } 270 271 function size() { 272 overlay.setStyles({width: window.getWidth(), height: window.getHeight()}); 273 } 274 275 function setup(open) { 276 // Hides on-page objects and embeds while the overlay is open, nessesary to counteract Firefox stupidity 277 ["object", window.ie ? "select" : "embed"].forEach(function(tag) { 278 Array.forEach(document.getElementsByTagName(tag), function(el) { 279 if (open) el._mediabox = el.style.visibility; 280 el.style.visibility = open ? "hidden" : el._mediabox; 281 }); 282 }); 283 284 overlay.style.display = open ? "" : "none"; 285 286 var fn = open ? "addEvent" : "removeEvent";
287 if (iefix) window[fn]("scroll", position); 288 window[fn]("resize", size); 289 document[fn]("keydown", keyDown); 290 } 291 292 function keyDown(event) { 293 switch(event.code) { 294 case 27: // Esc 295 case 88: // 'x' 296 case 67: // 'c' 297 close(); 298 break; 299 case 37: // Left arrow 300 case 80: // 'p' 301 previous(); 302 break; 303 case 39: // Right arrow 304 case 78: // 'n' 305 next(); 306 break; 307 case 68: // 'd' 308 downloadKey(); 309 break; 310 } 311 if (options.stopKey) { return false; }; 312 } 313 314 function previous() { 315 return changeImage(prevImage); 316 } 317 318 function next() { 319 return changeImage(nextImage); 320 } 321 322 function downloadClick() { 323 location.href = URL; 324 } 325 326 function downloadKey() { 327 this.location.href = URL; 328 } 329 330 function homepageClick() { 331 location.href = "//www.hd-trailers.net/"; 332 } 333 334 function changeImage(imageIndex) { 335 if (imageIndex >= 0) { 336 image.set('html', ''); 337 activeImage = imageIndex; 338 prevImage = ((activeImage || !options.loop) ? activeImage : images.length) - 1; 339 nextImage = activeImage + 1; 340 if (nextImage == images.length) nextImage = options.loop ? 0 : -1; 341 stop(); 342 center.className = "mbLoading"; 343 344// MEDIABOX FORMATING 345 WH = images[imageIndex][2].split(' '); 346 WHL = WH.length; 347 if (WHL>1) { 348 var tmpWidth = WH[WHL-2]; 349 var tmpHeight = WH[WHL-1]; 350 351 changedDims = false; 352 353 if( tmpWidth.match("%") ) 354 { 355 tmpWidth = window.getWidth()*("0."+(tmpWidth.replace("%", ""))); 356 } 357 358 if( tmpHeight.match("%") ) 359 { 360 tmpHeight = window.getHeight()*("0."+(tmpHeight.replace("%", ""))); 361 } 362 363 tmpWidth = parseInt( tmpWidth ); 364 tmpHeight = parseInt( tmpHeight ); 365 366 var maxWidth = Math.max( 64, window.innerWidth - 50 ); 367 var maxHeight = Math.max( 36, window.innerHeight - 60 ); 368 369 if( tmpWidth > maxWidth ) 370 { 371 tmpHeight = Math.floor( tmpHeight * maxWidth / tmpWidth ); 372 tmpWidth = maxWidth; 373 changedDims = true; 374 } 375 376 if( tmpHeight > maxHeight ) 377 { 378 tmpWidth = Math.floor( tmpWidth * maxHeight/ tmpHeight ); 379 tmpHeight = maxHeight; 380 changedDims = true; 381 } 382 383 mediaWidth = tmpWidth+"px"; 384 mediaHeight = tmpHeight+"px"; 385 qtHeight = ( tmpHeight + 14 )+"px"; 386 } else { 387 mediaWidth = ""; 388 mediaHeight = ""; 389 } 390 URL = images[imageIndex][0]; 391 captionSplit = images[activeImage][1].split('::'); 392 393 downloadLink.href = URL; 394 395 changeImageForUrl( URL ); 396 } 397 398 return false; 399 } 400 401 function changeImageForUrl( url ) 402 { 403 if( url ) 404 { 405 URL = url; 406
407// Quietube and yFrog support 408 if (URL.match(/quietube\.com/i)) { 409 mediaSplit = URL.split('v.php/'); 410 URL = mediaSplit[1]; 411 } else if (URL.match(/\/\/yfrog/i)) { 412 mediaType = (URL.substring(URL.length-1)); 413 if (mediaType.match(/b|g|j|p|t/i)) mediaType = 'image'; 414 if (mediaType == 's') mediaType = 'flash'; 415 if (mediaType.match(/f|z/i)) mediaType = 'video'; 416 URL = URL+":iphone"; 417 } 418 419// MEDIA TYPES 420// IMAGES 421 if (URL.match(/\.gif|\.jpg|\.png|twitpic\.com/i) || mediaType == 'image') { 422 mediaType = 'img'; 423 URL = URL.replace(/twitpic\.com/i, "twitpic.com/show/full"); 424 preload = new Image(); 425 preload.onload = startEffect; 426 preload.src = URL; 427 428// FLV, F4V 429 } else if (URL.match(/\.flv|\.f4v/i) || mediaType == 'video') { 430 mediaType = 'obj'; 431 mediaWidth = mediaWidth || options.defaultWidth; 432 mediaHeight = mediaHeight || options.defaultHeight; 433 if (options.useNB) 434 { 435 preload = new Swiff(''+options.NBpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer='+options.buffer+'&showTimecode='+options.showTimecode+'&loop='+options.NBloop+'&controlColour='+options.controllerColor+'&scaleIfFullScreen=true&showScalingButton=true', { 436 id: 'MediaboxSWF', 437 width: mediaWidth, 438 height: mediaHeight, 439 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 440 }); 441 } 442 else 443 { 444 preload = new Swiff(''+options.playerpath+'?file='+URL+'&type=video&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay+'&controlbar='+options.controlbar+'&bufferlength='+options.buffer+'&icons='+options.icons, { 445 id: 'MediaboxSWF', 446 width: mediaWidth, 447 height: mediaHeight, 448 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 449 }); 450 } 451 startEffect(); 452// MP4, M4V, MOV, DLL 453 } else if (URL.match(/\.mp4|\.m4v|\.mov|\.dll/i) || mediaType == 'video') { 454 mediaType = 'obj'; 455 mediaWidth = mediaWidth || options.defaultWidth; 456 mediaHeight = mediaHeight || options.defaultHeight; 457 458 URL = URL.replace( /\=/g, "%3D" ); 459 URL = URL.replace( /\?/g, "%3F" ); 460 URL = URL.replace( /\&/g, "%26" ); 461 462 var can_play_type = document.createElement('video').canPlayType('video/mp4'); 463 var browser_supports_mp4 = can_play_type == 'probably' || can_play_type == 'maybe'; 464 465 var is_ie = navigator.userAgent.match( /msie/i ) || navigator.userAgent.match( /trident/i ); 466 var is_webkit = navigator.userAgent.match( /webkit/i ); 467 var is_mov = URL.match( /[.]mov$/i ); 468 469 if ( getQuicktimeVersion() > 5 && 470 ( ( is_mov && !is_webkit ) || // only webkit can play movs fine w/o quicktime 471 ( !browser_supports_mp4 && 472 Browser.Plugins.Flash.version < 8 ) ) ) 473 { 474 if( navigator.userAgent.match( /Chrome/i ) ) 475 { 476 hide('previewControlPanel'); 477 hide('facebookComments'); 478 hide('header-win'); 479 hide('previewLeft-win'); 480 hide('previewRight-win'); 481 } 482 483 var embedUrl = URL; 484 var is_quicktime = navigator.userAgent.match( /^quicktime/i ); 485 var fix_apple_url = !is_quicktime && ( URL.match( /http:\/\/movies.apple.com/i ) || URL.match( /http:\/\/(movie)?trailers.apple.com/i ) ); 486 if( fix_apple_url ) 487 { 488 embedUrl = embedUrl.replace( "_h480p", "_480p" ); 489 embedUrl = embedUrl.replace( "_h720p", "_720p" ); 490 embedUrl = embedUrl.replace( "_h1080p", "_1080p" ); 491 } 492 493 mediaType = "inline"; 494 if( changedDims ) 495 { 496 preload = '<object width="'+mediaWidth+'" height="'+mediaHeight+'" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"><param name="src" value="'+embedUrl+'" /><param name="qtsrc" value="'+URL+'" /><param name="autoplay" value="'+options.autoplay+'" /><param name="controller" value="'+options.controller+'" />
496<param name="bgcolor" value="000000" /><param name="scale" value="aspect" /><embed src="'+embedUrl+'" qtsrc="'+URL+'" width="'+mediaWidth+'" height="'+mediaHeight+'" autoplay="'+options.autoplay+'" controller="'+options.controller+'" bgcolor="000000" scale="aspect" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>'; 497 } 498 else 499 { 500 mediaHeight = qtHeight; 501 preload = '<object width="'+mediaWidth+'" height="'+mediaHeight+'" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"><param name="src" value="'+embedUrl+'" /><param name="qtsrc" value="'+URL+'" /><param name="autoplay" value="'+options.autoplay+'" /><param name="controller" value="'+options.controller+'" /><param name="bgcolor" value="000000" /><embed src="'+embedUrl+'" qtsrc="'+URL+'" width="'+mediaWidth+'" height="'+mediaHeight+'" autoplay="'+options.autoplay+'" controller="'+options.controller+'" bgcolor="000000" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>'; 502 } 503 } 504 else if( browser_supports_mp4 && !is_ie ) 505 { 506 mediaType = "video-js"; 507 preload = new Element("video", {id: "video-js", class: "video-js", width: mediaWidth, height: mediaHeight, controls: "controls", preload: "auto", autoplay: options.autoplayHTML5 }); 508 var source = new Element("source", {src: URL, type: "video/mp4"}); 509 var fallback = new Swiff(''+options.playerpath+'?file='+URL+'&type=video&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay+'&controlbar='+options.controlbar+'&bufferlength='+options.buffer+'&icons='+options.icons, { 510 id: 'MediaboxSWF', 511 width: mediaWidth, 512 height: mediaHeight, 513 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 514 }); 515 source.addClass( 'test' ); 516 source.inject(preload); 517 fallback.inject(preload); 518 } 519 else if (options.useNB) 520 { 521 preload = new Swiff(''+options.NBpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer='+options.buffer+'&showTimecode='+options.showTimecode+'&loop='+options.NBloop+'&controlColour='+options.controllerColor+'&scaleIfFullScreen=true&showScalingButton=true', { 522 id: 'MediaboxSWF', 523 width: mediaWidth, 524 height: mediaHeight, 525 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 526 }); 527 } 528 else 529 { 530 preload = new Swiff(''+options.playerpath+'?file='+URL+'&type=video&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay+'&controlbar='+options.controlbar+'&bufferlength='+options.buffer+'&icons='+options.icons, { 531 id: 'MediaboxSWF', 532 width: mediaWidth, 533 height: mediaHeight, 534 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 535 }); 536 } 537 startEffect(); 538// MP3, AAC 539 } else if (URL.match(/\.mp3|\.aac|tweetmic\.com|tmic\.fm/i) || mediaType == 'audio') { 540 mediaType = 'obj'; 541 mediaWidth = mediaWidth || options.defaultWidth; 542 mediaHeight = mediaHeight || "20px"; 543 if (URL.match(/tweetmic\.com|tmic\.fm/i)) { 544 URL = URL.split('/'); 545 URL[4] = URL[4] || URL[3]; 546 URL = "http://media4.fjarnet.net/tweet/tweetmicapp-"+URL[4]+'.mp3'; 547 } 548// if (options.useNB) { 549// preload = new Swiff(''+options.NBpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer='+options.buffer+'&showTimeco
549de='+options.showTimecode+'&loop='+options.NBloop+'&controlColour='+options.controllerColor+'&scaleIfFullScreen=true&showScalingButton=true', { 550// id: 'MediaboxSWF', 551// width: mediaWidth, 552// height: mediaHeight, 553// params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 554// }); 555// } else { 556 preload = new Swiff(''+options.playerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay, { 557 id: 'MediaboxSWF', 558 width: mediaWidth, 559 height: mediaHeight, 560 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 561 }); 562// } 563 startEffect(); 564// SWF 565 } else if (URL.match(/\.swf/i) || mediaType == 'flash') { 566 mediaType = 'obj'; 567 mediaWidth = mediaWidth || options.defaultWidth; 568 mediaHeight = mediaHeight || options.defaultHeight; 569 preload = new Swiff(URL, { 570 id: 'MediaboxSWF', 571 width: mediaWidth, 572 height: mediaHeight, 573 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 574 }); 575 startEffect(); 576// SOCIAL SITES 577// Blip.tv 578 } else if (URL.match(/blip\.tv/i)) { 579 mediaType = 'obj'; 580 mediaWidth = mediaWidth || "640px"; 581 mediaHeight = mediaHeight || "390px"; 582 preload = new Swiff(URL, { 583 src: URL, 584 width: mediaWidth, 585 height: mediaHeight, 586 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 587 }); 588 startEffect(); 589// Break.com 590 } else if (URL.match(/break\.com/i)) { 591 mediaType = 'obj'; 592 mediaWidth = mediaWidth || "464px"; 593 mediaHeight = mediaHeight || "376px"; 594 mediaId = URL.match(/\d{6}/g) 595 preload = new Swiff('http://embed.break.com/'+mediaId, { 596 width: mediaWidth, 597 height: mediaHeight, 598 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 599 }); 600 startEffect(); 601// DailyMotion 602 } else if (URL.match(/dailymotion\.com/i)) { 603 mediaType = 'obj'; 604 mediaWidth = mediaWidth || "480px"; 605 mediaHeight = mediaHeight || "381px"; 606 preload = new Swiff(URL, { 607 id: mediaId, 608 width: mediaWidth, 609 height: mediaHeight, 610 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 611 }); 612 startEffect(); 613// Facebook 614 } else if (URL.match(/facebook\.com/i)) { 615 mediaType = 'obj'; 616 mediaWidth = mediaWidth || "320px"; 617 mediaHeight = mediaHeight || "240px"; 618 mediaSplit = URL.split('v='); 619 mediaSplit = mediaSplit[1].split('&'); 620 mediaId = mediaSplit[0]; 621 preload = new Swiff('http://www.facebook.com/v/'+mediaId, { 622 movie: 'http://www.facebook.com/v/'+mediaId, 623 classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000', 624 width: mediaWidth, 625 height: mediaHeight, 626 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 627 }); 628 startEffect(); 629// Flickr 630 } else if (URL.match(/flickr\.com/i)) { 631 mediaType = 'obj'; 632 mediaWidth = mediaWidth || "500px"; 633 mediaHeight = mediaHeight || "375px"; 634 mediaSplit = URL.split('/'); 635 mediaId = mediaSplit[5]; 636 preload = new Swiff('http://www.flickr.com/apps/video/stewart.swf', { 637 id: mediaId, 638 classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000', 639 width: mediaWidth, 640 height: mediaHeight,
641 params: {flashvars: 'photo_id='+mediaId+'&show_info_box='+options.flInfo, wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 642 }); 643 startEffect(); 644// Fliggo 645 } else if (URL.match(/fliggo\.com/i)) { 646 mediaType = 'obj'; 647 mediaWidth = mediaWidth || "425px"; 648 mediaHeight = mediaHeight || "355px"; 649 URL = URL.replace('/video/', '/embed/'); 650 preload = new Swiff(URL, { 651 width: mediaWidth, 652 height: mediaHeight, 653 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 654 }); 655 startEffect(); 656// GameTrailers Video 657 } else if (URL.match(/gametrailers\.com/i)) { 658 mediaType = 'obj'; 659 mediaWidth = mediaWidth || "480px"; 660 mediaHeight = mediaHeight || "392px"; 661 mediaId = URL.match(/\d{5}/g) 662 preload = new Swiff('http://www.gametrailers.com/remote_wrap.php?mid='+mediaId, { 663 id: mediaId, 664 width: mediaWidth, 665 height: mediaHeight, 666 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 667 }); 668 startEffect(); 669// Google Video 670 } else if (URL.match(/google\.com\/videoplay/i)) { 671 mediaType = 'obj'; 672 mediaWidth = mediaWidth || "400px"; 673 mediaHeight = mediaHeight || "326px"; 674 mediaSplit = URL.split('='); 675 mediaId = mediaSplit[1]; 676 preload = new Swiff('http://video.google.com/googleplayer.swf?docId='+mediaId+'&autoplay='+options.autoplayNum, { 677 id: mediaId, 678 width: mediaWidth, 679 height: mediaHeight, 680 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 681 }); 682 startEffect(); 683// Justin.tv 684 } else if (URL.match(/justin\.tv/i)) { 685 mediaType = 'obj'; 686 mediaWidth = mediaWidth || "353px"; 687 mediaHeight = mediaHeight || "295px"; 688 mediaSplit = URL.split('/'); 689 mediaId = mediaSplit[3]; 690 preload = new Swiff('http://www.justin.tv/widgets/jtv_player.swf', { 691 id: 'jtv_player_flash', 692 width: mediaWidth, 693 height: mediaHeight, 694// params: {flashvars: 'channel='+mediaId+'&auto_play=true&start_volume=25', wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 695 params: {flashvars: 'channel='+mediaId, wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 696 }); 697 startEffect(); 698// Megavideo - Thanks to Robert Jandreu for suggesting this code! 699 } else if (URL.match(/megavideo\.com/i)) { 700 mediaType = 'obj'; 701 mediaWidth = mediaWidth || "640px"; 702 mediaHeight = mediaHeight || "360px"; 703 mediaSplit = URL.split('='); 704 mediaId = mediaSplit[1]; 705 preload = new Swiff('http://wwwstatic.megavideo.com/mv_player.swf?v='+mediaId, { 706 id: mediaId, 707 width: mediaWidth, 708 height: mediaHeight, 709 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 710 }); 711 startEffect(); 712// Metacafe 713 } else if (URL.match(/metacafe\.com\/watch/i)) { 714 mediaType = 'obj'; 715 mediaWidth = mediaWidth || "400px"; 716 mediaHeight = mediaHeight || "345px"; 717 mediaSplit = URL.split('/'); 718 mediaId = mediaSplit[4]; 719 preload = new Swiff('http://www.metacafe.com/fplayer/'+mediaId+'/.swf?playerVars=autoPlay='+options.autoplayYes, { 720 id: mediaId, 721 width: mediaWidth, 722 height: mediaHeight, 723 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 724 }); 725 startEffect(); 726// MyspaceTV 727 } else if (URL.match(/myspacetv\.com|vids\.myspace\.com/i)) { 728 mediaType = 'obj'; 729 mediaWidth = mediaWidth || "425px"; 730 mediaHeight = mediaHeight || "360px"; 731 mediaSplit = URL.split('='); 732 mediaId = mediaSplit[2]; 733 preload = new Swiff('http://lads.myspace.com/videos/vplayer.swf?m='+mediaId+'&v=2&a='+options.autoplayNum+'&type=video', { 734 id: mediaId, 735 width: mediaWidth, 736 height: mediaHeight, 737 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 738 }); 739 startEffect(); 740// Revver 741 } else if (URL.match(/revver\.com/i)) { 742 mediaType = 'obj'; 743 mediaWidth = mediaWidth || "480px"; 744 mediaHeight = mediaHeight || "392px"; 745 mediaSplit = URL.split('/'); 746 mediaId = mediaSplit[4]; 747 preload = new Swiff('http://flash.revver.com/player/1.0/player.swf?mediaId='
747+mediaId+'&affiliateId='+options.revverID+'&allowFullScreen='+options.revverFullscreen+'&autoStart='+options.autoplay+'&backColor=#'+options.revverBack+'&frontColor=#'+options.revverFront+'&gradColor=#'+options.revverGrad+'&shareUrl=revver', { 748 id: mediaId, 749 width: mediaWidth, 750 height: mediaHeight, 751 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 752 }); 753 startEffect(); 754// Rutube 755 } else if (URL.match(/rutube\.ru/i)) { 756 mediaType = 'obj'; 757 mediaWidth = mediaWidth || "470px"; 758 mediaHeight = mediaHeight || "353px"; 759 mediaSplit = URL.split('='); 760 mediaId = mediaSplit[1]; 761 preload = new Swiff('http://video.rutube.ru/'+mediaId, { 762 movie: 'http://video.rutube.ru/'+mediaId, 763 width: mediaWidth, 764 height: mediaHeight, 765 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 766 }); 767 startEffect(); 768// Seesmic 769 } else if (URL.match(/seesmic\.com/i)) { 770 mediaType = 'obj'; 771 mediaWidth = mediaWidth || "435px"; 772 mediaHeight = mediaHeight || "355px"; 773 mediaSplit = URL.split('/'); 774 mediaId = mediaSplit[5]; 775 preload = new Swiff('http://seesmic.com/Standalone.swf?video='+mediaId, { 776 id: mediaId, 777 width: mediaWidth, 778 height: mediaHeight, 779 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 780 }); 781 startEffect(); 782// Tudou 783 } else if (URL.match(/tudou\.com/i)) { 784 mediaType = 'obj'; 785 mediaWidth = mediaWidth || "400px"; 786 mediaHeight = mediaHeight || "340px"; 787 mediaSplit = URL.split('/'); 788 mediaId = mediaSplit[5]; 789 preload = new Swiff('http://www.tudou.com/v/'+mediaId, { 790 width: mediaWidth, 791 height: mediaHeight, 792 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 793 }); 794 startEffect(); 795// Twitvid 796 } else if (URL.match(/twitvid\.com/i)) { 797 mediaType = 'obj'; 798 mediaWidth = mediaWidth || "600px"; 799 mediaHeight = mediaHeight || "338px"; 800 mediaSplit = URL.split('/'); 801 mediaId = mediaSplit[3]; 802 preload = new Swiff('http://www.twitvid.com/player/'+mediaId, { 803 width: mediaWidth, 804 height: mediaHeight, 805 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 806 }); 807 startEffect(); 808// Twitvid.io 809 } else if (URL.match(/twitvid\.io/i)) { 810 mediaType = 'obj'; 811 mediaWidth = mediaWidth || "580px"; 812 mediaHeight = mediaHeight || "323px"; 813 mediaSplit = URL.split('/'); 814 mediaId = mediaSplit[3]; 815 preload = new Swiff('http://twitvid.io/embed/'+mediaId, { 816 width: mediaWidth, 817 height: mediaHeight, 818 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 819 }); 820 startEffect(); 821// Ustream.tv 822 } else if (URL.match(/ustream\.tv/i)) { 823 mediaType = 'obj'; 824 mediaWidth = mediaWidth || "400px"; 825 mediaHeight = mediaHeight || "326px"; 826 preload = new Swiff(URL+'&viewcount='+options.usViewers+'&autoplay='+options.autoplay, { 827 width: mediaWidth, 828 height: mediaHeight, 829 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 830 }); 831 startEffect(); 832// YouKu 833 } else if (URL.match(/youku\.com/i)) { 834 mediaType = 'obj'; 835 mediaWidth = mediaWidth || "480px"; 836 mediaHeight = mediaHeight || "400px"; 837 mediaSplit = URL.split('id_'); 838 mediaId = mediaSplit[1]; 839 preload = new Swiff('http://player.youku.com/player.php/sid/'+mediaId+'=/v.swf', { 840 width: mediaWidth, 841 height: mediaHeight, 842 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 843 }); 844 startEffect(); 845// YouTube 846 } else if (URL.match(/youtube\.com\/watch/i)) { 847 mediaType = 'url'; 848 mediaWidth = mediaWidth || options.defaultWidth; 849 mediaHeight = mediaHeight || options.defaultHeight; 850 mediaSplit = URL.split('v='); 851 mediaSplit = mediaSplit[1].split('&'); 852 mediaId = mediaSplit[0]; 853 embedURL = 'https://www.youtube.com/embed/' + mediaId + '?autoplay=' + options.autoplayNum; 854 preload = new Element('iframe', { 855 'src': embedURL, 856 'id': mediaId, 857 'width': mediaWidth, 858 'height': mediaHeight, 859 'frameborder': 0 860 }); 861 startEffect(); 862 URL = "http://www.clipconverter.cc/?ref=hd-trailers.net&url=" + encodeURIComponent( URL ); 863 downloadLink.href = URL; 864/* 865 mediaType = 'obj'; 866 mediaSplit = URL.split('v='); 867 mediaId = mediaSplit[1]; 868 if (mediaId.match(/fmt=18/i)) { 869 mediaFmt = '&ap=%2526fmt%3D18'; 870 mediaWidth = mediaWidth || "560px"; 871 mediaHeight = mediaHeight || "345px"; 872 } else if (mediaId.match(/fmt=22/i)) { 873 mediaFmt = '&ap=%2526fmt%3D22'; 874 mediaWidth = mediaWidth || "640px"; 875 mediaHeight = mediaHeight || "385px"; 876 } else { 877 mediaFmt = options.ytQuality; 878 mediaWidth = mediaWidth || "480px"; 879 mediaHeight = mediaHeight || "295px"; 880 } 881 preload = new Swiff('https://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, { 882 id: mediaId, 883 width: mediaWidth, 884 height: mediaHeight, 885 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 886 }); 887 startEffect(); 888*/ 889// YouTube 890 } else if (URL.match(/youtube\.com\/view/i)) { 891 mediaType = 'obj'; 892 mediaSplit = URL.split('p='); 893 mediaId = mediaSplit[1]; 894 mediaWidth = mediaWidth || "480px"; 895 mediaHeight = mediaHeight || "385px"; 896 preload = new Swiff('https://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, { 897 id: mediaId, 898 width: mediaWidth, 899 height: mediaHeight, 900 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 901 }); 902 startEffect(); 903// Veoh 904 } else if (URL.match(/veoh\.com/i)) { 905 mediaType = 'obj'; 906 mediaWidth = mediaWidth || "410px"; 907 mediaHeight = mediaHeight || "341px"; 908 mediaSplit = URL.split('videos/'); 909 mediaId = mediaSplit[1]; 910 preload = new Swiff('http://www.veoh.com/videodetail
910s2.swf?permalinkId='+mediaId+'&player=videodetailsembedded&videoAutoPlay='+options.AutoplayNum, { 911 id: mediaId, 912 width: mediaWidth, 913 height: mediaHeight, 914 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 915 }); 916 startEffect(); 917// Viddler 918 } else if (URL.match(/viddler\.com/i)) { 919 mediaType = 'obj'; 920 mediaWidth = mediaWidth || "437px"; 921 mediaHeight = mediaHeight || "370px"; 922 mediaSplit = URL.split('/'); 923 mediaId = mediaSplit[4]; 924 preload = new Swiff(URL, { 925 id: 'viddler_'+mediaId, 926 movie: URL, 927 classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000', 928 width: mediaWidth, 929 height: mediaHeight, 930 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen, id: 'viddler_'+mediaId, movie: URL} 931 }); 932 startEffect(); 933// Viddyou 934 } else if (URL.match(/viddyou\.com/i)) { 935 mediaType = 'obj'; 936 mediaWidth = mediaWidth || "416px"; 937 mediaHeight = mediaHeight || "312px"; 938 mediaSplit = URL.split('='); 939 mediaId = mediaSplit[1]; 940 preload = new Swiff('http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf', { 941 id: mediaId, 942 movie: 'http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf', 943 width: mediaWidth, 944 height: mediaHeight, 945 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 946 }); 947 startEffect(); 948// Vimeo 949 } else if (URL.match(/vimeo\.com/i)) { 950 mediaType = 'obj'; 951 mediaWidth = mediaWidth || "640px"; // site defualt: 400px 952 mediaHeight = mediaHeight || "360px"; // site defualt: 225px 953 mediaSplit = URL.split('/'); 954 mediaId = mediaSplit[3]; 955 preload = new Swiff('http://www.vimeo.com/moogaloop.swf?clip_id='+mediaId+'&server=www.vimeo.com&fullscreen='+options.fullscreenNum+'&autoplay='+options.autoplayNum+'&show_title='+options.vmTitle+'&show_byline='+options.vmByline+'&show_portrait='+options.vmPortrait+'&color='+options.vmColor, { 956 id: mediaId, 957 width: mediaWidth, 958 height: mediaHeight, 959 params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 960 }); 961 startEffect(); 962// 12seconds 963 } else if (URL.match(/12seconds\.tv/i)) { 964 mediaType = 'obj'; 965 mediaWidth = mediaWidth || "430px"; 966 mediaHeight = mediaHeight || "360px"; 967 mediaSplit = URL.split('/'); 968 mediaId = mediaSplit[5]; 969 preload = new Swiff('http://embed.12seconds.tv/players/remotePlayer.swf', { 970 id: mediaId, 971 width: mediaWidth, 972 height: mediaHeight, 973 params: {flashvars: 'vid='+mediaId+'', wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen} 974 }); 975 startEffect(); 976// CONTENT TYPES 977// INLINE 978 } else if (URL.match(/\#mb_/i)) { 979 mediaType = 'inline'; 980 mediaWidth = mediaWidth || options.defaultWidth; 981 mediaHeight = mediaHeight || options.defaultHeight; 982 URLsplit = URL.split('#'); 983 preload = $(URLsplit[1]).get('html'); 984 startEffect(); 985// HTML 986 } else { 987 mediaType = 'url'; 988 mediaWidth = mediaWidth || options.defaultWidth; 989 mediaHeight = mediaHeight || options.defaultHeight; 990 mediaId = "mediaId_"+new Date().getTime(); // Safari will not update iframe content with a static id. 991 992 if( match = URL.match(/yahoo-redir\.php\?(.*)$/i) ) { 993 downloadLink.href = URL; 994 URL = "https://secure.hd-trailers.net/embed/yahoo-player.php?" + match[1]; 995 } else { 996 downloadLink.style.display = "none"; 997 } 998 999 preload = new Element('iframe', { 1000 'src': URL, 1001 'id': mediaId, 1002 'width': mediaWidth, 1003 'height': mediaHeight, 1004// 'allowtransparency': 'true', 1005 'frameborder': 0 1006 }); 1007 1008 startEffect(); 1009 } 1010 } 1011 return false;
1012 } 1013 1014 function startEffect() { 1015 if (mediaType == "img"){ 1016 mediaWidth = preload.width; 1017 mediaHeight = preload.height; 1018 image.setStyles({backgroundImage: "url("+URL+")", display: ""}); 1019 } else if (mediaType == "obj") { 1020 if (Browser.Plugins.Flash.version<8) { 1021 image.setStyles({backgroundImage: "none", display: ""}); 1022 image.set('html', '<div id="mbError"><h1>Aww, Crap!</h1><p>This video requires the latest version of <a href="http://get.adobe.com/flashplayer/">Adobe Flash Player</a>.</p></div>'); 1023 mediaWidth = options.defaultWidth; 1024 mediaHeight = options.defaultHeight; 1025 } else { 1026 image.setStyles({backgroundImage: "none", display: ""}); 1027 preload.inject(image); 1028 } 1029 } else if (mediaType == "inline") { 1030 image.setStyles({backgroundImage: "none", display: ""}); 1031 image.set('html', preload); 1032 } else if (mediaType == "video-js") { 1033 image.setStyles({backgroundImage: "none", display: ""}); 1034 preload.inject(image); 1035 1036 var errorMsgHeight = mediaHeight.substring(0, mediaHeight.length - 2) - 80; 1037 var not_supported = new Element("div", {id: "mbError", class: "vjs-no-video", style: "height:"+errorMsgHeight+"px;"}); 1038 not_supported.set("html", '<h1>Aww, Crap!</h1><p>This video requires a HTML5 capable browser that can play MP4 videos (e.g. <a href="http://www.google.com/chrome">Chrome</a> or <a href="http://www.apple.com/safari/">Safari</a> ) or the latest version of <a href="http://get.adobe.com/flashplayer/">Adobe Flash Player</a>.</p>'); 1039 not_supported.inject(image); 1040 1041 $('MediaboxSWF').addClass('vjs-flash-fallback'); 1042 VideoJS.setupAllWhenReady(); 1043 } else if (mediaType == "url") { 1044 image.setStyles({backgroundImage: "none", display: ""}); 1045 preload.inject(image); 1046 } else { 1047 image.setStyles({backgroundImage: "none", display: ""}); 1048 image.set('html', '<div id="mbError"><h1>Aww, Crap!</h1><p>The file you’re trying to open isn’t supported.</p></div>'); 1049 mediaWidth = options.defaultWidth; 1050 mediaHeight = options.defaultHeight; 1051// alert('this file type is not supported\n'+URL+'\nplease visit iaian7.com/webcode/mediaboxAdvanced for more information'); 1052 } 1053 image.setStyles({width: mediaWidth, height: mediaHeight}); 1054 1055 title.set('html', (options.showCaption) ? captionSplit[0] : ""); 1056 caption.set('html', (options.showCaption && (captionSplit.length > 1)) ? captionSplit[1] : ""); 1057 number.set('html', (options.showCounter && (images.length > 1)) ? options.counterText.replace(/{x}/, activeImage + 1).replace(/{y}/, images.length) : ""); 1058 1059 if ((prevImage >= 0) && (images[prevImage][0].match(/\.gif|\.jpg|\.png|twitpic\.com/i))) preloadPrev.src = images[prevImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full"); 1060 if ((nextImage >= 0) && (images[nextImage][0].match(/\.gif|\.jpg|\.png|twitpic\.com/i))) preloadNext.src = images[nextImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full"); 1061 1062 mediaWidth = image.offsetWidth; 1063 mediaHeight = image.offsetHeight+bottom.offsetHeight; 1064 if (options.resizeOpening) { fx.resize.start({width: mediaWidth, height: mediaHeight, marginTop: -(mediaHeight/2 + options.padding), marginLeft: -(mediaWidth/2 + options.padding)}); 1065 } else { center.setStyles({width: mediaWidth, height: mediaHeight, marginTop: -(mediaHeight/2 + options.padding), marginLeft: -(mediaWidth/2 + options.padding)}); imageAnimate(); } 1066 } 1067 1068 function imageAnimate() { 1069 fx.image.start(1); 1070 } 1071 1072 function captionAnimate() { 1073 center.className = ""; 1074 if (prevImage >= 0) prevLink.style.display = ""; 1075 if (nextImage >= 0) nextLink.style.display = ""; 1076 fx.bottom.start(1); 1077 } 1078 1079 function stop() { 1080 if (preload) preload.onload = $empty; 1081 fx.resize.cancel(); 1082 fx.image.cancel().set(0); 1083 fx.bottom.cancel().set(0); 1084 $$(prevLink, nextLink).setStyle("display", "none"); 1085 } 1086 1087 function close() { 1088 if( !embed ) 1089 { 1090 if (activeImage >= 0) { 1091 preload.onload = $empty; 1092 image.set('html', ''); 1093 for (var f in fx) fx[f].cancel(); 1094 center.setStyle("display", "none"); 1095 fx.overlay.chain(setup).start(0); 1096 } 1097 1098 if( navigator.userAgent.match( /Chrome/i ) ) 1099 { 1100 show('previewControlPanel'); 1101 show('facebookComments'); 1102 show('header-win'); 1103 show('previewLeft-win'); 1104 show('previewRight-win'); 1105 } 1106 } 1107 return false;
1108 } 1109 1110 function show(id) 1111 { 1112 var element = document.getElementById(id); 1113 if(null != element) { element.style.display = 'block'; } 1114 } 1115 1116 function hide(id) 1117 { 1118 var element = document.getElementById(id); 1119 if(null != element) { element.style.display = 'none'; } 1120 } 1121 1122})(); 1123 1124// AUTOLOAD CODE BLOCK 1125Mediabox.scanPage = function() { 1126// $$('#mb_').each(function(hide) { hide.set('display', 'none'); }); 1127 var links = $$("a").filter(function(el) { 1128 return el.rel && el.rel.test(/^lightbox/i); 1129 }); 1130 $$(links).mediabox({/* Put custom options here */}, null, function(el) { 1131 var rel0 = this.rel.replace(/[[]|]/gi," "); 1132 var relsize = rel0.split(" "); 1133 return (this == el) || ((this.rel.length > 8) && el.rel.match(relsize[1])); 1134 }); 1135}; 1136window.addEvent("domready", Mediabox.scanPage);
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.