// ==UserScript== // @name So Do Me // @namespace http://shog9.com/greasemonkey/scripts // @description Attractive display for comments prefixed with /me on SO Chat // @version 1.1 // @include http://chat.meta.stackoverflow.com/rooms/* // ==/UserScript== var script = document.createElement("script"); script.textContent = "(" + grease.toString() + ")()"; document.body.appendChild(script); function grease() { var meRe = /^\/me .*$/; var doMe = function () { $('div.message').each(function () { var c = $(this).find('div.content'); if (c.length && meRe.test(c[0].innerHTML)) { var a = c[0].innerHTML.substr(3); var uc = c.parents('div.user-container'); if ( uc.find(".message").length > 1 ) { c.remove(); uc = $('
') .append(uc.find("div.signature").clone()) .append('
' + a + '
') .insertAfter(uc); } else { c.parents(".message").unwrap().html(a); } uc.css("font-style", "italic") .find('div.signature') .children(".avatar,.username,.flair") .hide().end() .find(".tiny-signature") .css("padding",0) .show() .find(".avatar") .hide(); } }) }; window.setInterval(doMe, 500); }