Hi,
This code adds video support for youtube-nocookie.com, used by the U.S. Department of Education (and probably other government departments) to show YouTube videos without generating persistent cookies.
diff -u -b -B -r1.2 lightbox_video.js
--- lightbox2/js/lightbox_video.js 19 Nov 2010 19:28:57 -0000 1.2
+++ lightbox2/js/lightbox_video.js 16 Dec 2010 17:57:00 -0000
@@ -58,7 +58,9 @@
// checkKnownVideos()
checkKnownVideos: function(href) {
- if (Lightvideo.checkYouTubeVideo(href) || Lightvideo.checkGoogleVideo(href) ||
+ if (Lightvideo.checkYouTubeVideo(href) ||
+ Lightvideo.checkYouTubeNoCookieVideo(href) ||
+ Lightvideo.checkGoogleVideo(href) ||
Lightvideo.checkMySpaceVideo(href) || Lightvideo.checkLiveVideo(href) ||
Lightvideo.checkMetacafeVideo(href) ||
Lightvideo.checkIFilmSpikeVideo(href)
@@ -95,6 +97,32 @@
return false;
},
+ // checkYouTubeNoCookieVideo()
+ checkYouTubeNoCookieVideo: function(href) {
+ var patterns = [
+ 'youtube-nocookie.com/v/([^"&]+)',
+ 'youtube-nocookie.com/watch\\?v=([^"&]+)',
+ 'youtube-nocookie.com/\\?v=([^"&]+)'
+ ];
+
+ for (var i = 0; i < patterns.length; i++) {
+ var pattern = new RegExp(patterns[i], "i");
+ var results = pattern.exec(href);
+ if (results !== null) {
+ Lightbox.videoId = results[1];
+ var href = "http://www.youtube-nocookie.com/v/"+Lightbox.videoId;
+ var variables = 'fs=1';
+ if (Lightbox.flvFlashvars.length) {
+ variables = variables + '&' + Lightbox.flvFlashvars;
+ href = href + '&' + variables;
+ }
+ Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables);
+ return true;
+ }
+ }
+ return false;
+ },
+
// checkGoogleVideo()
checkGoogleVideo: function(href) {
var patterns = [
Thanks!
Joseph Cheek, Drupal Architect, U.S. Department of Education