mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-23 20:23:05 +00:00
fe8f8fa05d
I'm not sure why it was done this way. Probably because it doesn't make an actual difference from the user's perspective. My motivation is: When we already called the code that auto-expands the RevisionSlider UI then it doesn't make much sense to give the user a keyypress handler that does the same a second time. Possibly even related to T342556? This patch also contains a few small, unrelated code cleanups. Change-Id: I123e89d9d7dc3b1e33cf43831c679330d9dd1cdd
19 lines
492 B
JavaScript
19 lines
492 B
JavaScript
const Settings = require( 'ext.RevisionSlider.Settings' ),
|
|
autoExpand = new Settings().shouldAutoExpand();
|
|
|
|
if ( autoExpand ) {
|
|
mw.loader.load( 'ext.RevisionSlider.init' );
|
|
} else {
|
|
$( '.mw-revslider-toggle-button' ).on( {
|
|
click: function () {
|
|
mw.loader.load( 'ext.RevisionSlider.init' );
|
|
},
|
|
keypress: function ( event ) {
|
|
if ( event.which === 13 || event.which === 32 ) {
|
|
event.preventDefault();
|
|
$( '.mw-revslider-toggle-button' ).trigger( 'click' );
|
|
}
|
|
}
|
|
} );
|
|
}
|