Sha256: 73cd71ee991ef94bb34da42b6e57eb883d2499465687f41419685733f9c10b7f

Contents?: true

Size: 910 Bytes

Versions: 83

Compression:

Stored size: 910 Bytes

Contents

module Onebox
  module Engine
    class BandCampOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/.*\.bandcamp\.com\/(album|track)\//)
      always_https

      def placeholder_html
        og = get_opengraph
        escaped_src = ::Onebox::Helpers.normalize_url_for_output(og[:image])
        "<img src='#{escaped_src}' height='#{og[:video_height]}' #{Helpers.title_attr(og)}>"
      end

      def to_html
        og = get_opengraph
        src = og[:video_secure_url] || og[:video]
        escaped_src = ::Onebox::Helpers.normalize_url_for_output(src)

        <<-HTML
          <iframe src="#{escaped_src}"
                  width="#{og[:video_width]}"
                  height="#{og[:video_height]}"
                  scrolling="no"
                  frameborder="0"
                  allowfullscreen>
          </iframe>
        HTML
      end

    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
onebox-1.8.17 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.16 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.15 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.14 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.13 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.12 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.11 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.10 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.9 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.8 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.7 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.6 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.5 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.4 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.3 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.2 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.1 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.0 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.7.9 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.7.8 lib/onebox/engine/bandcamp_onebox.rb