Sha256: 417ec2e52c35e7bb4883a827005bdbafa75c1d0253ecd6d15fe8f9c93cd8e71b

Contents?: true

Size: 847 Bytes

Versions: 6

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true

module Onebox
  module Mixins
    module TwitchOnebox

      def self.included(klass)
        klass.include(Onebox::Engine)
        klass.matches_regexp(klass.twitch_regexp)
        klass.include(InstanceMethods)
      end

      module InstanceMethods
        def twitch_id
          @url.match(self.class.twitch_regexp)[1]
        end

        def base_url
          "player.twitch.tv/?"
        end

        def placeholder_html
          "<div class='onebox-video-placeholder'><span class='video-placeholder-icon'></span></div>"
        end

        def to_html
          "<iframe src=\"//#{base_url}#{query_params}&autoplay=false\" width=\"620\" height=\"378\" frameborder=\"0\" style=\"overflow: hidden;\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\"></iframe>"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
onebox-1.8.99 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.98 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.97 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.96 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.95 lib/onebox/mixins/twitch_onebox.rb
onebox-1.8.94 lib/onebox/mixins/twitch_onebox.rb