Created
September 1, 2011 12:50
-
-
Save joseanpg/1186102 to your computer and use it in GitHub Desktop.
GEJS 5.3 Recuento de votos
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
/* | |
RECUENTO DE VOTOS PARA | |
http://www.meetup.com/madridjs/pages/Votaci%F3n_para_%22Yo_tambi%E9n_quiero_una_birra%22/ | |
Abre la consola, pega el siguiente código en ella | |
y ejecuta el siguiente código :) | |
Verficado en Firefox a las 14:46 del 2011-09-01 | |
*/ | |
alert( | |
[].reduce.call(document.querySelectorAll('.D_bbcode ul > li'),function(acu,li){ | |
var t = /^(@.+)\s*:\s*([\+\d\s]*?)\s*$/.exec(li.textContent); | |
var p = t[2].match(/\+\d{1,3}/g); | |
p = p ? t[1]+':'+p.reduce(function(acu,item){return acu+Number(item);},0)+'\n' | |
: ''; | |
return acu+p; | |
},'')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Versión utilizando
eval
(cuidadito coneval
en situaciones como esta :)