Snippets

This page is for useful jQuery snippets.

Special:WhatLinksHere history link
Description: Adds a "hist" link to Special:WhatLinksHere.

External links in Sidebar in new window
Description: Open external links in the Sidebar in a new window by adding target="_blank" to them.

Hide prefix in Special:PrefixIndex
Description: Adds a checkbox to the form on Special:PrefixIndex. When the form is submitted with this checkbox ticked, the prefix value will be hidden in the output (see also 27131).

Make watchlist options collapsible
Description: Drupal comes with a nice feature of collapsible fieldsets which helps to un-clutter setting pages (see http://drupal.org/node/321779). Here's the code adapted for MediaWiki's watchlist options. Further enhancements could use a cookie to remember the user's preferences and settings from the last session.

Show Main Page in the tab of the main page
Description: On the main page (and its associated namespaces and actions (Talk, edit, history etc.) this script will put "Main Page" instead of "Article" or "Page" in the first tab. Requires 1.17. Works in both Vector and Monobook.

How to use
You can use these snippets in extensions, existing scripts and any other place where jQuery is available and the page is ready for javascript manipulation.

MediaWiki:Common.js
You can use the following frame for snippets if you use MediaWiki:Common.js