Sha256: 3e4c146f10757bbbdd360d6252af3bc051668d4c3e17e6fe87ece411466b7d05
Contents?: true
Size: 614 Bytes
Versions: 4
Compression:
Stored size: 614 Bytes
Contents
module Onebox module Engine class YoutubeOnebox include Engine include StandardEmbed matches_regexp /^https?:\/\/(?:www\.)?(?:youtube\.com|youtu\.be)\/.+$/ def to_html rewrite_agnostic(append_params(raw[:html])) end def append_params(html) result = html.dup result.gsub! /(src="[^"]+)/, '\1&wmode=opaque' if url =~ /t=(\d+)/ result.gsub! /(src="[^"]+)/, '\1&start=' + Regexp.last_match[1] end result end def rewrite_agnostic(html) html.gsub(/https?:\/\//, '//') end end end end
Version data entries
4 entries across 4 versions & 1 rubygems