MediaWiki:Common.js

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

function importScriptPage (page, server) { var url = '/index.php?title=' + encodeURIComponent(page.replace(/ /g,'_')).replace('%2F','/').replace('%3A',':') + '&action=raw&ctype=text/javascript'; if (typeof server == "string") url = (server.indexOf('://') == -1)?'http://' + server + '.wikia.com' + url:server + url; return importScriptURI(url); }

importScriptPage('ShowHide/code.js', 'dev');

/*Collapsible tables by User:HaLo2FrEeEk. Append 'class="collapsible"' to a table. :)*/ $('table.collapsible').each(function(e) { var $t = $(this); var $th = $t.find('th'); var hs = ($t.hasClass('collapsed')) ? 'show' : 'hide'; $th.append("[" + hs + "] "); if($t.hasClass('collapsed')) { $t.find('td').parent.hide; } }); $('.collapseLink > a').click(function(e) { e.preventDefault; collapseTable($(this)); }); collapseTable = function (e) { $t = e.closest('table');  $elems = $t.find('td').parent;  if($t.hasClass('collapsed')) {    $elems.show('fast');    $t.removeClass('collapsed');    e.html('hide');    } else {    $elems.hide('fast');    $t.addClass('collapsed');    e.html('show');    }  }