Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item13035: custom renderer for youtube videos
- Loading branch information
1 parent
10eafdf
commit 270e3d6
Showing
11 changed files
with
131 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FOSWIKI_ROOT?=~/foswiki/core | ||
TARGET=youtube.js youtube.css | ||
|
||
-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include | ||
|
||
clean: | ||
rm -f $(TARGET) *.gz |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.oEmbedYouTube { | ||
position:relative; | ||
display:inline-block; | ||
border:1px solid #eee; | ||
overflow:hidden; | ||
box-shadow:2px 1px 10px rgba(153, 153, 153, 0.5); | ||
-webkit-border-radius: 5px; | ||
-moz-border-radius: 5px; | ||
border-radius: 5px; | ||
} | ||
.oEmbedYouTube iframe, | ||
.oEmbedYouTube img { | ||
vertical-align:middle; | ||
} | ||
.oEmbedYouTube:after { | ||
position:absolute; | ||
top:50%; | ||
left:50%; | ||
width:54px; | ||
height:38px; | ||
display:block; | ||
margin:-19px 0 0 -27px; | ||
background-image:url(play.png); | ||
background-size:cover; | ||
content:""; | ||
} | ||
.oEmbedYouTube:hover:after { | ||
background-image:url(play-hover.png); | ||
} | ||
.oEmbedYouTube.active:after { | ||
background:transparent; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
jQuery(function($) { | ||
$(document).on("click", ".oEmbedYouTube", function() { | ||
var $this = $(this), | ||
$img = $this.find("img").first(), | ||
src = $img.attr("src"), | ||
rx = new RegExp("(?:img.youtube.com|i.ytimg.com)/vi/(.*)/"), | ||
match = rx.exec(src), | ||
width = $img.width(), | ||
height = $img.height(), | ||
vid; | ||
|
||
if (match) { | ||
vid = match[1]; | ||
$this.html('<iframe width="' + width + | ||
'" height="' + height + | ||
'" id="' + vid + | ||
'" src="//www.youtube.com/embed/' + vid + '?autoplay=1"' + | ||
'" frameborder="0" allowfullscreen="1" style="border:none;"></iframe>'); | ||
$this.addClass("active"); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters