Sha256: 9cde2cf34dd5842dbdf6893bae88bfb39e0c4b6c334574b45b75f3d29899d575

Contents?: true

Size: 726 Bytes

Versions: 6

Compression:

Stored size: 726 Bytes

Contents

AutoHtml.add_filter(:youtube_js_api).with(:width => 390, :height => 250) do |text, options|
  text.gsub(/https?:\/\/(www.)?youtube\.com\/watch\?v=([A-Za-z0-9._%-]*)(\&\S+)?/) do
    youtube_id = $2
    %{<object width="#{options[:width]}" height="#{options[:height]}"><param name="movie" value="//www.youtube.com/v/#{youtube_id}?enablejsapi=1&playerapiid=ytplayer"></param><param name="wmode" value="transparent"></param><param name="allowscriptaccess" value="always"></param><embed src="//www.youtube.com/v/#{youtube_id}?enablejsapi=1&playerapiid=ytplayer" type="application/x-shockwave-flash" wmode="transparent" width="#{options[:width]}" height="#{options[:height]}" allowscriptaccess="always"></embed></object>}
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
auto_html-whistlerbrk-2.0.0.pre lib/auto_html/filters/youtube_js_api.rb
auto_html-1.6.4 lib/auto_html/filters/youtube_js_api.rb
auto_html-1.6.3 lib/auto_html/filters/youtube_js_api.rb
auto_html-1.6.2 lib/auto_html/filters/youtube_js_api.rb
auto_html-1.6.1 lib/auto_html/filters/youtube_js_api.rb
auto_html-1.6.0 lib/auto_html/filters/youtube_js_api.rb