Merge "Drop outdated "documentation reviewed" tags"
[lhc/web/wiklou.git] / resources / src / jquery / jquery.confirmable.js
index 4b80d95..1ecce6c 100644 (file)
         * @param {Function} [options.handler] Callback to fire when the action is confirmed (user clicks
         *     the 'Yes' button).
         * @param {string} [options.i18n] Text to use for interface elements.
+        * @param {string} [options.i18n.space] Word separator to place between the three text messages.
         * @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
         */
                                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.
                                                $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
 
                                $interface = $( '<span>' )
                                        .addClass( 'jquery-confirmable-interface' )
-                                       .append( $text, $buttonYes, $buttonNo );
+                                       .append( $text, options.i18n.space, $buttonYes, options.i18n.space, $buttonNo );
                                $interface = options.wrapperCallback( $interface );
 
                                // Render offscreen to measure real width
                buttonCallback: identity,
                handler: null,
                i18n: {
+                       space: ' ',
                        confirm: 'Are you sure?',
                        yes: 'Yes',
-                       no: 'No'
+                       no: 'No',
+                       yesTitle: undefined,
+                       noTitle: undefined
                }
        };
 }( jQuery ) );