1 var checkboxShift
= require( './checkboxShift.js' );
2 mw
.hook( 'wikipage.content' ).add( function ( $content
) {
3 var $sortable
, $collapsible
;
5 $collapsible
= $content
.find( '.mw-collapsible' );
6 if ( $collapsible
.length
) {
7 // Preloaded by Skin::getDefaultModules()
8 mw
.loader
.using( 'jquery.makeCollapsible', function () {
9 $collapsible
.makeCollapsible();
13 $sortable
= $content
.find( 'table.sortable' );
14 if ( $sortable
.length
) {
15 // Preloaded by Skin::getDefaultModules()
16 mw
.loader
.using( 'jquery.tablesorter', function () {
17 $sortable
.tablesorter();
21 checkboxShift( $content
.find( 'input[type="checkbox"]:not(.noshiftselect)' ) );
24 // Things outside the wikipage content
28 // Add accesskey hints to the tooltips
29 $( '[accesskey]' ).updateTooltipAccessKeys();
31 $nodes
= $( '.catlinks[data-mw="interface"]' );
32 if ( $nodes
.length
) {
34 * Fired when categories are being added to the DOM
36 * It is encouraged to fire it before the main DOM is changed (when $content
37 * is still detached). However, this order is not defined either way, so you
38 * should only rely on $content itself.
40 * This includes the ready event on a page load (including post-edit loads)
41 * and when content has been previewed with LivePreview.
43 * @event wikipage_categories
45 * @param {jQuery} $content The most appropriate element containing the content,
48 mw
.hook( 'wikipage.categories' ).fire( $nodes
);
51 $( '#t-print a' ).on( 'click', function ( e
) {
56 // Turn logout to a POST action
57 $( '#pt-logout a' ).on( 'click', function ( e
) {
58 var api
= new mw
.Api(),
59 returnUrl
= $( '#pt-logout a' ).attr( 'href' );
61 mw
.message( 'logging-out-notify' ),
62 { tag
: 'logout', autoHide
: false }
64 api
.postWithToken( 'csrf', {
68 location
.href
= returnUrl
;
72 mw
.message( 'logout-failed', e
),
73 { type
: 'error', tag
: 'logout', autoHide
: false }