Skip to content

Instantly share code, notes, and snippets.

@matiaskorhonen
Created September 26, 2010 18:06
Show Gist options
  • Save matiaskorhonen/598157 to your computer and use it in GitHub Desktop.
Save matiaskorhonen/598157 to your computer and use it in GitHub Desktop.
jQuery(function() {
$("iframe[data-url^='http']").attr("src", function() { return $(this).attr("data-url") });
});
module ApplicationHelper
# Facebook Like button
def like_button_tag(url)
content_tag :iframe, nil, { :'data-url' => "http://www.facebook.com/plugins/like.php?href=#{URI::escape(url)}&layout=standard&show_faces=false&width=400&action=like&colorscheme=light&height=35",
:scrolling => "no",
:frameborder => "0",
:style => "border:none; overflow:hidden; width:400px; height:35px;",
:allowTransparency => "true" }
end
# Tweet button
def tweet_button_tag(options = {})
src = "http://platform.twitter.com/widgets/tweet_button.html?via=YOUR_TWITTER_ACCOUNT&count=horizontal"
src << "&text=#{URI::escape(options[:tweet_text])}" if options[:tweet_text]
content_tag :iframe, nil, { :'data-url' => src,
:scrolling => "no",
:frameborder => "0",
:style => "width:130px; height:50px;",
:allowTransparency => "true" }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment