Skip to content

Instantly share code, notes, and snippets.

@BrunoCaimar
Created December 2, 2009 22:58
Show Gist options
  • Save BrunoCaimar/247694 to your computer and use it in GitHub Desktop.
Save BrunoCaimar/247694 to your computer and use it in GitHub Desktop.
JetMeme.js
// @name JetMeme
// @author Bruno Caimar <bruno.caimarATgmail.com/>
// http://twitter.com/brunocaimar
// http://meme.yahoo.com/brunocaimar
//
// @description Add a context menu on images to post it to Yahoo! Meme
//
// @license http://www.opensource.org/licenses/bsd-license.php
// @version 0.0.1b_20091201 - Initial development
jetpack.future.import("menu");
jetpack.menu.context.page.on("img").add(function(target)({
label: "Send this to my Yahoo! Meme",
icon: "http://l.yimg.com/cc/img/global/1257504392/favicon.ico",
command: function(){
var rootURL = "http://meme.yahoo.com/dashboard/?photo=";
var captionParam = "&caption=";
var captionText = "Source:<a href='" + target.document.location.href + "'>" +
target.document.title + "</a>" +
" - (via JetMeme)";
var memeUrl = rootURL + target.node.src + captionParam + captionText;
jetpack.tabs.open(encodeURI(memeUrl));
jetpack.tabs[jetpack.tabs.length-1].focus();
jetpack.notifications.show({title: "Yahoo! Meme extension",
body: "New tab opened to post the selected image to Yahoo! Meme" ,
icon: this.icon});
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment