Alert when Div content change

Script exchange and development requests
Post Reply
Finishet
Posts: 1
Joined: 07.03.17 21:45:59

Alert when Div content change

Post by Finishet » 07.03.17 21:50:51

i have this script and dont know how make work on tampermonkey. I need a code that alert me when a Div content change ex: Ticket:0 change to Ticket:1 Open a alert Ty

Code: Select all

<script type="text/javascript">
var DR=function(f){//implementación rápida de DOMReady
    if(document.addEventListener){
        var func=function(){f();document.removeEventListener('DOMContentLoaded',func,false);}
        document.addEventListener('DOMContentLoaded',func,false);
    }else{
        function r(f){/in/.test(document.readyState)?setTimeout(function(){r(f);},9):f();};
        r(f);
    }
}
function notificar(m){
    alert(m);
}
var ns={}
DR(function(){//implementación rápida de un monitor de cambios
    ns.recordar=document.getElementById('userbar_tablecell').innerHTML;
    var inter=setInterval(
                          function(){
                              if(document.getElementById('userbar_tablecell').innerHTML!=ns.recordar){
                                  ns.recordar=document.getElementById('userbar_tablecell').innerHTML;
                                  notificar('hubo un cambio');
                              }
                           },250);
});
</script>

User avatar
derjanb
Site Admin
Posts: 2161
Joined: 20.01.06 02:16:15
Contact:

Re: Alert when Div content change

Post by derjanb » 08.03.17 10:34:06

Please check the MutationObserver documentation: https://developer.mozilla.org/en/docs/W ... mple_usage
ImageIf you like what I'm doing, please consider a donation here. Image

Post Reply

Return to “Userscripts”

Who is online

Users browsing this forum: No registered users and 1 guest