There are 1 previous version of this script.
// ==UserScript==
// @name DNUK instant voting
// @include http://www.doctors.net.uk/*
// @include http://www.doctors.org.uk/*
// @include https://www.doctors.net.uk/*
// @include https://www.doctors.org.uk/*
// @author Christopher Lam
// ==/UserScript==
// Adapted from Jesse Ruderman's BASH.org instant voting
// Quick and dirty... just looks for 'Add' and replaces it with an AJAX-type request
// Revision 2011-12:
// http(s)
// Revision 2005-12:
// Update for GM 0.6.4
// Revision 2005-08:
// Clean up and update for GM 0.5
// Now the illusion is even better
(function() {
var i,x;
all = document.links;
for (i=0; i < all.length; i++) {
x = all[i];
if (x.textContent=="Add") {
x.addEventListener('click', asyncClick, true);
x.textContent = "Instant-Add";
x.parentNode.nextSibling.style.width = '';
}
}
})();
function asyncClick(event)
{
var link = event.target
var line = link.parentNode
var summary = link.previousSibling;
event.stopPropagation();
event.preventDefault();
link.textContent= 'Adding...';
/*
var req = new XmlHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", link.href, true);
req.send(null);
*/
GM_xmlhttpRequest({
method: 'GET',
url: link.href,
onload: processload});
function processload(req) {
if (req.status != 200) {
line.replaceChild(document.createTextNode("Sorry, couldn't add"), link);
//line.innerHTML = '<span style="background:red; color:white;">Error! '+req.statusText+'</span>';
return;
}
else {
line.removeChild(link.nextSibling);
line.removeChild(link);
N = parseInt(summary.nodeValue) + 1;
summary.nodeValue = ' ' + N + ' colleagues voted this a quality posting.'
//line.innerHTML = '<span style="background:blue; color:white">Done!</span>';
}
}
return false;
}