TitleWidget: Use OOUI query highlighting, instead of jQuery lib
[lhc/web/wiklou.git] / resources / src / mediawiki.widgets / mw.widgets.TitleOptionWidget.js
index 37e6e1a..0f1815b 100644 (file)
@@ -21,7 +21,7 @@
         * @cfg {boolean} [missing] Page doesn't exist
         * @cfg {boolean} [redirect] Page is a redirect
         * @cfg {boolean} [disambiguation] Page is a disambiguation page
-        * @cfg {string} [query] Matching query string
+        * @cfg {string} [query] Matching query string to highlight
         */
        mw.widgets.TitleOptionWidget = function MwWidgetsTitleOptionWidget( config ) {
                var icon;
                } );
 
                // Highlight matching parts of link suggestion
-               this.$label.autoEllipsis( { hasSpan: false, tooltip: true, matchText: config.query } );
+               if ( config.query ) {
+                       this.setHighlightedQuery( config.data, config.query );
+               }
+               this.$label.attr( 'title', config.data );
 
                if ( config.missing ) {
                        this.$label.addClass( 'new' );
+               } else if ( config.redirect ) {
+                       this.$label.addClass( 'mw-redirect' );
+               } else if ( config.disambiguation ) {
+                       this.$label.addClass( 'mw-disambig' );
                }
 
                if ( config.imageUrl ) {