From 5ca5208bc5bacf7206edca9c96ed27c0ddce5982 Mon Sep 17 00:00:00 2001
From: Thijs van den Anker <thijs@capitalv.nl>
Date: Fri, 27 Sep 2013 10:15:39 +0200
Subject: [PATCH] vimeo support for lightbox through iframe embed

---
 js/lightbox_video.js | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/js/lightbox_video.js b/js/lightbox_video.js
index e7aad16..dd4c98c 100644
--- a/js/lightbox_video.js
+++ b/js/lightbox_video.js
@@ -1,3 +1,4 @@
+/* $Id: lightbox_video.js,v 1.1.4.20 2010/09/21 17:57:22 snpower Exp $ */
 
 /**
  * Lightbox video
@@ -54,20 +55,44 @@ var Lightvideo = {
       '></embed>';
   },
 
+  // createIFrameEmbed()
+  createIFrameEmbed: function(href, id, color, variables) {
+    var bgcolor = 'bgcolor="' + color + '"';
+    Lightbox.modalHTML = '<iframe width="'+Lightbox.modalWidth+'" height="'+Lightbox.modalHeight+'" ' +
+      'src="' + href + '" webkitallowfullscreen mozallowfullscreen allowfullscreen frameborder="0"' +
+      '></iframe>';
+  },
+
 
   // checkKnownVideos()
   checkKnownVideos: function(href) {
     if (Lightvideo.checkYouTubeVideo(href) || Lightvideo.checkGoogleVideo(href) ||
       Lightvideo.checkMySpaceVideo(href) || Lightvideo.checkLiveVideo(href) ||
       Lightvideo.checkMetacafeVideo(href) ||
-      Lightvideo.checkIFilmSpikeVideo(href)
+      Lightvideo.checkIFilmSpikeVideo(href) || Lightvideo.checkVimeoVideo(href)
       ) {
       return true;
     }
     return false;
   },
 
+  checkVimeoVideo: function(href) {
+    var patterns = [
+      'vimeo.com/([^/]*)'
+      ];
 
+    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];
+        href = "//player.vimeo.com/video/"+Lightbox.videoId;
+        Lightvideo.createIFrameEmbed(href, "flvvideo", "#ffffff");
+        return true;
+      }
+    }
+    return false;
+  },
   // checkYouTubeVideo()
   checkYouTubeVideo: function(href) {
     var patterns = [
-- 
1.8.4

