Skip to content

Instantly share code, notes, and snippets.

@champierre
Created June 30, 2011 17:01
Show Gist options
  • Select an option

  • Save champierre/1056668 to your computer and use it in GitHub Desktop.

Select an option

Save champierre/1056668 to your computer and use it in GitHub Desktop.
An user script that adds Twitter button and Facebook Like button to Scratch project pages. You can use this as Chrome extension or as a greasemonkey script for Firefox.
// ==UserScript==
// @title Scratch Plus
// @description Add Twitter button and Facebook Like button to Scratch project pages.
// @namespace http://tsukurusha.com
// @include http://scratch.mit.edu/projects/*
// ==/UserScript==
var pactions = document.getElementById('pactions');
var buttons = document.createElement('div');
var twitter_button = document.createElement('span');
twitter_button.innerHTML = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?text=' + encodeURIComponent(document.title) + '" style="width:110px; height:21px;"></iframe>';
var facebook_like_button = document.createElement('span');
facebook_like_button.innerHTML = '<iframe src="http://www.facebook.com/plugins/like.php?app_id=235188349839830&amp;href=' + encodeURIComponent(document.location.href) + '&amp;send=false&amp;layout=button_count&amp;width=200&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:21px;" allowTransparency="true"></iframe>';
buttons.appendChild(twitter_button);
buttons.appendChild(facebook_like_button);
pactions.appendChild(buttons);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment