PageSourceSearch

https://www.oulunelokuvakeskus.fi/templates/site/js/videobox.js

js oulunelokuvakeskus.fi collected 2026-10-02 04:42:43 UTC 8,003 bytes, 167 lines download raw bytes

1var Videobox = {
2
3	init: function (options) {
4		// init default options
5		this.options = Object.extend({
6			resizeDuration: 2000,	// Duration of height and width resizing (ms)
7			initialWidth: 200,		// Initial width of the box (px)
8			initialHeight: 200,		// 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: '/templates/site/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: 2000}).hide(),
40			center: this.center.effects({duration: 1700, 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() / 5);
59		this.top = 120;
60		this.center.setStyles({top: this.top+'px', display: ''});
61		this.fx.overlay.start(1);
62		this.step = 1;
63		this.center.setStyle('background','transparent url(loading.gif) no-repeat center');
64		this.caption.innerHTML = this.title;
65		this.fx.center.start({'height': [this.options.contentsHeight]});
66	},
67
68	setup: function(){
69		var aDim = this.rel.match(/[0-9]+/g);
70		this.options.contentsWidth = (aDim && (aDim[0] > 0)) ? aDim[0] : this.options.defaultWidth;
71		this.options.contentsHeight = (aDim && (aDim[1] > 0)) ? aDim[1] : this.options.defaultHeight;
72
73	},
74
75	position: function(){
76    this.overlay.setStyles({'top': window.getScrollTop()+'px', 'height': window.getHeight()+'px'});
77	},
78
79	video: function(sLinkHref){
80		if (sLinkHref.match(/youtube\.com\/watch/i)) {
81      this.flash = true;
82			var hRef = sLinkHref;
83			var videoId = hRef.split('=');
84			this.videoID = videoId[1];
85			this.so = new SWFObject("http://www.youtube.com/v/"+this.videoID, "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0");
86			this.so.addParam("wmode", "transparent");
87		}
88		else if (sLinkHref.match(/metacafe\.com\/watch/i)) {
89      this.flash = true;
90			var hRef = sLinkHref;
91			var videoId = hRef.split('/');
92			this.videoID = videoId[4];
93			this.so = new SWFObject("http://www.metacafe.com/fplayer/"+this.videoID+"/.swf", "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0");
94			this.so.addParam("wmode", "transparent");
95		}
96		else if (sLinkHref.match(/google\.com\/videoplay/i)) {
97      this.flash = true;
98			var hRef = sLinkHref;
99			var videoId = hRef.split('=');
100			this.videoID = videoId[1];
101			this.so = new SWFObject("http://video.google.com/googleplayer.swf?docId="+this.videoID+"&hl=en", "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0");
102			this.so.addParam("wmode", "transparent");
103		}
104		else if (sLinkHref.match(/ifilm\.com\/video/i)) {
105		  this.flash = true;
106			var hRef = sLinkHref;
107			var videoId = hRef.split('video/');
108			this.videoID = videoId[1];
109			this.so = new SWFObject("http://www.ifilm.com/efp", "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0", "#000");
110			this.so.addVariable("flvbaseclip", this.videoID+"&");
111			this.so.addParam("wmode", "transparent");
112		}
113		else if (sLinkHref.match(/\.mov/i)) {
114		  this.flash = false;
115			if (navigator.plugins && navigator.plugins.length) {
116          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>';
117      } else {
118        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>';
119      }
120		}
121		else if (sLinkHref.match(/\.wmv/i) || sLinkHref.match(/\.asx/i)) {
122		this.flash = false;
123		 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>'
124		}
125		else if (sLinkHref.match(/\.flv/i)) {
126		 this.flash = true;
127		 this.so = new SWFObject(this.options.flvplayer+"?file="+sLinkHref+"&autostart=true&controlbar=none&backcolor=000000", "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0", "#000");
128		}
129		else {
130		  this.flash = true;
131			this.videoID = sLinkHref;
132			this.so = new SWFObject(this.videoID, "flvvideo", this.options.contentsWidth, this.options.contentsHeight, "0");
133		}
134	},
135
136	nextEffect: function(){
137		switch (this.step++){
138		case 1:
139			this.fx.center.start({'width': [this.options.contentsWidth], 'marginLeft': [this.options.contentsWidth/-2]});
140			break;
141			this.step++;
142		case 2:
143			this.center.setStyle('background','#000');
144			this.flash ? this.so.write(this.center) : this.center.setHTML(this.other) ;
145			this.bottomContainer.setStyles({top: (this.top + this.center.clientHeight)+'px', height: '0px', marginLeft: this.center.style.marginLeft, width: this.options.contentsWidth+'px',display: ''});
146			if (this.options.animateCaption){
147				this.fx.bottom.set(-this.bottom.offsetHeight);
148				this.bottomContainer.style.height = '';
149				this.fx.bottom.start(0);
150				break;
151			}
152			this.bottomContainer.style.height = '';
153			this.step++;
154		}
155	},
156
157	close: function(){
158		this.fx.overlay.start(0);
159		this.center.style.display = this.bottomContainer.style.display = 'none';
160		this.center.innerHTML = '';
161		return false;
162	}
163
164};
165
166
167window.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.