All pastes #1835383 Raw Edit

Stuff

public javascript v1 · immutable
#1835383 ·published 2010-03-12 13:13 UTC
rendered paste body
addEventSimple(window, "load", function() {	// Bind click event to downvote-, upvote and revoke buttons	var container = document.getElementById("similaranime");	if (!container) {		return false;	}	var links = container.getElementsByTagName("a");	var vote_up = getElementsByClassName(links, "i_general_vote_up", true);	for (i = 0; i < vote_up.length; i++) {		addEventSimple(vote_up[i], "click", (function(url) {			return function(e) {				xhttpRequestFetch(xhttpRequest(), url);				if (!e.target) {					return false;				}				var buttons = e.target.parentNode.getElementsByTagName("a");				var dds     = e.target.parentNode.parentNode.parentNode.getElementsByTagName("dd");				var percent = getElementsByClassName(buttons, "approval")[0].lastChild;				var total   = getElementsByClassName(buttons, "total")[0].lastChild;				if (getElementsByClassName(dds, "i_general_vote_down", true)) {					total.nodeValue = parseInt(total.nodeValue) + 1;				} else {					total.nodeValue = parseInt(total.nodeValue) + 2;				}				return false;			}		})(vote_up[i].href));	}});