mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 03:33:45 +00:00
Resize revision slider when resizing the browser window.
Bug: T139101 Change-Id: I57c7d9e553f02c2e8eaa76ee729f85ec4ae2ec3b
This commit is contained in:
parent
18974dbd2c
commit
4d6233f842
|
@ -92,8 +92,8 @@
|
|||
this.rtlScrollLeftType = this.determineRtlScrollType();
|
||||
}
|
||||
|
||||
this.pointerOlder = new mw.libs.revisionSlider.Pointer( 'mw-revslider-pointer-older' );
|
||||
this.pointerNewer = new mw.libs.revisionSlider.Pointer( 'mw-revslider-pointer-newer' );
|
||||
this.pointerOlder = this.pointerOlder || new mw.libs.revisionSlider.Pointer( 'mw-revslider-pointer-older' );
|
||||
this.pointerNewer = this.pointerNewer || new mw.libs.revisionSlider.Pointer( 'mw-revslider-pointer-newer' );
|
||||
|
||||
helpPopup = new OO.ui.PopupWidget( {
|
||||
$content: $( '<p>' ).text( mw.msg( 'revisionslider-show-help-tooltip' ) ),
|
||||
|
@ -386,6 +386,9 @@
|
|||
* @param {jQuery} $newRevElement
|
||||
*/
|
||||
initializePointers: function ( $oldRevElement, $newRevElement ) {
|
||||
if ( this.pointerOlder.getPosition() !== 0 || this.pointerNewer.getPosition() !== 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( $oldRevElement.length === 0 && $newRevElement.length === 0 ) {
|
||||
// Note: this is currently caught in init.js
|
||||
throw 'RS-revs-not-specified';
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
slider = new mw.libs.revisionSlider.Slider( revisionList );
|
||||
slider.getView().render( $container );
|
||||
|
||||
window.addEventListener( 'resize', function () {
|
||||
slider.getView().render( $container );
|
||||
} );
|
||||
|
||||
if ( !mw.user.options.get( 'userjs-revslider-hidehelp' ) ) {
|
||||
mw.libs.revisionSlider.HelpDialog.show();
|
||||
( new mw.Api() ).saveOption( 'userjs-revslider-hidehelp', true );
|
||||
|
|
Loading…
Reference in a new issue