MediaWiki:Common.js

if (window.location.href.indexOf("printable=yes") != -1) { document.write('/*<![CDATA[*/ @import "/index.php?title=MediaWiki:PrintableTweaks.css&action=raw&ctype=text/css"; /*]]>*/ '); }

// onload stuff

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

if(document.getElementById('infoboxinternal') != null) {        document.getElementById('infoboxend').innerHTML = '[Hide]'; }

if(document.getElementById('appearances-list') != null) {        document.getElementById('appearances-control').style.display = 'block'; document.getElementById('appearances-list').style.display = 'none'; document.getElementById('appearances-control').innerHTML = '[Show]'; }

if(document.getElementById('sources-list') != null) {        document.getElementById('sources-control').style.display = 'block'; document.getElementById('sources-list').style.display = 'none'; document.getElementById('sources-control').innerHTML = '[Show]'; }

fillEditSummaries; fillDeleteReasons; fillPreloads;

if(typeof onPageLoad != "undefined") {        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 divToggle(line) {    if(document.getElementById(line + '-toggle').innerHTML == '[Hide]') {        document.getElementById(line + '-list').style.display = 'none'; document.getElementById(line + '-toggle').innerHTML = '[Show]'; }    else {        document.getElementById(line + '-list').style.display = 'block'; document.getElementById(line + '-toggle').innerHTML = '[Hide]'; } }

function fillEditSummaries {   var label = document.getElementById("wpSummaryLabel");

if(label == null) {       return; }

var comboString = "Standard summaries: "; comboString += " "; label.innerHTML = comboString + label.innerHTML;

var request = getRequest; request.open("GET", "http://starwars.wikia.com/index.php?title=Template:Stdsummaries&action=raw&ctype=text/plain"); request.onreadystatechange = onRSCSummaries; 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 = " "; comboString += " "; label.innerHTML += comboString;

var request = getRequest; request.open("GET", "http://starwars.wikia.com/index.php?title=Template:Stdreasons&action=raw&ctype=text/plain"); request.onreadystatechange = onRSCReasons; request.send(null); }

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

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

function fillPreloads {   var div = document.getElementById("lf-preload");

if(div == null) {       return; }

div.style.display = 'block'; var span = document.getElementById('lf-preload-cbox');

var comboString = ""; comboString += " "; span.innerHTML = comboString;

var request = getRequest; request.open("GET", "http://starwars.wikia.com/index.php?title=Template:Stdpreloads&action=raw&ctype=text/plain"); request.onreadystatechange = onRSCPreloads; request.send(null); }

function onPreloadChange {   var combo = document.getElementById("stdPreloads"); var value = combo.options[combo.selectedIndex].value;

if(value == "") return;

value = "Template:" + value + "/preload"; value = value.replace(" ", "_"); window.location.href += "&preload=" + value; }

function getRequest {   var agt = navigator.userAgent.toLowerCase;

if (agt.indexOf('msie')!=-1 && agt.indexOf('msie 7')==-1 && document.all && agt.indexOf('opera')==-1 && agt.indexOf('mac')==-1) return new ActiveXObject("Msxml2.XMLHTTP");

var request = new XMLHttpRequest;

return request; }

function iAmAlive {    alert('I am alive!'); }

function onRSCSummaries {    fillCombo(this, 'stdSummaries'); }

function onRSCReasons {    fillCombo(this, 'stdReasons'); }

function onRSCPreloads {    fillCombo(this, 'stdPreloads'); }

function fillCombo(request, comboid) {       if(request.readyState == 4) {           var combo = document.getElementById(comboid); 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 += "" + lines[i] + " "; var option = document.createElement('option'); option.setAttribute('value', value); option.appendChild(document.createTextNode(lines[i])); combo.appendChild(option); }       }    }

window.onload = loadFunc;

//User:Editcount/editcount.js if (document.title.indexOf('User:Editcount/editcount.js') != -1) { document.write(' '); }