Stack Overflow tab notifier user-script
Instead of this:


    var isInbox  = $(this).parent().is(".icon-inbox") ? true : false;



Since .is(...) is boolean, you can use its returned value directly without the ternary operator:

    var isInbox  = $(this).parent().is(".icon-inbox");




This else is pointless, just delete it:


    } else { }





The indentation is off in the else block, and the formatting doesn't follow common conventions:


    else if(rgx.test(title)){
        title = title.replace(rgx, "[" + txt + "] ");
    }
        else {title = "[" + txt + "] " + title;}



It would be better to write this code like this:

    else if(rgx.test(title)){
        title = title.replace(rgx, "[" + txt + "] ");
    } else {
        title = "[" + txt + "] " + title;
    }




In this code:


var rgx = (isInbox ? /\[\d+\]/ : /\[\+\d+\]/);
if (title.indexOf("•") &gt; -1) {
    rgx = isInbox ? /^(\• )\d+/ : /^(\[)+\d+/;
    title = title.replace(rgx, "$1" + txt);
}
// ...



It's misleading that rgx is first assigned to something,
then it's reassigned to something else inside the if branch.
This makes the reader look suspiciously at the code after the if statement to see if rgx is used again for something.

Looking at the code, rgx is not used again.
Which means,
you're just reusing the variable inside the if branch.
But it's not a good practice to reuse a variable for more than one purpose.
It would be better to create a new variable inside the if branch,
for example:

var rgx = (isInbox ? /\[\d+\]/ : /\[\+\d+\]/);
if (title.indexOf("•") &gt; -1) {
    var rgx2 = isInbox ? /^(\• )\d+/ : /^(\[)+\d+/;
    title = title.replace(rgx2, "$1" + txt);
}