Merge "Remove most uses of jquery.tipsy in MediaViewer"

This commit is contained in:
jenkins-bot 2023-05-02 19:27:10 +00:00 committed by Gerrit Code Review
commit acd340b5de
5 changed files with 10 additions and 57 deletions

View file

@ -103,7 +103,6 @@
"oojs",
"jquery.fullscreen",
"jquery.color",
"jquery.tipsy",
"mmv.bootstrap",
"mmv.head"
],
@ -275,7 +274,6 @@
"mmv.ui.reuse.shareembed/mmv.ui.reuse.embed.less"
],
"dependencies": [
"jquery.tipsy",
"oojs",
"oojs-ui",
"mediawiki.user",

View file

@ -173,7 +173,6 @@ class Hooks implements MakeGlobalVariablesScriptHook {
'useThumbnailGuessing' => (bool)$wgMediaViewerUseThumbnailGuessing,
'imageQueryParameter' => $wgMediaViewerImageQueryParameter,
'recordVirtualViewBeaconURI' => $wgMediaViewerRecordVirtualViewBeaconURI,
'tooltipDelay' => 1000,
'extensions' => $wgMediaViewerExtensions,
];
$vars['wgMediaViewer'] = true;

View file

@ -312,17 +312,12 @@
* Setup for canvas navigation buttons
*/
LIP.setupCanvasButtons = function () {
var ui = this,
tooltipDelay = mw.config.get( 'wgMultimediaViewer' ).tooltipDelay;
var ui = this;
this.$closeButton = $( '<button>' )
.text( ' ' )
.addClass( 'mw-mmv-close' )
.prop( 'title', mw.message( 'multimediaviewer-close-popup-text' ).text() )
.tipsy( {
delayIn: tooltipDelay,
gravity: this.correctEW( 'ne' )
} )
.on( 'click', function () {
if ( ui.isFullscreen ) {
ui.$main.trigger( $.Event( 'jq-fullscreen-change.lip' ) );
@ -334,10 +329,6 @@
.text( ' ' )
.addClass( 'mw-mmv-fullscreen' )
.prop( 'title', mw.message( 'multimediaviewer-fullscreen-popup-text' ).text() )
.tipsy( {
delayIn: tooltipDelay,
gravity: this.correctEW( 'ne' )
} )
.on( 'click', function ( e ) {
if ( ui.isFullscreen ) {
ui.exitFullscreen();

View file

@ -30,8 +30,7 @@
* @param {jQuery} $fullscreenButton The fullscreen button from the parent class.
*/
function CanvasButtons( $container, $closeButton, $fullscreenButton ) {
var buttons = this,
tooltipDelay = mw.config.get( 'wgMultimediaViewer' ).tooltipDelay;
var buttons = this;
mw.mmv.ui.Element.call( this, $container );
@ -42,30 +41,18 @@
.attr( 'role', 'button' )
.addClass( 'mw-mmv-reuse-button' )
.text( '\u00A0' )
.prop( 'title', mw.message( 'multimediaviewer-reuse-link' ).text() )
.tipsy( {
delayIn: tooltipDelay,
gravity: this.correctEW( 'se' )
} );
.prop( 'title', mw.message( 'multimediaviewer-reuse-link' ).text() );
this.$options = $( '<button>' )
.text( ' ' )
.prop( 'title', mw.message( 'multimediaviewer-options-tooltip' ).text() )
.addClass( 'mw-mmv-options-button' )
.tipsy( {
delayIn: tooltipDelay,
gravity: this.correctEW( 'se' )
} );
.addClass( 'mw-mmv-options-button' );
this.$download = $( '<a>' )
.attr( 'role', 'button' )
.addClass( 'mw-mmv-download-button' )
.text( '\u00A0' )
.prop( 'title', mw.message( 'multimediaviewer-download-link' ).text() )
.tipsy( {
delayIn: tooltipDelay,
gravity: this.correctEW( 'se' )
} );
.prop( 'title', mw.message( 'multimediaviewer-download-link' ).text() );
this.$next = $( '<button>' )
.prop( 'title', mw.message( 'multimediaviewer-next-image-alt-text' ).text() )
@ -260,10 +247,7 @@
.add( this.$reuse )
.add( this.$options )
.add( this.$close )
.add( this.$fullscreen )
.each( function () {
$( this ).tipsy( 'enable' );
} );
.add( this.$fullscreen );
};
/**
@ -277,10 +261,7 @@
.add( this.$options )
.add( this.$close )
.add( this.$fullscreen )
.off( 'click.mmv-canvasButtons' )
.each( function () {
$( this ).tipsy( 'hide' ).tipsy( 'disable' );
} );
.off( 'click.mmv-canvasButtons' );
};
/**

View file

@ -79,9 +79,6 @@
.add( this.$authorAndSource )
.add( this.title.$ellipsis )
.add( this.creditField.$ellipsis )
.each( function () {
$( this ).tipsy( 'enable' );
} )
.on( 'click.mmv-mp', function ( e ) {
var clickTargetIsLink = $( e.target ).is( 'a' ),
clickTargetIsTruncated = !!$( e.target ).closest( '.mw-mmv-ttf-truncated' ).length,
@ -133,9 +130,6 @@
.add( this.title.$ellipsis )
.add( this.$authorAndSource )
.add( this.creditField.$ellipsis )
.each( function () {
$( this ).tipsy( 'hide' ).tipsy( 'disable' );
} )
.off( 'click.mmv-mp' );
$( this.$container ).off( '.mmv-mp' );
@ -220,10 +214,7 @@
mw.message( 'multimediaviewer-title-popup-text-more' )
);
this.$title.add( this.title.$ellipsis ).tipsy( {
delayIn: mw.config.get( 'wgMultimediaViewer' ).tooltipDelay,
gravity: this.correctEW( 'sw' )
} );
this.$title.add( this.title.$ellipsis );
};
MPP.initializeButtons = function () {
@ -277,10 +268,7 @@
mw.message( 'multimediaviewer-credit-popup-text-more' )
);
this.$authorAndSource.add( this.creditField.$ellipsis ).tipsy( {
delayIn: mw.config.get( 'wgMultimediaViewer' ).tooltipDelay,
gravity: this.correctEW( 'sw' )
} );
this.$authorAndSource.add( this.creditField.$ellipsis );
};
/**
@ -660,11 +648,7 @@
// * multimediaviewer-restriction-trademarked
// * multimediaviewer-restriction-default
// * multimediaviewer-restriction-default-and-others
.prop( 'title', mw.message( 'multimediaviewer-restriction-' + type ).text() )
.tipsy( {
delay: mw.config.get( 'wgMultimediaViewer' ).tooltipDelay,
gravity: this.correctEW( 'se' )
} );
.prop( 'title', mw.message( 'multimediaviewer-restriction-' + type ).text() );
$( '<span>' )
// The following classes are used here: