Skip to content

Commit

Permalink
support vimeo embed too
Browse files Browse the repository at this point in the history
  • Loading branch information
Visnu Pitiyanuvath committed Nov 13, 2012
1 parent 0fa84f6 commit d131fea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion helpers/index.coffee
Expand Up @@ -64,11 +64,13 @@ module.exports = (app) ->

favicon: (sponsor) -> favicons[sponsor]

youtubeEmbed: (url) ->
embedVideo: (url) ->
if match = url.match(/youtube.com\/.*v=([^&]+).*/)
"//www.youtube.com/embed/#{match[1]}"
else if match = url.match(/youtu.be\/(.*)/)
"//www.youtube.com/embed/#{match[1]}"
else if match = url.match(/vimeo.com\/(\d+)/)
"//player.vimeo.com/video/#{match[1]}"

app.dynamicHelpers

Expand Down
2 changes: 1 addition & 1 deletion views/people/show.jade
Expand Up @@ -50,7 +50,7 @@ h1.name= title(person.name)
.clear
!= markdown(nextVote.team.entry.description)
- if (nextVote.team.entry.videoURL)
- if (embed = youtubeEmbed(nextVote.team.entry.videoURL))
- if (embed = embedVideo(nextVote.team.entry.videoURL))
p: iframe( width="560", height="315", src=embed, frameborder="0", allowfullscreen=true )
- else
h4 Screencast
Expand Down
2 changes: 1 addition & 1 deletion views/teams/entry.jade
Expand Up @@ -21,7 +21,7 @@
.clear
!= markdown(team.entry.description)
- if (team.entry.videoURL)
- if (embed = youtubeEmbed(team.entry.videoURL))
- if (embed = embedVideo(team.entry.videoURL))
p: iframe( width="540", height="304", src=embed, frameborder="0", allowfullscreen=true )
- else
h4 Screencast
Expand Down

0 comments on commit d131fea

Please sign in to comment.