User:Ace Shadow/monobook.js
From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
//Recent changes highlighting
//<nowiki>
function recentChangesHighlights() {
if (wgPageName == 'Special:RecentChanges') {
var targetContent = document.getElementById('bodyContent');
var rows = targetContent.getElementsByTagName ("li");
for (var l = 0; l < rows.length; l++) {
liHTML = rows[l].innerHTML
liText = rows[l].textContent;
if (liHTML.indexOf('/wiki/Special:Log/') != -1) {
rows[l].style.backgroundColor = '#DDF';
}
if (liHTML.indexOf('/wiki/Special:Log/block') != -1 || liHTML.indexOf('/wiki/Special:Log/delete') != -1) {
rows[l].style.backgroundColor = '#FEE';
}
if (liHTML.indexOf('class="newpage"') != -1) {
rows[l].style.backgroundColor = '#DFD';
}
if (liText.indexOf('Blanked the page') != -1 || liHTML.indexOf('<strong class="mw-plusminus-neg">') != -1) {
rows[l].style.backgroundColor = '#FAA';
}
}
}
}
YAHOO.util.Event.onDOMReady(recentChangesHighlights);
//Short newpages highlighting
function highlightShortNewpages () {
if (wgPageName == 'Special:Newpages') {
var targetContent = document.getElementById('bodyContent');
var links = targetContent.getElementsByTagName ("li");
for (var l = 0; l < links.length; l++) {
liContent = links[l].textContent;
sizeText = liContent.substring(liContent.indexOf('[')+1,liContent.indexOf('bytes]'));
sizeBytes = sizeText.replace(',', '');
if (sizeBytes > 10000) {
links[l].style.backgroundColor = 'yellow';
}
if (sizeBytes < 1500) {
links[l].style.backgroundColor = '#fdd';
}
if (sizeBytes < 1000) {
links[l].style.backgroundColor = '#fbb';
}
if (sizeBytes < 100) {
links[l].style.backgroundColor = '#f44';
}
}
}
}
YAHOO.util.Event.onDOMReady(highlightShortNewpages);