Sha256: d37176d4b32f167ae19bf170dd410d1e3e3215628c29b8403ebeacaa166a0922

Contents?: true

Size: 814 Bytes

Versions: 7

Compression:

Stored size: 814 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
      requires_iframe_origins "https://bandcamp.com"

      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

7 entries across 7 versions & 1 rubygems

Version Path
onebox-2.2.19 lib/onebox/engine/bandcamp_onebox.rb
onebox-2.2.18 lib/onebox/engine/bandcamp_onebox.rb
onebox-2.2.17 lib/onebox/engine/bandcamp_onebox.rb
onebox-2.2.16 lib/onebox/engine/bandcamp_onebox.rb
onebox-2.2.15 lib/onebox/engine/bandcamp_onebox.rb
onebox-2.2.14 lib/onebox/engine/bandcamp_onebox.rb
onebox-2.2.13 lib/onebox/engine/bandcamp_onebox.rb