User:Invitatious/scripts/highlightsig

From OpenWetWare
Revision as of 14:33, 26 July 2009 by Bill Flanagan (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

How to highlight your comment

Using a combination of a modified signature, simple CSS, and clever JavaScript code, it is possible to highlight your signature or comment.

Limitations of this script

These scripts can currently only highlight modified signatures, and also only the last paragraph of the comment. If you are an experienced user script coder and have created a solution to this problem, please let me know on my talk page.

Modified signature

You will need to modify any signature you want to contrast. Go to your preferences page, turn on "raw signature", and enter your signature in the nickname field. Surround it in these tags, replacing SIGNATURE-HERE with your signature: <source lang=javascript>SIGNATURE-HERE</source> For example, my signature is <span class="sigInvitatious">[[User:Invitatious|Invitatious]] ([[User talk:Invitatious|talk]])</span> . It shows as Invitatious (talk) 17:09, 18 July 2006 (UTC) to another user, and Invitatious (talk) 17:09, 18 July 2006 (UTC) to me. If you like it, be sure to replace "Invitatious" with your username. Save the user preferences.

User CSS

Insert the following line (replacing "Invitatious" with your username) into your user CSS file (link only for monobook). <source lang=javascript>.sigInvitatious, .commentInvitatious {background-color: gold;} /* Highlight my signature */</source> You can change the color of the signature (specified by the word gold) at any time and it will have a retroactive effect back to the first modified signature you used. The color is a standard word defined at Web colors#X11 color names, or it can be a RGB color in either the hex format #RRGGBB or the decimal format rgb(r,g,b). After performing a hard reload (CTRL-F5), at this point, if you sign with the modified signature, the signature (but not the whole comment) should show highlighted in gold (or whatever other color you chose). Another note: this is not just limited to color, you could even make your signature blink if you wanted to!

User JS

Although the CSS has been installed, the entire comment will not be highlighted unless you also install the script. Open the user JS file (link only for monobook). Insert the text from User:Invitatious/highlightsig.js, replacing "Invitatious" with your username. Save and do another hard reload, and your entire comment should be highlighted! (Or at least the last paragraph.)

Date modification

This is not complete. If you're an experienced coder, you are encouraged to help.

Maybe use a more complex script to change the background color of the style?

Other ideas for modification

This is not complete. If you're an experienced coder, you are encouraged to help.

If you have any other ideas, list them here. I would appreciate your solutions to these problems.