Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SSS Kraken filter
(function () {
String.prototype.padRight = function(l,c) {return this+Array(l-this.length+1).join(c||" ")};
// intersection
const intersect = xs => ys => {
const zs = createSet(ys);
return filter(x => zs.has(x)
? true
: false
) (xs);
};
const $ = document.querySelector.bind(document);
$("[href='/archives/snack']").click();
if (!$('#details_toggle').classList.contains('active')) {
$('#details_toggle').click()
}
if (!$('#channel_page_all_members')) {
$('#member_count_title').click();
}
const kraken = $('#channel_page_all_members').innerText.split('\n');
const changed = $('#channel_topic_text').innerText.split(/[\s+,@]+/);
$("[href='/archives/pirate-island']").click()
if (!$('#details_toggle').classList.contains('active')) {
$('#details_toggle').click()
}
if (!$('#channel_page_all_members')) {
$('#member_count_title').click();
}
const people = $('#channel_page_all_members').innerText.split('\n');
const dead = $('#channel_topic_text').innerText.split(/[\s+,@]+/);
const getStatus = username => {
let role = '😱';
let status = '';
let name = username.replace('(you)', '(đẹp trai)');
if (kraken.indexOf(name) > -1) {
role = '👾';
}
if (changed.indexOf(name) > -1) {
role = '😈';
}
if (dead.indexOf(name) > -1) {
status = '💔';
}
return (role + status + ' ' + name).padRight(25);
}
const deadKraken = intersect(kraken, dead);
const deadPeople = intersect(people, dead);
const deadChanged = intersect(changed, dead);
const board = people.filter(a => a).map(getStatus);
console.log(`%c👾 Kraken alive: ${kraken.length - deadKraken.length} | \
😱 People alive: ${people.length - kraken.length - deadPeople.length}
😈 Changed: ${changed.length} (${deadChanged.length} dead) | \
💔 Total Dead: ${dead.length}`,
'font-weight: bold');
console.log('\n' + board.sort().join('\t'));
})();
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.