Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- var targetNode = document.querySelector("#success");
- var observerOptions = {
- childList: false,
- attributes: true,
- subtree: false //Omit or set to false to observe only changes to the parent node.
- }
- var observer = new MutationObserver(callback);
- observer.observe(targetNode, observerOptions);
- var x=0;
- function callback(mutationList, observer) {
- mutationList.forEach((mutation) => {
- switch(mutation.type) {
- case 'attributes':
- if($("#success").is(":visible")){
- while (x<1){
- !function(f,b,e,v,n,t,s)
- {if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};
- if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
- n.queue=[];t=b.createElement(e);t.async=!0;
- t.src=v;s=b.getElementsByTagName(e)[0];
- s.parentNode.insertBefore(t,s)}(window, document,'script','https://connect.facebook.net/en_US/fbevents.js');
- fbq('init', '2199870686978239');
- fbq('track', 'CompleteRegistration');
- x++;
- }
- }else{
- console.log("why you looking here?");
- }
- /* An attribute value changed on the element in
- mutation.target; the attribute name is in
- mutation.attributeName and its previous value is in
- mutation.oldValue */
- break;
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement