diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js')
-rw-r--r-- | resources/src/mediawiki.special/mediawiki.special.changeslist.legend.js | 33 |
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 ) ); |