Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
댓글 선택자를 설정해주셔야 합니다.
페이스북 페이지 리액션 (좋아요 등) : #reaction_profile_browser>li>div ._5j0e.fsl.fwb.fcb>a
페이스북 공유 : '#repost_view_dialog .n_1gapi2flae .profileLink';
페이스북 댓글 : ._3w53 ._6qw4
*/
var 댓글선택자 = '._3w53 ._6qw4';
function shuffle(a) {
for (let i = a.length; i; i--) {
let j = Math.floor(Math.random() * i);
[a[i - 1], a[j]] = [a[j], a[i - 1]];
}
}
var list = [];
document.querySelectorAll(댓글선택자).forEach(function(e){
list.push({name:e.firstChild, url:e.href, tag:e});
});
list = list.filter((v,i,a) => a.indexOf(v)===i);
shuffle(list)
for(var i=0; i<list.length; i++){
console.log(i+1, list[i].name, list[i].url);
}
@gaerae

This comment has been minimized.

Copy link

commented Aug 9, 2018

동일한 방법인데, 출력을 조금 이쁘게 만들어봤습니다. 😃
https://github.com/gaerae/facebook-contest-winner

@egoing

This comment has been minimized.

Copy link
Owner Author

commented Aug 28, 2018

@gaerae님 멋지네요! ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.