Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  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. }))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement