Skip to content

Commit

Permalink
Make iframe attribute order consistent.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed May 3, 2017
1 parent a3df772 commit da765a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions config/initializers/05-string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def embed_html(request=nil)
root_url = request ? request.root_url : ""
if %r{^https?://www\.facebook\.com/.*/videos/(?:vb\.\d+\/)?(?<id>\d+)} =~ self or %r{^https?://www\.facebook\.com/video/embed\?video_id=(?<id>\d+)} =~ self
<<-EOF.undent
<iframe src="https://www.facebook.com/video/embed?video_id=#{id}" width="1280" height="720" frameborder="0" scrolling="no" allowfullscreen></iframe>
<iframe width="1280" height="720" src="https://www.facebook.com/video/embed?video_id=#{id}" frameborder="0" scrolling="no" allowfullscreen></iframe>
<a href="https://www.facebook.com/video/embed?video_id=#{id}">Open embed</a> | <a href="#{root_url}/facebook/download?url=#{id}">Download video</a> | <a href="#{root_url}/?download=#{CGI.escape("https://www.facebook.com/video/embed?video_id=#{id}")}">Download video with nice filename</a>
EOF
elsif %r{^https?://(?:www\.|m\.)youtube\.com/(?:.*?[?&#](v=(?<id>[^&#]+)|list=(?<list>[^&#]+)|t=(?<t>[^&#]+)))+} =~ self or %r{^https?://youtu\.be/(?<id>[^?&#]+)(?:.*?[?&#](list=(?<list>[^&#]+)|t=(?<t>[^&#]+)))*} =~ self
Expand All @@ -212,7 +212,7 @@ def embed_html(request=nil)
elsif %r{^https?://(?:www\.)?vimeo\.com/(?<id>\d+)} =~ self
"<iframe width='853' height='480' src='https://player.vimeo.com/video/#{id}' frameborder='0' scrolling='no' allowfullscreen></iframe>"
elsif %r{^https?://(?:www\.)?instagram\.com/p/(?<id>[^/?#]+)} =~ self
"<iframe src='https://www.instagram.com/p/#{id}/embed/' width='612' height='710' frameborder='0' scrolling='no' allowfullscreen></iframe>"
"<iframe width='612' height='710' src='https://www.instagram.com/p/#{id}/embed/' frameborder='0' scrolling='no' allowfullscreen></iframe>"
elsif %r{^https?://(?:www\.)?twitch\.tv/(?:videos/(?<vod_id>\d+)|(?<channel_name>[^/]+)(?:/v/(?<vod_id>\d+))?).*(?:[?&#](?<t>t=[^&#]+))?} =~ self
# https://www.twitch.tv/videos/25133028
# https://www.twitch.tv/gamesdonequick
Expand Down
2 changes: 1 addition & 1 deletion views/instagram_feed.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<%=
if post["is_video"]
<<-EOF.undent.esc
<iframe src="https://www.instagram.com/p/#{post["code"]}/embed/" width="612" height="710" frameborder="0" scrolling="no" allowfullscreen></iframe>
<iframe width="612" height="710" src="https://www.instagram.com/p/#{post["code"]}/embed/" frameborder="0" scrolling="no" allowfullscreen></iframe>
#{post["caption"].linkify.to_paragraphs}
<p><a href="#{request.root_url}/instagram/download?url=#{post["code"]}">Download video</a></p>
EOF
Expand Down

0 comments on commit da765a4

Please sign in to comment.