Created
April 15, 2009 04:10
-
-
Save rmanalan/95595 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # For Slideshare we have to introspect the page and get the swf file in order to create the object/embed tags | |
| AutoHtml.add_filter(:slideshare).with(:width => 650, :height => 528) do |text, options| | |
| text.gsub(/http:\/\/(www.)?slideshare\.net\/[A-Za-z0-9._%-]*\/([A-Za-z0-9._%-]*)[&\w;=\+_\-]*/) do |s| | |
| doc = Hpricot(open(s)) | |
| swf = doc.to_s.match(/http:\/\/static.slidesharecdn.com\/swf\/ssplayer2\.swf\?doc\=([A-Za-z0-9._%-]*)[&\w;=\+_\-]*/)[0] | |
| %{<object style="margin:0px" width="#{options[:width]}" height="#{options[:height]}"><param name="movie" value="#{swf}" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="#{swf}" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="#{options[:width]}" height="#{options[:height]}"></embed></object>} | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AutoHtml.add_filter(:google_video).with(:width => 650, :height => 391) do |text, options| | |
| text.gsub(/http:\/\/video\.google\.com\/videoplay\?docid\=([0-9]*)[&\w;=\+_\-]*/) do | |
| docid = $1 | |
| %{<object width="#{options[:width]}" height="#{options[:height]}"><param name="movie" value="http://video.google.com/googleplayer.swf?docid=#{docid}&hl=en&fs=true"></param><param name="wmode" value="transparent"></param><embed src="http://video.google.com/googleplayer.swf?docid=#{docid}" type="application/x-shockwave-flash" wmode="transparent" width="#{options[:width]}" height="#{options[:height]}"></embed></object>} | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment