2 ms·
More specifically, something like this, will add kinda functional downmod arrows: // Find all <a> links with an id of up_* then add a downmod arrow which upv
by axod 17y ago
More specifically, something like this, will add kinda functional downmod arrows:
// Find all <a> links with an id of up_* then add a downmod arrow which upvotes everything apart from this article on the page.
var links = document.getElementsByTagName("a"); // Look at all links...
for (var i=0;i<links.length;i++) {
var alink = links.item(i);
if (alink.id.substring(0,3)=="up_") {
// We found one...
var downer = document.createElement("a");
var img = document.createElement("img");
img.src = "/graydown.gif";
img.style.border = "0";
downer.appendChild(img);
alink.parentNode.appendChild(document.createElement("br"));
alink.parentNode.appendChild(downer);
downer.href = "#";
downer.onclick = function(n) {
return function() {
downmod(n);
}
}(alink);
}
// Downmod by upvoting everything else...
function downmod(node) {
var links = document.getElementsByTagName("a"); // Look at all links...
for (var i=0;i<links.length;i++) {
var alink = links.item(i);
if (alink.id.substring(0,3)=="up_") {
// We found one...
if (alink!=node) vote(alink); // Vote for it...
}
}
}