MediaWiki:Common.js

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

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

var dropdown = document.getElementById('tm-wantedpages'); var tmdata = $('#tm-data').data; if (!dropdown || !tmdata) { return true; }

dropdown.innerHTML = "";

var mainpage = tmdata.toplevelpage + '/'; var mainpage_uri = encodeURIComponent(mainpage); var templatetype = tmdata.template || 'work';

var nses = tmdata.nswanted.split("\t"); nses.forEach( function(ns) { 	var ns_underscore = ns.replace(" ", "_");

var li = document.createElement('li'); var link = document.createElement('a'); link.href = '/wiki/' + ns_underscore + ':' + tmdata.toplevelpage; var icon = document.createElement('span'); icon.id = "tm-" + ns_underscore;

link.appendChild(icon); link.innerHTML += ns; li.appendChild(link); dropdown.appendChild(li); });

var sp = tmdata.wanted.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 toggleSectionVisibility(fieldObj, id, txt1, txt2) { var e = document.getElementById('sectionblock'+id); if(txt1.search(/gif:/i) >= 0) txt1 = ''); if(txt2.search(/gif:/i) >= 0) txt2 = ''); if(fieldObj.innerHTML == txt1) {   fieldObj.innerHTML = txt2; e.style.display = 'block'; } else {   fieldObj.innerHTML = txt1; e.style.display = 'none'; } return false; }

/* make bullets after quotes not show up with multiple bullets */ mw.hook( 'wikipage.content' ).add( function {	$('blockquote + ul > li:first-child ul:first-child').parents('li').css('list-style', 'none'); });