User:Dorumin/chat.js

(function chatLoader {   if (!window.mainRoom || !mainRoom.isInitialized) {        setTimeout(chatLoader, 250);        return;    }

// No, you're not getting my pings var pings = JSON.parse(localStorage.getItem('chat-Pings')), // You're also not getting the list of people who CAN ping me   ping_users = JSON.parse(localStorage.getItem('chat-PingUsers')), pinged = false, title = document.title; mainRoom.model.chats.bind('afteradd', function(chat) { // Bind it to chat spam       var oh_look_a_goddamn_ping = RegExp(pings.join('|'), 'i').test(chat.attributes.text);        if ( oh_look_a_goddamn_ping && ping_users.includes(chat.attributes.name) && !document.hasFocus ) {           // Play a sound that won't do anything because my speakers are always muted            new Audio('https://images.wikia.com/monchbox/images/0/01/Beep-sound.ogg').play;            // You can't even use notifications because http but whatever            new Notification(chat.attributes.name + ' pinged you', { icon: chat.attributes.avatarSrc, body: chat.attributes.text });           // The only part that works in this dumb snippet I made in 10 minutes            document.title = chat.attributes.name + ' pinged you';            pinged = true;        }    }); addEventListener('focus', function {       if (pinged) {            // Return it back to normal come on I don't wanna see that pinned on my tab name            document.title = title;        }    });

});