From: wctaiwan Date: Sun, 15 Feb 2015 22:09:57 +0000 (-0500) Subject: Improve title text in jquery.confirmable X-Git-Tag: 1.31.0-rc.0~12389^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=1147690eb18d72aac05ba0446cca1452131058d2;p=lhc%2Fweb%2Fwiklou.git Improve title text in jquery.confirmable Don't clone the title text for the "No" button, and make the title text customizable for both yes and no buttons. Bug: T89572 Change-Id: I7e1e5c6ee78aa54a97205d6682f9520008cc11dd --- diff --git a/resources/src/jquery/jquery.confirmable.js b/resources/src/jquery/jquery.confirmable.js index 339e65a4d6..1ecce6cad7 100644 --- a/resources/src/jquery/jquery.confirmable.js +++ b/resources/src/jquery/jquery.confirmable.js @@ -40,6 +40,8 @@ * @param {string} [options.i18n.confirm] Text to use for the confirmation question. * @param {string} [options.i18n.yes] Text to use for the 'Yes' button. * @param {string} [options.i18n.no] Text to use for the 'No' button. + * @param {string} [options.i18n.yesTitle] Title text to use for the 'Yes' button. + * @param {string} [options.i18n.noTitle] Title text to use for the 'No' button. * * @chainable */ @@ -108,6 +110,9 @@ if ( options.handler ) { $buttonYes.on( options.events, options.handler ); } + if ( options.i18n.yesTitle ) { + $buttonYes.attr( 'title', options.i18n.yesTitle ); + } $buttonYes = options.buttonCallback( $buttonYes, 'yes' ); // Clone it without any events and prevent default action to represent the 'No' button. @@ -120,6 +125,11 @@ $interface.css( 'width', 0 ); e.preventDefault(); } ); + if ( options.i18n.noTitle ) { + $buttonNo.attr( 'title', options.i18n.noTitle ); + } else { + $buttonNo.removeAttr( 'title' ); + } $buttonNo = options.buttonCallback( $buttonNo, 'no' ); // Prevent memory leaks @@ -164,7 +174,9 @@ space: ' ', confirm: 'Are you sure?', yes: 'Yes', - no: 'No' + no: 'No', + yesTitle: undefined, + noTitle: undefined } }; }( jQuery ) ); diff --git a/resources/src/jquery/jquery.confirmable.mediawiki.js b/resources/src/jquery/jquery.confirmable.mediawiki.js index d4a106e37a..daf23a99c0 100644 --- a/resources/src/jquery/jquery.confirmable.mediawiki.js +++ b/resources/src/jquery/jquery.confirmable.mediawiki.js @@ -9,6 +9,8 @@ space: mw.message( 'word-separator' ).text(), confirm: mw.message( 'confirmable-confirm', mw.user ).text(), yes: mw.message( 'confirmable-yes' ).text(), - no: mw.message( 'confirmable-no' ).text() + no: mw.message( 'confirmable-no' ).text(), + yesTitle: undefined, + noTitle: undefined }; }( mediaWiki, jQuery ) );