Skip to content

Instantly share code, notes, and snippets.

@dnoseda
Created November 17, 2011 02:17
Show Gist options
  • Save dnoseda/1372183 to your computer and use it in GitHub Desktop.
Save dnoseda/1372183 to your computer and use it in GitHub Desktop.
var s=document.createElement("script");
s.src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js";
s.onload=function(){
$("ul.actions").map(function(){
var id=$(this).find("a.love").attr("rel");
console.log(id);
var button="<li><a rel=\""+id+"\" id=\"unlo-"+id+"\" class=\"unlove badge-vote-down\" href=\"#\"><span>Unlove</span></a></li>";
$(this).append(button);
});
$("a.unlove").click(function (e){
e.preventDefault();
var id=$(this).attr("rel");
$.get("http://9gag.com/vote/dislike/id/"+id,function(){
$("#unlo-"+id).addClass("unloved");
});
});
};
document.body.appendChild(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment