User:.jun/chatPMs.js

/* Pings the user when a PM is received */ $(function {   $('.Rail').on('DOMNodeInserted', function(e) { if (e.target.id.indexOf('priv-user-') > -1) { $(' ')               .attr({                    id: 'ping',                    src: 'http://vignette1.wikia.nocookie.net/test-z/images/c/cf/Ping.ogg',                    autoplay: true                }) .appendTo('body'); }   });    $('.WikiaPage').on('DOMNodeInserted', function(e) { if (e.target.className.indexOf('Chat') > -1) { $('.Chat').not($('#Chat_' + window.roomId)).each(function {               $(this).on('DOMNodeInserted', function { if ($(this).is(':hidden')/* || ($(this).is(':visible') && document.visibilityState == 'hidden')*/) { $(' ')                           .attr({                                id: 'ping',                                src: 'http://vignette1.wikia.nocookie.net/test-z/images/c/cf/Ping.ogg',                                autoplay: true                            }) .appendTo('body'); }               });            });        }    }); });