Sha256: 9b0e684c127ecae416bb21ca06079bf262fc3852036f942ce89a9533d0d7f01e

Contents?: true

Size: 958 Bytes

Versions: 21

Compression:

Stored size: 958 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
      requires_iframe_origins "https://www.facebook.com"

      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::AllowlistedGenericOnebox.new(@url, @timeout).to_html
          return if Onebox::Helpers.blank?(html)
          html
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
onebox-2.2.12 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.11 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.10 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.9 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.8 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.6 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.5 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.4 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.2 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.1 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.2.0 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.9 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.8 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.7 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.6 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.5 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.4 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.3 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.2 lib/onebox/engine/facebook_media_onebox.rb
onebox-2.1.1 lib/onebox/engine/facebook_media_onebox.rb