Sha256: 1f0c23c3465cf7bb31bca063050c756e33fc9e7888ab7ff9e297c39973741fb6

Contents?: true

Size: 854 Bytes

Versions: 2

Compression:

Stored size: 854 Bytes

Contents

AutoHtml.add_filter(:liveleak).with(:width => 420, :height => 315, :frameborder => 0, :wmode => nil, :autoplay => false, :hide_related => false) do |text, options|
  regex = %r{http://www\.liveleak\.com/(?:ll_embed|view)\?.=(\w+)}
  text.gsub(regex) do
    liveleak_id = $1
    width = options[:width]
    height = options[:height]
    frameborder = options[:frameborder]
    wmode = options[:wmode]
    autoplay = options[:autoplay]
    hide_related = options[:hide_related]
    src = "http://www.liveleak.com/ll_embed?f=#{liveleak_id}"
    params = []
    params << "wmode=#{wmode}" if wmode
    params << "autoplay=1" if autoplay
    params << "rel=0" if hide_related
    src += "?#{params.join '&'}" unless params.empty?
    %{<iframe width="#{width}" height="#{height}" src="#{src}" frameborder="#{frameborder}" allowfullscreen></iframe>}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
auto_html-1.6.4 lib/auto_html/filters/liveleak.rb
auto_html-1.6.3 lib/auto_html/filters/liveleak.rb