summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js
blob: c9e55111ffa57a183b93325d51c7894979baace8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*!
 * Script for changes list legend
 */

/* Remember the collapse state of the legend on recent changes and watchlist pages. */
jQuery( document ).ready( function ( $ ) {
	var
		cookieName = 'changeslist-state',
		cookieOptions = {
			expires: 30,
			path: '/'
		},
		isCollapsed = $.cookie( cookieName ) === 'collapsed';

	$( '.mw-changeslist-legend' )
		.makeCollapsible( {
			collapsed: isCollapsed
		} )
		.on( 'beforeExpand.mw-collapsible', function () {
			$.cookie( cookieName, 'expanded', cookieOptions );
		} )
		.on( 'beforeCollapse.mw-collapsible', function () {
			$.cookie( cookieName, 'collapsed', cookieOptions );
		} );
} );