summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js')
-rw-r--r--resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js33
1 files changed, 16 insertions, 17 deletions
diff --git a/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js b/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js
index c9e55111..f217bf59 100644
--- a/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js
+++ b/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js
@@ -3,23 +3,22 @@
*/
/* Remember the collapse state of the legend on recent changes and watchlist pages. */
-jQuery( document ).ready( function ( $ ) {
+( function ( mw, $ ) {
var
cookieName = 'changeslist-state',
- cookieOptions = {
- expires: 30,
- path: '/'
- },
- isCollapsed = $.cookie( cookieName ) === 'collapsed';
+ // Expanded by default
+ isCollapsed = mw.cookie.get( 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 );
- } );
-} );
+ $( function () {
+ $( '.mw-changeslist-legend' )
+ .makeCollapsible( {
+ collapsed: isCollapsed
+ } )
+ .on( 'beforeExpand.mw-collapsible', function () {
+ mw.cookie.set( cookieName, 'expanded' );
+ } )
+ .on( 'beforeCollapse.mw-collapsible', function () {
+ mw.cookie.set( cookieName, 'collapsed' );
+ } );
+ } );
+}( mediaWiki, jQuery ) );