$this->lastdate = '';
$this->rclistOpen = false;
$this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
+ $this->getOutput()->addModules( 'mediawiki.special.changeslist.js' );
return '<div class="mw-changeslist">';
}
$this->getOutput()->addModules( array(
'jquery.makeCollapsible',
'mediawiki.icon',
+ 'mediawiki.special.changeslist.js',
) );
return '<div class="mw-changeslist">';
global $wgRecentChangesFlags;
$user = $context->getUser();
# The legend showing what the letters and stuff mean
- $legend = Xml::openElement( 'dl', array( 'class' => 'mw-changeslist-legend' ) ) . "\n";
+ $legend = Xml::openElement( 'dl' ) . "\n";
# Iterates through them and gets the messages for both letter and tooltip
$legendItems = $wgRecentChangesFlags;
if ( !$user->useRCPatrol() ) {
$context->msg( 'recentchanges-label-plusminus' )->text()
) . "\n";
$legend .= Xml::closeElement( 'dl' ) . "\n";
+
+ # Collapsibility
+ $legend =
+ '<div class="mw-changeslist-legend">' .
+ $context->msg( 'recentchanges-legend-heading' )->parse() .
+ '<div class="mw-collapsible-content">' . $legend . '</div>' .
+ '</div>';
+
return $legend;
}
$user = $this->getUser();
$output = $this->getOutput();
$output->addModuleStyles( 'mediawiki.special.changeslist' );
+ $output->addModules( 'mediawiki.special.changeslist.js' );
# Anons don't get a watchlist
$this->requireLogin( 'watchlistanontext' );
'recentchanges-label-bot' => 'This edit was performed by a bot',
'recentchanges-label-unpatrolled' => 'This edit has not yet been patrolled',
'recentchanges-label-plusminus' => 'The page size changed by this number of bytes',
+'recentchanges-legend-heading' => "'''Legend:'''",
'recentchanges-legend-newpage' => '(also see [[Special:NewPages|list of new pages]])',
'recentchanges-legend-plusminus' => "(''±123'')",
'rcnotefrom' => "Below are the changes since '''$2''' (up to '''$1''' shown).",
'recentchanges-label-plusminus' => 'Legend item for plus/minus.
Preceded by legend example {{msg-mw|Recentchanges-legend-plusminus}}.',
+'recentchanges-legend-heading' => 'Used as a heading for legend box on [[Special:RecentChanges]] and [[Special:Watchlist]].',
'recentchanges-legend-newpage' => 'Used as legend in [[Special:RecentChanges]]. Preceded by {{msg-mw|Recentchanges-label-newpage}}.',
'recentchanges-legend-plusminus' => 'A plus/minus sign with a number for the legend.',
'rcnotefrom' => 'This message is displayed at [[Special:RecentChanges]] when viewing recentchanges from some specific time.
'recentchanges-label-bot',
'recentchanges-label-unpatrolled',
'recentchanges-label-plusminus',
+ 'recentchanges-legend-heading',
'recentchanges-legend-newpage',
'recentchanges-legend-plusminus',
'rcnotefrom',
'mediawiki.special.changeslist' => array(
'styles' => 'resources/mediawiki.special/mediawiki.special.changeslist.css',
),
+ 'mediawiki.special.changeslist.js' => array(
+ 'scripts' => 'resources/mediawiki.special/mediawiki.special.changeslist.js',
+ 'dependencies' => array(
+ 'jquery.makeCollapsible',
+ 'jquery.cookie',
+ ),
+ ),
'mediawiki.special.changeslist.enhanced' => array(
'styles' => 'resources/mediawiki.special/mediawiki.special.changeslist.enhanced.css',
),
border: 1px solid #ddd;
}
+.mw-changeslist-legend dl {
+ /* Parent element defines sufficient padding */
+ margin-bottom: 0;
+}
+
.mw-changeslist-legend dt {
float: left;
}
--- /dev/null
+/* 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 );
+ } );
+} );