User:Greenpickle/monobook.js: Difference between revisions
Jump to navigation
Jump to search
Greenpickle (talk | contribs) m (definitely got it this time...) |
Greenpickle (talk | contribs) No edit summary |
||
Line 12: | Line 12: | ||
Put the code on any script page you want, such as User:Name/monobook.js, | Put the code on any script page you want, such as User:Name/monobook.js, | ||
Mediawiki:Common.js, etc.. There are a few options detailed a bit lower down. | Mediawiki:Common.js, etc.. There are a few options detailed a bit lower down. | ||
You'll also need the following CSS on a style page of your choice (*.css): | |||
.rcnsthidden {display: none;} | |||
With a little knowledge, this can be modified to, for example, show all ignored | |||
edits in a different colour, or align them to the right, rather than hide them. | |||
Examples: | |||
Greyed out: | |||
.rcnsthidden {color: #aaa;} | |||
.rcnsthidden a {color: #777 !important;} | |||
Smaller font: | |||
.rcnsthidden {font-size: 0.8em;} | |||
Right-aligned: | |||
.rcnsthidden {text-align: right;} | |||
All three of the above: | |||
.rcnsthidden {text-align: right; font-size: 0.8em; color: #aaa;} | |||
.rcnsthidden a {color: #777 !important;} | |||
To-do: | To-do: | ||
- incorporate logs stuff: deletions, uploads, bans, etc. | - incorporate logs stuff: deletions, uploads, bans, etc. (separate checkbox | ||
list; created based on what's found in the currently shown RC) | |||
- make possible with enchanced (grouped) RC | - make possible with enchanced (grouped) RC | ||
- hide h4s that have no visible contents | - hide h4s that have no visible contents | ||
- extra buttons to toggle all/invert toggle | - extra buttons to toggle all/invert toggle | ||
- check for existence of indexOf, etc. before doing anything | - check for existence of indexOf, etc. before doing anything | ||
- specific page include/exclude lists (requires ns prefix; remember _s) | |||
*/ | */ | ||
Line 83: | Line 106: | ||
ns = nslist.indexOf(page); | ns = nslist.indexOf(page); | ||
if (ns == -1) ns = 0; | if (ns == -1) ns = 0; | ||
if (RCNSTList[ns]) items[j]. | if (RCNSTList[ns]) { | ||
else items[j]. | if (items[j].className.indexOf(" rcnsthidden") != -1) items[j].className = items[j].className.substring(0, items[j].className.indexOf(" rcnsthidden")); | ||
} else if (items[j].className.indexOf(" rcnsthidden") == -1) items[j].className += " rcnsthidden"; | |||
} | } | ||
} | } | ||
} | } |
Revision as of 05:33, October 11, 2009
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>'
+ '<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*
MediaWiki recent changes namespace toggler version 0.5 by Greenpickle.
Put the code on any script page you want, such as User:Name/monobook.js,
Mediawiki:Common.js, etc.. There are a few options detailed a bit lower down.
You'll also need the following CSS on a style page of your choice (*.css):
.rcnsthidden {display: none;}
With a little knowledge, this can be modified to, for example, show all ignored
edits in a different colour, or align them to the right, rather than hide them.
Examples:
Greyed out:
.rcnsthidden {color: #aaa;}
.rcnsthidden a {color: #777 !important;}
Smaller font:
.rcnsthidden {font-size: 0.8em;}
Right-aligned:
.rcnsthidden {text-align: right;}
All three of the above:
.rcnsthidden {text-align: right; font-size: 0.8em; color: #aaa;}
.rcnsthidden a {color: #777 !important;}
To-do:
- incorporate logs stuff: deletions, uploads, bans, etc. (separate checkbox
list; created based on what's found in the currently shown RC)
- make possible with enchanced (grouped) RC
- hide h4s that have no visible contents
- extra buttons to toggle all/invert toggle
- check for existence of indexOf, etc. before doing anything
- specific page include/exclude lists (requires ns prefix; remember _s)
*/
// Change this to true to make the list below an include list rather than an
// exclude list:
include = false;
// Here, default namespaces can be set; put them in '' or "" separated by
// commas, inside the []. By default, this is the excluded list:
RCNSTList = ['User', 'User talk', 'User blog', 'Blog', 'Blog talk'];
// Change these if it'll make styling easier - e.g., use ul/li and create a
// hover menu:
RCNSTbeforecheckboxes = '<span id="rcnst"><hr />\n';
RCNSTaftercheckboxes = '</span>';
RCNSTbeforecheckbox = '';
RCNSTaftercheckbox = '\n';
window.onload = function () {
if (document.body.className.indexOf("page-Special_RecentChanges") == -1) return;
choice = document.getElementById("namespace").childNodes;
nslist = [];
for (i in choice) if (choice[i].tagName == "OPTION" && choice[i].value != "") nslist[choice[i].value] = choice[i].innerHTML;
temp = RCNSTList;
RCNSTList = [];
for (i in nslist) {
if (!include && (temp.indexOf(nslist[i]) != -1)) RCNSTList[i] = false;
else if (include && (temp.indexOf(nslist[i])) == -1) RCNSTList[i] = false;
}
s = RCNSTbeforecheckboxes;
for (i in nslist) {
if (RCNSTList[i] == false) insert = '';
else insert = 'checked="checked"';
s += RCNSTbeforecheckbox + '<input type="checkbox" ' + insert + 'name="RCNST' + i + '" onclick="RCNST()" /><label for="RCNST' + i + '">' + nslist[i] + '</label>' + RCNSTaftercheckbox;
}
s += RCNSTaftercheckboxes;
document.getElementsByClassName("rcoptions")[0].innerHTML += s;
RCNST();
}
function RCNST () {
for (i in nslist) {
if (document.getElementsByName("RCNST" + i)[0].checked) RCNSTList[i] = true;
else RCNSTList[i] = false;
}
days = document.getElementsByClassName("special");
for (i in days) {
if (days[i].tagName != "UL") continue;
items = days[i].childNodes;
for (j = 0; j < items.length; j++) {
if (items[j].tagName != "LI") continue;
page = items[j].getElementsByTagName("a");
for (k in page) if (page[k].innerHTML == "hist") {
page = page[k];
break;
}
page = page.href;
page = page.substring(page.indexOf("?title=") + 7);
page = page.substring(0, page.indexOf("&curid="));
page = page.substring(0, page.indexOf(":")).replace("_", " ");
ns = nslist.indexOf(page);
if (ns == -1) ns = 0;
if (RCNSTList[ns]) {
if (items[j].className.indexOf(" rcnsthidden") != -1) items[j].className = items[j].className.substring(0, items[j].className.indexOf(" rcnsthidden"));
} else if (items[j].className.indexOf(" rcnsthidden") == -1) items[j].className += " rcnsthidden";
}
}
}