Skip to content

Instantly share code, notes, and snippets.

@pronskiy
Last active August 13, 2020 07:49
const syntax = [
'@@Attr',
'#[Attr]',
'@[Attr]',
'<<>>',
];
let votes = {};
function counter(votes, rows1)
{
for (let i =2; i < rows1.length; i++) {
let name = rows1[i].children[0].innerText.split(' ')[0];
for (let j = 1; j < 5; j++) {
if (rows1[i].children[j].innerHTML !== '&nbsp;') {
if (undefined === votes[name]) {
votes[name] = [];
}
votes[name].push(syntax[j-1]);
break;
}
}
}
return votes;
}
for (let k = 1; k <= 4; k++) {
let rows = document.querySelectorAll(`#doodle__form__new_attribute_syntax_choice_${k} table tbody tr`);
votes = counter(votes, rows);
}
let res = '';
for (const [name, vote] of Object.entries(votes)) {
res += vote.join("\n") + "\n\n";
}
@pronskiy
Copy link
Author

@pronskiy
Copy link
Author

image

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