Guest User

Untitled

a guest
Jul 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. document.addEventListener("DOMContentLoaded", function(event) {
  2. // Select the node that will be observed for mutations
  3. var parentOfMyList = document.body;
  4.  
  5. // Options for the observer (which mutations to observe)
  6. var config = {
  7. attributes: true,
  8. childList: true,
  9. subtree: true
  10. };
  11.  
  12. // Callback function to execute when mutations are observed
  13. var callback = function(mutationsList) {
  14. for (var mutation of mutationsList) {
  15. if (mutation.type == 'childList') {
  16.  
  17. if (document.getElementById("topcmm-123flashchat-main-toolbar-message-type-option")!= null) {
  18. var elt = document.getElementById("topcmm-123flashchat-main-toolbar-message-type-option");
  19. setTimeout(elt.click.bind(elt), 2000);
  20. if (document.getElementById("topcmm-123flashchat-toolbar-style-send-sound-btn")!= null) {
  21. var clic2 = document.getElementById("topcmm-123flashchat-toolbar-style-send-sound-btn");
  22. setTimeout(clic2.click.bind(clic2), 2100);
  23. if (document.getElementById("topcmm-123flashchat-send-message-panel-close-icon")!= null) {
  24. var clic3 = document.getElementById("topcmm-123flashchat-send-message-panel-close-icon");
  25. setTimeout(clic3.click.bind(clic3), 2200);
  26.  
  27. //execute some function
  28. }
  29. }
  30. }
  31. }
  32. }
  33. };
  34.  
  35. // Create an observer instance linked to the callback function
  36. var observer = new MutationObserver(callback);
  37. observer.observe(parentOfMyList, config);
  38. });
Add Comment
Please, Sign In to add comment