MediaWiki:Monobook.js: Difference between revisions

From Halopedia, the Halo wiki

(Reverting - some JS-controlled features are not working any more)
(Relentless, there was no need to make it look like s*** in the process of re-fixing things. Also, I'm workin' on it! Just gimme some time--I can't do these things in liek two minuteslol...)
Line 1: Line 1:
/* <pre><nowiki> */
/* tooltips and access keys */
/* tooltips and access keys */
ta = new Object();
ta = new Object();
Line 50: Line 52:
ta['ca-nstab-category'] = new Array('c','View the category page');
ta['ca-nstab-category'] = new Array('c','View the category page');


var re = RegExp("(.*) - Halopedia, the Halo Wiki");
var re = RegExp("(.*) - Halopedia, the Halo Wiki");
var matches = re.exec(document.title);
var matches = re.exec(document.title);
 
if (matches && matches[1].indexOf("Editing") == -1) {
    skinName = matches[1];
    document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=' + skinName + '/monobook.css' + '&action=raw&ctype=text/css"; /*]]>*/</style>');
    document.write('<script type="text/javascript" src="/index.php?title=MediaWiki:Skin/' + skinName + '/monobook.js' + '&action=raw&ctype=text/javascript"></script>');
    }
 
if (window.location.href.indexOf("printable=yes") != -1) {
    document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=MediaWiki:PrintableTweaks.css&action=raw&ctype=text/css"; /*]]>*/</style>');
}


// onload stuff
if (matches && matches[1].indexOf("Editing") == -1)
{
skinName = matches[1];
document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=' + skinName + '/monobook.css' + '&action=raw&ctype=text/css"; /*]]>*/</style>');
document.write('<script type="text/javascript" src="/index.php?title=MediaWiki:Skin/' + skinName + '/monobook.js' + '&action=raw&ctype=text/javascript"></script>');
}


function loadFunc()
if (window.location.href.indexOf("printable=yes") != -1)
{
{
    document.getElementById('searchform').getElementsByTagName('a')[0].href = "http://halo.wikia.com/index.php?title=Special:Search&adv=1";
document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=MediaWiki:PrintableTweaks.css&action=raw&ctype=text/css"; /*]]>*/</style>');
}


    if(document.getElementById('infoboxinternal') != null)
// onload stuff
    {
        document.getElementById('infoboxend').innerHTML = '<a id="infoboxtoggle" href="javascript:infoboxToggle()">[Hide]</a>';
    }


    fillEditSummaries();
function loadFunc()
    fillDeleteReasons();
{
document.getElementById('searchform').getElementsByTagName('a')[0].href = "http://halo.wikia.com/index.php?title=Special:Search&adv=1";


    if(typeof onPageLoad != "undefined")
if(document.getElementById('infoboxinternal') != null)
    {
{
        onPageLoad();
document.getElementById('infoboxend').innerHTML = '<a id="infoboxtoggle" href="javascript:infoboxToggle()">[Hide]</a>';
    }
}
}


function infoboxToggle()
fillEditSummaries();
{
fillDeleteReasons();
    if(document.getElementById('infoboxtoggle').innerHTML == '[Hide]')
    {
        document.getElementById('infoboxinternal').style.display = 'none';
        document.getElementById('infoboxtoggle').innerHTML = '[Show]';
    }
    else
    {
        document.getElementById('infoboxinternal').style.display = 'block';
        document.getElementById('infoboxtoggle').innerHTML = '[Hide]';
    }
}


function fillEditSummaries()
if(typeof onPageLoad != "undefined")
{
{
    var label = document.getElementById("wpSummaryLabel");
onPageLoad();
}
}


    if(label == null)
function infoboxToggle()
    {
{
        return;
if(document.getElementById('infoboxtoggle').innerHTML == '[Hide]')
    }
{
document.getElementById('infoboxinternal').style.display = 'none';
document.getElementById('infoboxtoggle').innerHTML = '[Show]';
}
else
{
document.getElementById('infoboxinternal').style.display = 'block';
document.getElementById('infoboxtoggle').innerHTML = '[Hide]';
}
}


    var comboString = "Standard summaries: <select id='stdSummaries' onchange='onStdSummaryChange()'>";
function fillEditSummaries()
    comboString += "</select><br />";
{
    label.innerHTML = comboString + label.innerHTML;
var label = document.getElementById("wpSummaryLabel");
if(label == null)
{
return;
}


    var request;
var comboString = "Standard summaries: <select id='stdSummaries' onchange='onStdSummaryChange()'>";
comboString += "</select><br />";
label.innerHTML = comboString + label.innerHTML;


    try
var request;
    {
        request = new XMLHttpRequest();
    }
    catch(e)
    {
        request = new ActiveXObject("Msxml2.XMLHTTP");
    }


    request.open("GET", "http://halo.wikia.com/index.php?title=Template:Stdsummaries&action=raw&ctype=text/plain");
try
{
request = new XMLHttpRequest();
}
catch(e)
{
request = new ActiveXObject("Msxml2.XMLHTTP");
}


    request.onreadystatechange = function()
request.open("GET", "http://halo.wikia.com/index.php?title=Template:Stdsummaries&action=raw&ctype=text/plain");
    {
        if(request.readyState == 4)
        {
            var combo = document.getElementById("stdSummaries");
            var lines = request.responseText.split("\n");
            var i;


            for(i = 0; i < lines.length; i++)
request.onreadystatechange = function()
            {
{
                var value = lines[i].indexOf("-- ") == 0 ? lines[i].substring(3) : "";
if(request.readyState == 4)
                combo.innerHTML += "<option value='" + value + "'>" + lines[i] + "</option>";
{
            }
var combo = document.getElementById("stdSummaries");
        }
var lines = request.responseText.split("\n");
    }
var i;


    request.send(null);
for(i = 0; i < lines.length; i++)
}
{
var value = lines[i].indexOf("-- ") == 0 ? lines[i].substring(3) : "";
combo.innerHTML += "<option value='" + value + "'>" + lines[i] + "</option>";
}
}
}


function onStdSummaryChange()
request.send(null);
{
}
    var combo = document.getElementById("stdSummaries");
    var value = combo.options[combo.selectedIndex].value;


    if(value != "")
function onStdSummaryChange()
        document.getElementById("wpSummary").value = value;
{
}
var combo = document.getElementById("stdSummaries");
var value = combo.options[combo.selectedIndex].value;


function fillDeleteReasons()
if(value != "")
{
document.getElementById("wpSummary").value = value;
    var label = document.getElementById("wpReason");
}


    if(label == null)
function fillDeleteReasons()
    {
{
        return;
var label = document.getElementById("wpReason");
    }


    label = document.getElementById("contentSub");
if(label == null)
{
return;
}


    if(label == null)
label = document.getElementById("contentSub");
    {
        return;
    }


    var comboString = "<br /><select id='stdReasons' onchange='onStdReasonChange()'>";
if(label == null)
    comboString += "</select>";
{
    label.innerHTML += comboString;
return;
}


    var request;
var comboString = "<br /><select id='stdReasons' onchange='onStdReasonChange()'>";
comboString += "</select>";
label.innerHTML += comboString;


    try
var request;
    {
        request = new XMLHttpRequest();
    }
    catch(e)
    {
        request = new ActiveXObject("Msxml2.XMLHTTP");
    }


    request.open("GET", "http://halo.wikia.com/index.php?title=Template:Stdsummaries&action=raw&ctype=text/plain");
try
{
request = new XMLHttpRequest();
}


    request.onreadystatechange = function()
catch(e)
    {
{
        if(request.readyState == 4)
request = new ActiveXObject("Msxml2.XMLHTTP");
        {
}
            var combo = document.getElementById("stdReasons");
            var lines = request.responseText.split("\n");
            var i;


            for(i = 0; i < lines.length; i++)
request.open("GET", "http://halo.wikia.com/index.php?title=Template:Stdsummaries&action=raw&ctype=text/plain");
            {
                var value = lines[i].indexOf("-- ") == 0 ? lines[i].substring(3) : "";
                combo.innerHTML += "<option value='" + value + "'>" + lines[i] + "</option>";
            }
        }
    }


    request.send(null);
request.onreadystatechange = function()
}
{
if(request.readyState == 4)
{
var combo = document.getElementById("stdReasons");
var lines = request.responseText.split("\n");
var i;


function onStdReasonChange()
for(i = 0; i < lines.length; i++)
{
{
    var combo = document.getElementById("stdReasons");
var value = lines[i].indexOf("-- ") == 0 ? lines[i].substring(3) : "";
    var value = combo.options[combo.selectedIndex].value;
combo.innerHTML += "<option value='" + value + "'>" + lines[i] + "</option>";
}
}
}


    if(value != "")
request.send(null);
        document.getElementById("wpReason").value = value;
}
}


window.onload = loadFunc;
function onStdReasonChange()
{
var combo = document.getElementById("stdReasons");
var value = combo.options[combo.selectedIndex].value;


if(value != "")
document.getElementById("wpReason").value = value;
}
}