Created
November 16, 2011 23:47
-
-
Save dnoseda/1371899 to your computer and use it in GitHub Desktop.
9gag-unlove.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// bookmarklet at https://gist.github.com/1371984 | |
javascript:(function(){ | |
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