Sha256: 23dd6b2012f865cba92adfb128fd4b2210fc6a3f52c560a6ab6ab72f9f59fa48

Contents?: true

Size: 780 Bytes

Versions: 49

Compression:

Stored size: 780 Bytes

Contents

# frozen_string_literal: true

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
        "<img src='#{og.image}' height='#{og.video_height}' #{og.title_attr}>"
      end

      def to_html
        og = get_opengraph
        escaped_src = og.video_secure_url || og.video

        <<-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

49 entries across 49 versions & 1 rubygems

Version Path
onebox-1.9.18 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.17 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.16 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.15 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.14 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.13 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.12 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.11 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.10 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.9 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.8 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.7 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.6 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.5 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.4 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.3 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.2 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.1 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.9.0 lib/onebox/engine/bandcamp_onebox.rb
onebox-1.8.99 lib/onebox/engine/bandcamp_onebox.rb