Sha256: 474eda4bf37b2fc787ad4ac3a0ae24eba8bda38e4e9874a8155a027fe5f093f8

Contents?: true

Size: 901 Bytes

Versions: 7

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true

module Onebox
  module Engine
    class FacebookMediaOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/.*\.facebook\.com\/(\w+)\/(videos|\?).*/)
      always_https

      def to_html
        metadata = get_twitter
        if metadata.present? && metadata[:card] == "player" && metadata[:player].present?
          <<-HTML
            <iframe src="#{metadata[:player]}"
                    width="#{metadata[:player_width]}"
                    height="#{metadata[:player_height]}"
                    scrolling="no"
                    frameborder="0"
                    allowfullscreen>
            </iframe>
          HTML
        else
          html = Onebox::Engine::WhitelistedGenericOnebox.new(@url, @timeout).to_html
          return if Onebox::Helpers.blank?(html)
          html
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
onebox-1.9.30 lib/onebox/engine/facebook_media_onebox.rb
onebox-1.9.29 lib/onebox/engine/facebook_media_onebox.rb
onebox-1.9.28.4 lib/onebox/engine/facebook_media_onebox.rb
onebox-1.9.28.3 lib/onebox/engine/facebook_media_onebox.rb
onebox-1.9.28.2 lib/onebox/engine/facebook_media_onebox.rb
onebox-1.9.28.1 lib/onebox/engine/facebook_media_onebox.rb
onebox-1.9.28 lib/onebox/engine/facebook_media_onebox.rb