1var Videobox = { 2 3 init: function (options) { 4 // init default options 5 this.options = Object.extend({ 6 resizeDuration: 400, // Duration of height and width resizing (ms) 7 initialWidth: 250, // Initial width of the box (px) 8 initialHeight: 250, // Initial height of the box (px) 9 defaultWidth: 425, // Default width of the box (px) 10 defaultHeight: 350, // Default height of the box (px) 11 animateCaption: true, // Enable/Disable caption animation 12 flvplayer: 'swf/flvplayer.swf' 13 }, options || {}); 14 15 this.anchors = []; 16 $A($$('a')).each(function(el){ 17 if(el.rel && el.href && el.rel.test('^vidbox', 'i')) { 18 el.addEvent('click', function (e) { 19 e = new Event(e); 20 e.stop(); 21 this.click(el); 22 }.bind(this)); 23 this.anchors.push(el); 24 } 25 }, this); 26 27 this.overlay = new Element('div').setProperty('id', 'lbOverlay').injectInside(document.body); 28 this.center = new Element('div').setProperty('id', 'lbCenter').setStyles({width: this.options.initialWidth+'px', height: this.options.initialHeight+'px', marginLeft: '-'+(this.options.initialWidth/2)+'px', display: 'none'}).injectInside(document.body); 29 30 this.bottomContainer = new Element('div').setProperty('id', 'lbBottomContainer').setStyle('display', 'none').injectInside(document.body); 31 this.bottom = new Element('div').setProperty('id', 'lbBottom').injectInside(this.bottomContainer); 32 new Element('a').setProperties({id: 'lbCloseLink', href: '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this); 33 this.caption = new Element('div').setProperty('id', 'lbCaption').injectInside(this.bottom); 34 this.number = new Element('div').setProperty('id', 'lbNumber').injectInside(this.bottom); 35 new Element('div').setStyle('clear', 'both').injectInside(this.bottom); 36 37 var nextEffect = this.nextEffect.bind(this); 38 this.fx = { 39 overlay: this.overlay.effect('opacity', {duration: 500}).hide(), 40 center: this.center.effects({duration: 500, transition: Fx.Transitions.sineInOut, onComplete: nextEffect}), 41 bottom: this.bottom.effect('margin-top', {duration: 400}) 42 }; 43 44 }, 45 46 click: function(link) { 47 48 return this.open (link.href, link.title, link.rel); 49 50 }, 51 open: function(sLinkHref, sLinkTitle, sLinkRel) { 52 this.href = sLinkHref; 53 this.title = sLinkTitle; 54 this.rel = sLinkRel; 55 this.position(); 56 this.setup(); 57 this.video(this.href); 58 this.top = Window.getScrollTop() + (Window.getHeight() / 15); 59 this.center.setStyles({top: this.top+'px', display: ''}); 60 this.fx.overlay.start(0.8); 61 this.step = 1; 62 this.center.setStyle('background','#fff url(loading.gif) no-repeat center'); 63 this.caption.innerHTML = this.title; 64 this.fx.center.start({'height': [this.options.contentsHeight]}); 65 }, 66 67 setup: function(){ 68 var aDim = this.rel.match(/[0-9]+/g); 69 this.options.contentsWidth = (aDim && (aDim[0] > 0)) ? aDim[0] : this.options.defaultWidth; 70 this.options.contentsHeight = (aDim && (aDim[1] > 0)) ? aDim[1] : this.options.defaultHeight; 71 72 }, 73 74 position: function(){ 75 this.overlay.setStyles({'top': window.getScrollTop()+'px', 'height': window.getHeight()+'px'}); 76 }, 77 78 video: function(sLinkHref){ 79 if (sLinkHref.match(/youtube\.com\/watch/i)) { 80 this.flash = true; 81 var hRef = sLinkHref; 82 var videoId = hRef.split('v='); 83 this.videoID = videoId[1]; 84 this.so = new SWFObject("http://www.youtube.com/v/"+this.videoID, "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0"); 85 this.so.addParam("wmode", "transparent"); 86 } 87 else if (sLinkHref.match(/metacafe\.com\/watch/i)) { 88 this.flash = true; 89 var hRef = sLinkHref; 90 var videoId = hRef.split('/'); 91 this.videoID = videoId[4]; 92 this.so = new SWFObject("http://www.metacafe.com/fplayer/"+this.videoID+"/.swf", "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0"); 93 this.so.addParam("wmode", "transparent"); 94 } 95 else if (sLinkHref.match(/google\.com\/videoplay/i)) { 96 this.flash = true; 97 var hRef = sLinkHref; 98 var videoId = hRef.split('='); 99 this.videoID = videoId[1]; 100 this.so = new SWFObject("http://video.google.com/googleplayer.swf?docId="+this.videoID+"&hl=en", "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0"); 101 this.so.addParam("wmode", "transparent"); 102 } 103 else if (sLinkHref.match(/ifilm\.com\/video/i)) { 104 this.flash = true; 105 var hRef = sLinkHref; 106 var videoId = hRef.split('video/'); 107 this.videoID = videoId[1]; 108 this.so = new SWFObject("http://www.ifilm.com/efp", "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0", "#000"); 109 this.so.addVariable("flvbaseclip", this.videoID+"&"); 110 this.so.addParam("wmode", "transparent"); 111 } 112 else if (sLinkHref.match(/\.mov/i)) { 113 this.flash = false;
114 if (navigator.plugins && navigator.plugins.length) { 115 this.other ='<object id="qtboxMovie" type="video/quicktime" codebase="http://www.apple.com/qtactivex/qtplugin.cab" data="'+sLinkHref+'" width="'+this.options.contentsWidth+'" height="'+this.options.contentsHeight+'"><param name="src" value="'+sLinkHref+'" /><param name="scale" value="aspect" /><param name="controller" value="true" /><param name="autoplay" value="true" /><param name="bgcolor" value="#000000" /><param name="enablejavascript" value="true" /></object>'; 116 } else { 117 this.other = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="'+this.options.contentsWidth+'" height="'+this.options.contentsHeight+'" id="qtboxMovie"><param name="src" value="'+sLinkHref+'" /><param name="scale" value="aspect" /><param name="controller" value="true" /><param name="autoplay" value="true" /><param name="bgcolor" value="#000000" /><param name="enablejavascript" value="true" /></object>'; 118 } 119 } 120 else if (sLinkHref.match(/\.wmv/i) || sLinkHref.match(/\.asx/i)) { 121 this.flash = false; 122 this.other = '<object NAME="Player" WIDTH="'+this.options.contentsWidth+'" HEIGHT="'+this.options.contentsHeight+'" align="left" hspace="0" type="application/x-oleobject" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"><param NAME="URL" VALUE="'+sLinkHref+'"><param><param NAME="AUTOSTART" VALUE="false"></param><param name="showControls" value="true"></param><embed WIDTH="'+this.options.contentsWidth+'" HEIGHT="'+this.options.contentsHeight+'" align="left" hspace="0" SRC="'+sLinkHref+'" TYPE="application/x-oleobject" AUTOSTART="false"></embed></object>' 123 } 124 else if (sLinkHref.match(/\.flv/i)) { 125 this.flash = true; 126 this.so = new SWFObject(this.options.flvplayer+"?file="+sLinkHref, "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0", "#000"); 127 } 128 else { 129 this.flash = true; 130 this.videoID = sLinkHref; 131 this.so = new SWFObject(this.videoID, "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0"); 132 } 133 }, 134 135 nextEffect: function(){ 136 switch (this.step++){ 137 case 1: 138 this.fx.center.start({'width': [this.options.contentsWidth], 'marginLeft': [this.options.contentsWidth/-2]}); 139 break; 140 this.step++; 141 case 2: 142 this.center.setStyle('background','#fff'); 143 this.flash ? this.so.write(this.center) : this.center.setHTML(this.other) ; 144 this.bottomContainer.setStyles({top: (this.top + this.center.clientHeight)+'px', height: '0px', marginLeft: this.center.style.marginLeft, width: this.options.contentsWidth+'px',display: ''}); 145 if (this.options.animateCaption){ 146 this.fx.bottom.set(-this.bottom.offsetHeight); 147 this.bottomContainer.style.height = ''; 148 this.fx.bottom.start(0); 149 break; 150 } 151 this.bottomContainer.style.height = ''; 152 this.step++; 153 } 154 }, 155 156 close: function(){ 157 this.fx.overlay.start(0); 158 this.center.style.display = this.bottomContainer.style.display = 'none'; 159 this.center.innerHTML = ''; 160 return false; 161 } 162 163}; 164 165 166window.addEvent('domready', Videobox.init.bind(Videobox));
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.