public
Last active

Simple Chrome extension

  • Download Gist
background.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<html>
<script src="jquery-1.4.2.min.js"></script>
<script>
var bitly = {
login: "your_login",
api_key: "your_api_key"
};
 
chrome.browserAction.onClicked.addListener(function(tab) {
$.get("http://api.bit.ly/v3/shorten?login=" + bitly.login +
"&apiKey=" + bitly.api_key + "&longUrl=" + tab.url, function(response) {
chrome.tabs.create({ url: "http://twitter.com/home?status=" + response.data.url});
});
});
</script>
</html>
manifest.json
JSON
1 2 3 4 5 6 7 8 9 10 11 12 13
{
"name": "Tweet this page",
"version": "1.0",
"description": "Shorten the current URL and put it a tweet.",
"browser_action": {
"default_icon": "icon.png"
},
"background_page": "background.html",
"permissions": [
"http://api.bit.ly/",
"tabs"
]
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.