User:Nathan/monobook.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. |
![]() | The accompanying .css page for this skin is at User:Nathan/monobook.css. |
importScript('User:Mr.Z-man/rollbackSummary.js');
importScript('User:Voice_of_All/Addtabs/monobook.js');
importScript('User:Misza13/statusChanger.js');
importScript('User:AzaToth/twinkle.js');
importScript('User:Ioeth/friendly.js');
// [[User:Henrik/live-edit-counter]]
importScript('User:Henrik/js/live-edit-counter.js');
// Magnus Manske's extension to separate templates and end stuff from the main text of an article
// importScript('User:Magnus Manske/less edit clutter.js')
//<pre><nowiki>
importScript('User:Voice of All/Addtabs/monobook.js');
var WindowObjectReference;
function openTab(url) {
WindowObjectReference = window.open(url, "_blank", "");
}
// -----------------------------------------------------------------
// Script for collapsing sections on WP:ANI.
// -----------------------------------------------------------------
if (mw.config.get('wgPageName') == "Wikipedia:Administrators\'_noticeboard/Incidents" && mw.config.get('wgAction') == "view") {
addOnloadHook(function ani_sections() {
var headers = document.getElementsByTagName('H2');
for(var i=1;i<headers.length;i++) {
// starting from 1, to skip the toc header.
var section = document.createElement("DIV");
section.className = "sectionContainer";
var anchor = headers[i].previousSibling;
while(anchor.nodeType != 1) anchor = anchor.previousSibling;
headers[i].parentNode.insertBefore(section,headers[i]);
section.appendChild(anchor);
section.appendChild(headers[i]);
var innerSection = document.createElement("DIV");
innerSection.className = "sectionContentHolder";
section.appendChild(innerSection);
while(section.nextSibling && section.nextSibling.tagName != 'H2' && section.nextSibling.id != 'catlinks') {
// look ahead
var anchorcheck = section.nextSibling.nextSibling;
while(anchorcheck && anchorcheck.nodeType!=1) anchorcheck = anchorcheck.nextSibling;
if(anchorcheck && anchorcheck.tagName == 'H2') break;
innerSection.appendChild(section.nextSibling);
}
var ntimestamps = 0;
// evil evil hack
var lastTimestamp = new Date(0);
var lastTimestampText = '(No Timestamp)';
var txt = innerSection.textContent || innerSection.innerText;
txt.replace(/[0-9][0-9]:[0-9][0-9], [0-3]?[0-9] [A-Z][a-z]* [0-9][0-9][0-9][0-9]/g,function(match) {
var thisTimestamp = new Date(match);
if(thisTimestamp.valueOf() > lastTimestamp.valueOf()) {
lastTimestamp = thisTimestamp;
lastTimestampText = match;
}
ntimestamps++;
});
// was done incorrrectly in local time, convert from UTC
lastTimestamp.setMinutes(
lastTimestamp.getMinutes()-lastTimestamp.getTimezoneOffset()
);
var age = (new Date()).getTime() - lastTimestamp.getTime();
var hideDefault = false;
if (age > 21600000) // 6 hours
hideDefault = true;
if(txt.length < 600) // bytes
hideDefault = false;
if(ntimestamps < 2) // unanswered
hideDefault = false;
// hide if resolved, also, place the resolved header in the visible part.
var resolved = getElementsByClassName(innerSection,'DIV','resolved');
if(resolved.length) {
resolved = resolved[0];
// [1] to skip an annoying whitespace node
if (resolved != innerSection.firstChild && resolved != innerSection.childNodes[1]) resolved = resolved.cloneNode(true);
section.insertBefore(resolved,innerSection);
hideDefault = true;
}
section.insertBefore(document.createTextNode('Last: ' + lastTimestampText + ". "),innerSection);
section.insertBefore(document.createTextNode(txt.length + " text bytes."),innerSection);
section.insertBefore(document.createTextNode(ntimestamps + " comments. "),innerSection);
(function ani_sections_closure(){
var header = headers[i];
var innerSectionFix = innerSection;
var button = document.createElement('BUTTON');
if(hideDefault)
if(typeof(button.textContent) != 'undefined')
button.textContent = 'show';
else button.innerText = 'show';
else
if(typeof(button.textContent) != 'undefined')
button.textContent = 'hide';
else button.innerText = 'hide';
button.onclick = function ani_sections_onclick() {
if(innerSectionFix.style.display == 'none') {
innerSectionFix.style.display = 'block';
if(typeof(button.textContent) != 'undefined')
button.textContent = 'show';
else button.innerText = 'show'; }
else {
innerSectionFix.style.display = 'none';
if(typeof(button.textContent) != 'undefined')
button.textContent = 'show';
else button.innerText = 'show'; }
}
header.insertBefore(button,header.firstChild);
button.style.cssText='float: right';
if(hideDefault) innerSection.style.display='none';
})();
}
});
}
mw.loader.load('//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.js&action=raw&ctype=text/javascript')
importScript('User:M/reword.js');
importScript('User:Tim Song/spihelper.js');