User:7/hidepatrolled.js
Appearance
< User:7
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:7/hidepatrolled. |
/* Hide edit-filter pages not yet rolled back - Adapted from [[User:Mr.Z-man/hideClosedAFD]]
Example page: http://en.wikipedia.org/w/index.php?title=Special:RecentChanges&limit=250&tagfilter=repeating+characters
Add this to your monobook.js or vector.js with the following syntax:
importScript('User:7/hidepatrolled.js');
*/
function hidePatrolledRecentChanges() {
if ((mw.config.get('wgPageName').indexOf('Special:RecentChanges') != -1)) {
mw.util.addPortletLink('p-cactions', 'javascript:hidePatrolledTags()', "hide patrolled", "ca-hidePatrolled", "Hide recent changes with no rollback tag visible (they may have alread been patrolled)");
mw.util.addPortletLink('p-cactions', 'javascript:showPatrolledTags()', "show patrolled", "ca-showPatrolled", "Show all recent changes");
hidePatrolledTags(); //hide patrolled by default - will parameterize it later
}
};
function hidePatrolledTags() {
// all rows in the recent change are tables (and TDs) with style mw-enhanced-rc
var patrolled = getElementsByClassName(document, "table", "mw-enhanced-rc");
document.getElementById('ca-hidePatrolled').style.display = 'none';
document.getElementById('ca-showPatrolled').style.display = '';
for (var i in patrolled)
{
if(patrolled[i].innerHTML.indexOf('mw-rollback-link')==-1)
patrolled[i].style.display = 'none';
}
};
function showPatrolledTags() {
var patrolled = getElementsByClassName(document, "table", "mw-enhanced-rc");
document.getElementById('ca-showPatrolled').style.display = 'none';
document.getElementById('ca-hidePatrolled').style.display = '';
for (var i in patrolled)
{
patrolled[i].style.display = '';
}
};
addOnloadHook(hidePatrolledRecentChanges);