Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.addEventListener("DOMContentLoaded", function(event) {
- // Select the node that will be observed for mutations
- var parentOfMyList = document.body;
- // Options for the observer (which mutations to observe)
- var config = {
- attributes: true,
- childList: true,
- subtree: true
- };
- // Callback function to execute when mutations are observed
- var callback = function(mutationsList) {
- for (var mutation of mutationsList) {
- if (mutation.type == 'childList') {
- if (document.getElementById("topcmm-123flashchat-main-toolbar-message-type-option")!= null) {
- var elt = document.getElementById("topcmm-123flashchat-main-toolbar-message-type-option");
- setTimeout(elt.click.bind(elt), 2000);
- if (document.getElementById("topcmm-123flashchat-toolbar-style-send-sound-btn")!= null) {
- var clic2 = document.getElementById("topcmm-123flashchat-toolbar-style-send-sound-btn");
- setTimeout(clic2.click.bind(clic2), 2100);
- if (document.getElementById("topcmm-123flashchat-send-message-panel-close-icon")!= null) {
- var clic3 = document.getElementById("topcmm-123flashchat-send-message-panel-close-icon");
- setTimeout(clic3.click.bind(clic3), 2200);
- //execute some function
- }
- }
- }
- }
- }
- };
- // Create an observer instance linked to the callback function
- var observer = new MutationObserver(callback);
- observer.observe(parentOfMyList, config);
- });
Add Comment
Please, Sign In to add comment