©
Today I share with you a simple script that you can use in contests to extract a winner chosen randomly from your commenters. The result is independent from how many times an account commented.
Here it is:
var comments = document.getElementById('#comments');
var commentsEntities = comments.querySelectorAll('a[class="ptc"]');
var allComments = Array.prototype.slice.call(commentsEntities);
var allCommenters = [...new Set(allComments.map(e => e.innerText.split(' ')[0]))];
var randomId = Math.floor(Math.random()*allCommenters.length-1)+1;
alert('The winner is... ' + allCommenters[randomId]);
To execute it all you have to do is open the browser console on the steemit page with your contest, paste the script and press enter. To re-run the extraction paste again the script and press enter.
(If you have a basic knowledge of javascript you can check yourself that this script is absolutely safe)
Enjoy! =)