MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/* Display / wanted pages without real redlinks */ $( window ).load(function { // Hilight submenus  $(".sp-menu ul li ul li:has(ul)").find("a:first").append(" &raquo;");

var dropdown = document.getElementById('tm-wantedpages'); if (!dropdown) { return true; }

var mainpage = document.getElementById('tm-toplevelpage').innerHTML + '/'; mainpage = mainpage.substr(6); var mainpage_uri = encodeURIComponent(mainpage);

var templateelem = document.getElementById('tm-templatetype'); templatetype = templateelem ? templateelem.innerHTML : 'work';

var sp = document.getElementById( 'tm-Wanted' ).innerHTML.split("\t"); sp.forEach( function(subpage) {   var sp_underscore = subpage.replace(" ", "_");    var sp_nospace = subpage.replace(" ", "");

var li = document.createElement('li'); var link = document.createElement('a'); link.href = '/w/index.php?title='+ mainpage_uri + sp_underscore + '&preload=Mediawiki:'+ sp_nospace + '&preloadparams[]=' + templatetype + '&action=edit&redlink=1';

var icon = document.createElement('span'); icon.id = "tm-" + sp_underscore; link.appendChild(icon); link.innerHTML += subpage; li.appendChild(link); dropdown.appendChild(li); });

var li = document.createElement('li'); li.innerHTML = ' ' + ' '; dropdown.appendChild(li); });

/* Section Hide folder functionality */

function toggleSection(toggleObj, id, showtext, hidetext) { var e = document.getElementById('sectionblock'+id); if(toggleObj.innerHTML == showtext) { toggleObj.innerHTML = hidetext; e.style.display = 'block'; } else { toggleObj.innerHTML = showtext; e.style.display = 'none'; }

}

function toggleAllSections(toggleObj, showtext, hidetext, showall, hideall) { if (toggleObj.innerHTML == hideall) { $( ".hidelink" ).each( function (i, val) {     if (val.innerHTML == hidetext) {        val.onclick;      }    }); toggleObj.innerHTML = showall; } else { $( ".hidelink" ).each( function (i, val) {     if (val.innerHTML == showtext) {        val.onclick;      }    }); toggleObj.innerHTML = hideall; } }

/* make bullets after quotes not show up with multiple bullets */ $( window ).load( function {	$('li ul:first-child').parents('li').each( function (elem) { this.style.listStyle = "none" }); });