1 2 3 4 5 6 7 8 9 10 11 12
module.exports = Ferdium => { const getMessages = () => { // get unread messages let count = 0; for (const span of document.querySelectorAll('span[jsname=DW2nlb]')) count += Ferdium.safeParseInt(span.textContent); // set Ferdium badge Ferdium.setBadge(count); }; Ferdium.loop(getMessages); };