9

Install it on userscripts here


The posts of the person who asked the question are highlighted in blue, so why can't our own posts be highlighted? It makes finding my stuff much easier. Highlights anything that links to your user-profile (comments, answers, etc.)

any and all feedback or suggestions welcome!

source:

// ==UserScript==
// @name           Highlight your username on SOFU
// @namespace      CrazyJugglerDrummer
// @description    highlights wherever your username appears on the page
// @include        http://stackoverflow.com/*
// @include        http://superuser.com/*
// @include        http://serverfault.com/*
// @include        http://meta.stackoverflow.com/*
// ==/UserScript==

var userLink = document.getElementById("hlinks-user").getElementsByTagName("a")[1].href;

var links = document.getElementsByTagName("a");

for (var x=0; x<links.length; x++) {
    if ( links[x].href == userLink ) {
        links[x].style.color = "#f00"; 
        links[x].style.backgroundColor="#fcc";
    }
}
4
  • 1
    Nice. My Question Dashboard meta.stackexchange.com/questions/31486/… script may be a nice compliment to yours - one feature, among others, is the indicator "Me" which appears if an Answer, Question or Comment of yours exists on the current page. Commented Jan 8, 2010 at 7:15
  • 8
    can this please be moved to stackapps.com/?tab=scripts as necessary? Or flag for deletion. Commented Jul 31, 2011 at 22:53
  • Just one change; var userLink = document.getElementById("hlinks-user").getElementsByTagName("a")[1].href; highlights reputation. Changing the 1 to a 0, though, highlights the username. Cheers! Commented Oct 4, 2013 at 20:15
  • 1
    This is now implemented by default but +1 for the actual idea! Unfortunately though this is now off-topic; it would belong on StackApps, but it being natively supported means it wouldn't be too useful anymore! :) I've voted to close as off-topic. Commented Aug 5, 2015 at 17:51

2 Answers 2

2

I love this idea.

I submitted it as a feature-request a few months ago: Highlight our own comments, too.

Vote it up. I would love to see it implemented natively.

2

+1 for the script and for the request to implement this natively :)

It apparently doesn't work anymore (hlinks-user doesn't exist anymore).

I have modified the script as follows (it highlights the whole post/comment, only tested in Chrome)

// ==UserScript==
// @name           Highlight your username on SOFU
// @namespace      CrazyJugglerDrummer
// @description    highlights wherever your username appears on the page
// @include        http://stackoverflow.com/*
// @include        http://superuser.com/*
// @include        http://serverfault.com/*
// @include        http://meta.stackoverflow.com/*
// @require        https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// ==/UserScript==

// The main content of this userscript
function main() {
    var HighlightUserPosts = function(){
        jQ("a[href='"+userLink+"']").each(function(){
          jQ(jQ(this).parents('tr.comment, div.question > table > tbody > tr, div.answer > table > tbody > tr')[0]).css('background-color','#efe');
        });
    }

    var userLink = jQ('a.profile-me').attr('href');
    HighlightUserPosts();
    setTimeout(HighlightUserPosts, 2500); // Fire again after SOFU's highlight fades away
}

// Load jQuery and execute the main function
window.jQ = jQuery.noConflict(true);
main();

Not the answer you're looking for? Browse other questions tagged .