eslint: Re-enable valid-jsdoc and make a pass
[lhc/web/wiklou.git] / resources / src / jquery / jquery.confirmable.js
index 339e65a..7931c81 100644 (file)
@@ -12,6 +12,7 @@
                return data;
        };
 
+       // eslint-disable-next-line valid-jsdoc
        /**
         * Enable inline confirmation for given clickable element (like `<a />` or `<button />`).
         *
@@ -40,6 +41,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
         */
                                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
                        space: ' ',
                        confirm: 'Are you sure?',
                        yes: 'Yes',
-                       no: 'No'
+                       no: 'No',
+                       yesTitle: undefined,
+                       noTitle: undefined
                }
        };
 }( jQuery ) );