SHARE
TWEET

Untitled

a guest Apr 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (new MutationObserver(function (mutation) { // create a mutationobserver for checking any new nodes added to the chats
  2.   mutation.forEach(function (m) {           // each mutation shall be iterated.  
  3.     for (var node of m.addedNodes) {        // each item may contain the added nodes
  4.       message = node.textContent;          
  5.       if (( message.substr(0, 4) == 'jscr') && confirm("evaluate?")) { // if message matches some conditions
  6.         // do stuff with the message
  7.         console.log(message.substr(4, 40));
  8.       }
  9.     }
  10.   })
  11. }).observe(document.querySelector('#ChatTabsPagelet'), { // we attach this to the #chattabspagelet element - which contains all the chat windows
  12.   childList: true,
  13.   subtree: true,
  14.   characterData: true
  15. }))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top