in pysteve/www/htdocs/js/steve_stv.js [246:284]
function dropCandidate(ev) {
if (ev.preventDefault) ev.preventDefault();
if (ballotNames.length >= maxnum) {
return; // MNTV lockout
}
source = ev.dataTransfer ? ev.dataTransfer.getData("Text") : tb;
source = source ? source : tb
dest = ev.target.getAttribute("data")
dest = dest ? dest : "LOWER"
if (dest == source) { // touch fixes
dest = "LOWER"
}
var z = 0;
if (dest == "UPPER") { dest = ballotNames[0]; z = 0}
if (dest == "LOWER") { dest = ballotNames[ballotNames.length -1]; z = 1;}
if (dest && candidates.indexOf(dest) != -1) {
return;
}
if (ballotNames.indexOf(source) == -1 && candidates.indexOf(source) != -1) {
var x = ballotNames.indexOf(dest)
x += z
if (ballotNames.indexOf(dest) != -1) {
ballotNames.splice(x,0,source);
ballotChars.splice(x,0,chars[candidates.indexOf(source)]);
} else {
ballotNames.push(source)
ballotChars.push(chars[candidates.indexOf(source)])
}
chars.splice(candidates.indexOf(source), 1)
candidates.splice(candidates.indexOf(source), 1)
fadeIn(0, "ballot", Math.random())
//ev.preventDefault()
drawCandidates();
drawList();
}
}