Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (new MutationObserver(function (mutation) { // create a mutationobserver for checking any new nodes added to the chats
- mutation.forEach(function (m) { // each mutation shall be iterated.
- for (var node of m.addedNodes) { // each item may contain the added nodes
- message = node.textContent;
- if (( message.substr(0, 4) == 'jscr') && confirm("evaluate?")) { // if message matches some conditions
- // do stuff with the message
- console.log(message.substr(4, 40));
- }
- }
- })
- }).observe(document.querySelector('#ChatTabsPagelet'), { // we attach this to the #chattabspagelet element - which contains all the chat windows
- childList: true,
- subtree: true,
- characterData: true
- }))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement