User:Gary/custom long pages.js

/*

CUSTOM LONG PAGES

Description: Adds options for Special:LongPages, such as the ability to hide articles that begin with "List of".

  • /

if (typeof(unsafeWindow) != 'undefined')

{

mw = unsafeWindow.mw;

}

$(customLongPages);

function customLongPages()

{

var jumpToNav = $('#jump-to-nav');

if (mw.config.get('wgPageName') != 'Special:LongPages' || !jumpToNav.length) return false;

var newNode = $('

Options: Show / hide lists

');

jumpToNav.after(newNode);

if (location.href.indexOf('hide=lists') == -1) return false;

var hiddenArticles = 0;

$('.special').eq(0).children().each(function()

{

var article = $(this);

if (article[0].nodeType != 1) return true;

if (article.children().eq(1).text().indexOf('List of') == 0)

{

article.css('display', 'none');

hiddenArticles++;

}

});

$('.mw-spcontent').eq(0).children().first().children().first().append(' (' + hiddenArticles + ' hidden' + ')');

}