Resize revision slider when resizing the browser window.

Bug: T139101
Change-Id: I57c7d9e553f02c2e8eaa76ee729f85ec4ae2ec3b
This commit is contained in:
Jakob Warkotsch 2016-08-15 17:09:42 +02:00
parent 18974dbd2c
commit 4d6233f842
2 changed files with 9 additions and 2 deletions

View file

@ -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';

View file

@ -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 );