User:DavidHOzAu/citefix/code.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. |
Documentation for this user script can be added at User:DavidHOzAu/citefix/code. This user script seems to have an accompanying .css page at User:DavidHOzAu/citefix/code.css. |
/* <pre> */
function MyCitation()
{
// iterate over all <sup>-elements
for(var i=0; a = document.getElementsByTagName("sup")[i]; i++) {
// if found a citation thag
if(a.getAttribute("title")=="Needs citation" || a.getAttribute("class")=="uncited") {
// 1) fix style -- a wider-scope fix can be found at the corresponding CSS page.
//a.style.verticalAlign = 'top'; // absolutely required for the image.
a.style.textDecoration = 'blink'; // another alternative
// 2) replace it with whatever I want. ** Note: Uncomment one of the following, or roll your own. **
// 2.1) Image
//a.innerHTML = '<span style="padding: 0; margin: 0;"><a href="/wiki/Wikipedia:Cite_sources" title="Citation needed"><img src="http://upload.wikimedia.org/wikipedia/en/4/4a/Citation_needed.gif" alt="Citation needed" width="38" height="11" border="0"/></a></span>';
// 2.2) Shorter text
a.innerHTML = '[<a href="/wiki/Wikipedia:Cite_sources" title="Citation needed">CITE</a>]';
}
}
}
addOnloadHook(MyCitation);
/* </pre> */