PageSourceSearch

https://oszk.hu/sites/default/modules/lightbox2/js/lightbox_video.js?X

js oszk.hu collected 2026-09-24 08:38:27 UTC 7,833 bytes, 206 lines download raw bytes

1/* $Id: lightbox_video.js,v 1.1.4.20 2010/09/21 17:57:22 snpower Exp $ */
2
3/**
4 * Lightbox video
5 * @author
6 *   Stella Power, <http://drupal.org/user/66894>
7 */
8
9var Lightvideo = {
10
11  // startVideo()
12  startVideo: function (href) {
13    if (Lightvideo.checkKnownVideos(href)) {
14      return;
15    }
16    else if (href.match(/\.mov$/i)) {
17      if (navigator.plugins && navigator.plugins.length) {
18        Lightbox.modalHTML ='<object id="qtboxMovie" type="video/quicktime" codebase="http://www.apple.com/qtactivex/qtplugin.cab" data="'+href+'" width="'+Lightbox.modalWidth+'" height="'+Lightbox.modalHeight+'"><param name="allowFullScreen" value="true"></param><param name="src" value="'+href+'" /><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>';
19      } else {
20        Lightbox.modalHTML = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="'+Lightbox.modalWidth+'" height="'+Lightbox.modalHeight+'" id="qtboxMovie"><param name="allowFullScreen" value="true"></param><param name="src" value="'+href+'" /><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>';
21      }
22    }
23    else if (href.match(/\.wmv$/i) || href.match(/\.asx$/i)) {
24      Lightbox.modalHTML = '<object NAME="Player" WIDTH="'+Lightbox.modalWidth+'" HEIGHT="'+Lightbox.modalHeight+'" align="left" hspace="0" type="application/x-oleobject" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"><param name="allowFullScreen" value="true"></param><param NAME="URL" VALUE="'+href+'"></param><param NAME="AUTOSTART" VALUE="true"></param><param name="showControls" value="true"></param><embed WIDTH="'+Lightbox.modalWidth+'" HEIGHT="'+Lightbox.modalHeight+'" align="left" hspace="0" SRC="'+href+'" TYPE="application/x-oleobject" AUTOSTART="false"></embed></object>';
25    }
26    else {
27      Lightbox.videoId = href;
28      variables = '';
29      if (!href.match(/\.swf$/i)) {
30        href = Lightbox.flvPlayer + '?file=' + href;
31        if (Lightbox.flvFlashvars.length) {
32          variables = Lightbox.flvFlashvars;
33        }
34      }
35
36      Lightvideo.createEmbed(href, "flvplayer", "#ffffff", variables);
37    }
38  },
39
40  // createEmbed()
41  createEmbed: function(href, id, color, variables) {
42    var bgcolor = 'bgcolor="' + color + '"';
43    var flashvars = '';
44    if (variables) {
45      flashvars = 'flashvars="' + variables + '"';
46
47    }
48    Lightbox.modalHTML = '<embed type="application/x-shockwave-flash" ' +
49      'src="' + href + '" ' +
50      'id="' + id + '" name="' + id + '" ' + bgcolor + ' ' +
51      'quality="high" wmode="transparent" ' + flashvars + ' ' +
52      'height="' + Lightbox.modalHeight + '" ' +
53      'width="' + Lightbox.modalWidth + '" ' +
54      'allowfullscreen="true" ' +
55      '></embed>';
56  },
57
58
59  // checkKnownVideos()
60  checkKnownVideos: function(href) {
61    if (Lightvideo.checkYouTubeVideo(href) || Lightvideo.checkGoogleVideo(href) ||
62      Lightvideo.checkMySpaceVideo(href) || Lightvideo.checkLiveVideo(href) ||
63      Lightvideo.checkMetacafeVideo(href) ||
64      Lightvideo.checkIFilmSpikeVideo(href)
65      ) {
66      return true;
67    }
68    return false;
69  },
70
71
72  // checkYouTubeVideo()
73  checkYouTubeVideo: function(href) {
74    var patterns = [
75      'youtube.com/v/([^"&]+)',
76      'youtube.com/watch\\?v=([^"&]+)',
77      'youtube.com/\\?v=([^"&]+)'
78      ];
79
80    for (var i = 0; i < patterns.length; i++) {
81      var pattern = new RegExp(patterns[i], "i");
82      var results = pattern.exec(href);
83      if (results !== null) {
84        Lightbox.videoId = results[1];
85        var href = "http://www.youtube.com/v/"+Lightbox.videoId;
86        var variables = 'fs=1';
87        if (Lightbox.flvFlashvars.length) {
88          variables = variables + '&' + Lightbox.flvFlashvars;
89          href = href + '&' + variables;
90        }
91        Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables);
92        return true;
93      }
94    }
95    return false;
96  },
97
98  // checkGoogleVideo()
99  checkGoogleVideo: function(href) {
100    var patterns = [
101      'http://video.google.[a-z]{2,4}/googleplayer.swf\\?docId=(-?\\d*)',
102      'http://video.google.[a-z]{2,4}/videoplay\\?docid=([^&]*)&',
103      'http://video.google.[a-z]{2,4}/videoplay\\?docid=(.*)'
104      ];
105
106    for (var i = 0; i < patterns.length; i++) {
107      var pattern = new RegExp(patterns[i], "i");
108      var results = pattern.exec(href);
109      if (results !== null) {
110        Lightbox.videoId = results[1];
111        var href = "http://video.google.com/googleplayer.swf?docId="+Lightbox.videoId+"&hl=en";
112        var variables = 'fs=true';
113        if (Lightbox.flvFlashvars.length) {
114          variables = variables + '&' + Lightbox.flvFlashvars;
115          href = href + '&' + variables;
116        }
117        Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables);
118        return true;
119      }
120    }
121    return false;
122  },
123
124  // checkMetacafeVideo()
125  checkMetacafeVideo: function(href) {
126    var patterns = [
127      'metacafe.com/watch/(\.[^/]*)/(\.[^/]*)/',
128      'metacafe.com/watch/(\.[^/]*)/(\.*)',
129      'metacafe.com/fplayer/(\.[^/]*)/(\.[^.]*).'
130      ];
131
132    for (var i = 0; i < patterns.length; i++) {
133      var pattern = new RegExp(patterns[i], "i");
134      var results = pattern.exec(href);
135      if (results !== null) {
136        Lightbox.videoId = results[1];
137        Lightvideo.createEmbed("http://www.metacafe.com/fplayer/"+Lightbox.videoId+"/.swf", "flvvideo", "#ffffff");
138        return true;
139      }
140    }
141    return false;
142  },
143
144  // checkIFilmSpikeVideo()
145  checkIFilmSpikeVideo: function(href) {
146    var patterns = [
147      'spike.com/video/[^/&"]*?/(\\d+)',
148      'ifilm.com/video/[^/&"]*?/(\\d+)',
149      'spike.com/video/([^/&"]*)',
150      'ifilm.com/video/([^/&"]*)'
151      ];
152
153    for (var i = 0; i < patterns.length; i++) {
154      var pattern = new RegExp(patterns[i], "i");
155      var results = pattern.exec(href);
156      if (results !== null) {
157        Lightbox.videoId = results[1];
158        Lightvideo.createEmbed("http://www.spike.com/efp", "flvvideo", "#000", "flvbaseclip="+Lightbox.videoId+"&amp;");
159        return true;
160      }
161    }
162    return false;
163  },
164
165  // checkMySpaceVideo()
166  checkMySpaceVideo: function(href) {
167    var patterns = [
168      'src="myspace.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)',
169      'myspace.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)',
170      'src="myspacetv.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)"',
171      'myspacetv.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)'
172      ];
173
174    for (var i = 0; i < patterns.length; i++) {
175      var pattern = new RegExp(patterns[i], "i");
176      var results = pattern.exec(href);
177      if (results !== null) {
178        Lightbox.videoId = results[1];
179        Lightvideo.createEmbed("http://lads.myspace.com/videos/vplayer.swf", "flvvideo", "#ffffff", "m="+Lightbox.videoId);
180        return true;
181      }
182    }
183    return false;
184  },
185
186  // checkLiveVideo()
187  checkLiveVideo: function(href) {
188    var patterns = [
189      'livevideo.com/flvplayer/embed/([^"]*)"',
190      'livevideo.com/video/[^/]*?/([^/]*)/',
191      'livevideo.com/video/([^/]*)/'
192      ];
193
194    for (var i = 0; i < patterns.length; i++) {
195      var pattern = new RegExp(patterns[i], "i");
196      var results = pattern.exec(href);
197      if (results !== null) {
198        Lightbox.videoId = results[1];
199        Lightvideo.createEmbed("http://www.livevideo.com/flvplayer/embed/"+Lightbox.videoId, "flvvideo", "#ffffff");
200        return true;
201      }
202    }
203    return false;
204  }
205
206};

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.