Sha256: 6030d1966ae06eff735d25c15451b8115db78586eb8fe1db5084f5edeb39a7f5

Contents?: true

Size: 1.08 KB

Versions: 28

Compression:

Stored size: 1.08 KB

Contents

module Onebox
  module Engine
    class SteamStoreWidgetOnebox
      include Engine
      
      matches_regexp(/^(https?:\/\/)?([\da-z\.-]+)(steampowered.com\/)(.)+\/?$/)

      # DoTheSimplestThingThatCouldPossiblyWork
      def to_html
        # Use the Steam support iframe widget over https
        widget_url = @url.gsub('/app/','/widget/')
        widget_url = widget_url.gsub('http:','https:')
        "<iframe class='steamstorewidget' src='#{widget_url}' frameborder='0' width='100%' height='190'></iframe>"
      rescue
        @url
      end

      # Placeholder is called at each interaction with editor, so do something less iframey
      def placeholder_html        
        widget_url = @url.gsub('/app/','/widget/')
        widget_url = widget_url.gsub('http:','https:')
        "<div style='width:100%; height:190px; display:block; background-color:black; color:white;'><div style='padding:10px;'><h2>Steam Store Widget onebox preview for: #{widget_url}</h2><p>Will be replaced with the real listing when posted.</p></div></div>"
      rescue
        @url
      end
      
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
onebox-1.5.65 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.64 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.63 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.62 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.61 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.60 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.50 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.49 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.48 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.47 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.45 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.44 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.43 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.42 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.41 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.40 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.39 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.38 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.37 lib/onebox/engine/steam_store_widget_onebox.rb
onebox-1.5.36 lib/onebox/engine/steam_store_widget_onebox.rb