summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleh Vehera2018-10-20 07:52:09 (GMT)
committerOleh Vehera2018-10-20 07:52:09 (GMT)
commit96d3231ba64155b6c9cce73a5425d64c1ff4dfcc (patch)
treebf69e56b1cd7baeccfec5d1721be89ecb2e83dfb
parentae296677b86d2cd8aedae8fb0f34e6b4425ec45d (diff)
Issue #318418 by lobo235, thijsvdanker, acbramley, Dracolyte, Martijn Houtman, voleger: Support for embedding Vimeo video **in LightBox2**?HEAD7.x-2.x
-rw-r--r--js/lightbox_video.js30
1 files changed, 28 insertions, 2 deletions
diff --git a/js/lightbox_video.js b/js/lightbox_video.js
index 887127c..46c9598 100644
--- a/js/lightbox_video.js
+++ b/js/lightbox_video.js
@@ -59,13 +59,21 @@ 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;
}
@@ -212,7 +220,25 @@ Lightvideo = {
}
}
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;
+ }
};