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.38 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.36 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.35 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.34 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.33 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.32 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.31 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.30 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.29 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.28 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.27 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.26 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.25 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.24 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.23 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.22 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.21 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.20 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.19 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.18 lib/onebox/engine/bandcamp_onebox.rb