1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
// 幫改良
// 改轉噗喜歡的話rawData改成document.querySelectorAll("ul li a div")
var rawData = document.querySelectorAll('.name'),
noOfWinners = 2, // 要抽幾個人可以自己指定
lotteryList = Array.apply(null,rawData), 
listSize = lotteryList.length, 
excluded=['amicloud']; // 放要排除的人的帳號
while(noOfWinners >= 0 && listSize > 0) {
    let winner = lotteryList.splice(Math.floor(Math.random()*listSize),1)[0];
    listSize--;
// 轉噗喜歡 winner.href.split('/')[3] 改成 winner.textContent.split('@')[1]
    if(!excluded.includes(winner.href.split('/')[3])) {
// 轉噗喜歡 winnerName  改成 winner.textContent.split('@')[0]
        let winnerName = winner.text;
        console.log(winnerName);
        excluded.push(winnerName);
        noOfWinners--;
    }
}