Skip to content

Instantly share code, notes, and snippets.

@kyujin-cho
Last active May 5, 2018 15:01
Show Gist options
  • Save kyujin-cho/cae624cac6be16018931673d7eba3514 to your computer and use it in GitHub Desktop.
Save kyujin-cho/cae624cac6be16018931673d7eba3514 to your computer and use it in GitHub Desktop.
추댓추첨기
// 추댓
function voteRandomUpvoterWithReply(num) {
var men = []
var voteIds = Array.prototype.map.call(document.querySelectorAll('div#voteLog > div.li > ul > li > a'), item => item.getAttribute('data-class'))
var nickTexts = Array.prototype.map.call(document.querySelectorAll('ul.fdb_lst_ul > li'), item => item)
.filter(item => item.querySelectorAll('div')[1].innerText.match(/(ㅌㅅ|탑승)/))
.filter(item => voteIds.indexOf(item.querySelector('.meta > a').classList[0].replace('member_', '')) != -1)
.map(item => item.querySelector('.meta > a').innerText)
if(nickTexts) {
if(num > nickTexts.length) num = nickTexts.length
while(num > 0) {
var man = Math.floor(Math.random() * nickTexts.length)
men.push(nickTexts[man])
nickTexts.splice(man, 1)
num--
}
}
return men
}
// simplify
var a=prompt('\uBA85\uC218');if(!isNaN(a=parseInt(a))){alert(function(c){var d=[],e=Array.prototype.map.call(document.querySelectorAll('div#voteLog > div.li > ul > li > a'),h=>h.getAttribute('data-class')),f=Array.prototype.map.call(document.querySelectorAll('ul.fdb_lst_ul > li'),h=>h).filter(h=>h.querySelectorAll('div')[1].innerText.match(/(ㅌㅅ|탑승)/)).filter(h=>-1!=e.indexOf(h.querySelector('.meta > a').classList[0].replace('member_',''))).map(h=>h.querySelector('.meta > a').innerText);if(f)for(c>f.length&&(c=f.length);0<c;){var g=Math.floor(Math.random()*f.length);d.push(f[g]),f.splice(g,1),c--}return d}(a))}
// 추
function voteRandomUpvoter(num) {
var voteNicks = Array.prototype.map.call(document.querySelectorAll('div#voteLog > div.li > ul > li > a'), item => item.innerText)
var men = []
if(voteNicks) {
if(num > voteNicks.length) num = voteNicks.length
while(num > 0) {
var man = Math.floor(Math.random() * voteNicks.length)
men.push(voteNicks[man])
voteNicks.splice(man, 1)
num--
}
}
return men
}
// simplify
var a=prompt('\uBA85\uC218');if(!isNaN(a=parseInt(a))){alert(function(c){var d=Array.prototype.map.call(document.querySelectorAll('div#voteLog > div.li > ul > li > a'),g=>g.innerText),e=[];if(d)for(c>d.length&&(c=d.length);0<c;){var f=Math.floor(Math.random()*d.length);e.push(d[f]),d.splice(f,1),c--}return e}(a))}
// 댓
function voteRandomReply(num) {
var men = []
var nickTexts = Array.prototype.map.call(document.querySelectorAll('ul.fdb_lst_ul > li'), item => item)
.filter(item => item.querySelectorAll('div')[1].innerText.match(/(ㅌㅅ|탑승)/))
.map(item => item.querySelector('.meta > a').innerText)
if(nickTexts) {
if(num > nickTexts.length) num = nickTexts.length
while(num > 0) {
var man = Math.floor(Math.random() * nickTexts.length)
men.push(nickTexts[man])
nickTexts.splice(man, 1)
num--
}
}
return men
}
// simplify
var a=prompt('\uBA85\uC218');if(!isNaN(a=parseInt(a))){alert(function(c){var d=[],e=Array.prototype.map.call(document.querySelectorAll('ul.fdb_lst_ul > li'),g=>g).filter(g=>g.querySelectorAll('div')[1].innerText.match(/(ㅌㅅ|탑승)/)).map(g=>g.querySelector('.meta > a').innerText);if(e)for(c>e.length&&(c=e.length);0<c;){var f=Math.floor(Math.random()*e.length);d.push(e[f]),e.splice(f,1),c--}return d}(a))}
@kyujin-cho
Copy link
Author

kyujin-cho commented May 5, 2018

추천 Javascript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment