MediaWiki:Monobook.js: Difference between revisions

From Halopedia, the Halo wiki

(unecessary.)
(moving stuff to Common.js)
Line 51: Line 51:
ta['ca-nstab-help'] = new Array('c','View the help page');
ta['ca-nstab-help'] = new Array('c','View the help page');
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 matches = re.exec(document.title);


if (matches && matches[1].indexOf("Editing") == -1)
if (matches && matches[1].indexOf("Editing") == -1)
Line 85: Line 82:
onPageLoad();
onPageLoad();
}
}
}
function infoboxToggle()
{
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()
{
var label = document.getElementById("wpSummaryLabel");
if(label == null)
{
return;
}
var comboString = "Standard summaries: <select id='stdSummaries' onchange='onStdSummaryChange()'>";
comboString += "</select><br />";
label.innerHTML = comboString + label.innerHTML;
var request;
try
{
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");
request.onreadystatechange = function()
{
if(request.readyState == 4)
{
var combo = document.getElementById("stdSummaries");
var lines = request.responseText.split("\n");
var i;
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>";
}
}
}
request.send(null);
}
function onStdSummaryChange()
{
var combo = document.getElementById("stdSummaries");
var value = combo.options[combo.selectedIndex].value;
if(value != "")
document.getElementById("wpSummary").value = value;
}
function fillDeleteReasons()
{
var label = document.getElementById("wpReason");
if(label == null)
{
return;
}
label = document.getElementById("contentSub");
if(label == null)
{
return;
}
var comboString = "<br /><select id='stdReasons' onchange='onStdReasonChange()'>";
comboString += "</select>";
label.innerHTML += comboString;
var request;
try
{
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");
request.onreadystatechange = function()
{
if(request.readyState == 4)
{
var combo = document.getElementById("stdReasons");
var lines = request.responseText.split("\n");
var i;
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>";
}
}
}
request.send(null);
}
function onStdReasonChange()
{
var combo = document.getElementById("stdReasons");
var value = combo.options[combo.selectedIndex].value;
if(value != "")
document.getElementById("wpReason").value = value;
}
}