MediaWiki:KillChatEmoticons/code.js

/* KillChatEmoticons (w:c:dev:KillChatEmoticons) * * Forces emoticons to display their alt attribute instead of the actual image. * Personal use only * @author Dorumin */

(function {   if (wgCanonicalSpecialPageName != 'Chat' || !window.mainRoom) return;    // Kill emoticons that were in chat before loading.    var oldEmotes = Array.prototype.slice.call(document.querySelectorAll('.Chat .message img'));    oldEmotes.forEach(function(el) { el.removeAttribute('src'); });   // Remove the emoticons right after they are added.    mainRoom.model.chats.bind('afteradd', function(child) { var el = document.getElementById('entry-' + child.cid); if (!el) return; var msg = el.getElementsByClassName('message')[0]; if (!msg) return; var imgs = Array.prototype.slice.call(el.getElementsByTagName('img')); if (!imgs) return; imgs.forEach(function(img) {           img.removeAttribute('src');        }); }); });