User:PleaseStand/highlight-comments.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | This user script seems to have a documentation page at User:PleaseStand/highlight-comments. |
//<pre><nowiki>
// highlight-comments.js - written by PleaseStand, 2010.
// Source: http://en.wikipedia.org/wiki/User:PleaseStand/highlight-comments.js
// NOTE: This script is in the public domain (not copyrighted). For details, see
// http://en.wikipedia.org/wiki/Template:PD-self
// DESCRIPTION: Highlights your posts to discussion pages
// (at least a significant part). This is just the JS part; you need a
// corresponding CSS line to actually affect text color. An example:
// .mycomment { background: #ff9; }
/*global jQuery, addOnloadHook, wgFormattedNamespaces, wgUserName*/
addOnloadHook(function(){
// List the tags in decreasing order of specificity!
var tags = ["li", "dd", "p"];
for(var x = 0; x < tags.length; x++) {
jQuery(tags[x] + ":has(a[title=" + wgFormattedNamespaces[2] + ":" +
wgUserName + "])").not(":has(.mycomment)").addClass("mycomment");
}
});
//</nowiki></pre>