// Infuse OOUI widgets, if any are present
$nodes = $( '[data-ooui]' );
if ( $nodes.length ) {
- mw.loader.using( 'mediawiki.widgets' ).done( function () {
+ // FIXME: We should only load the widgets that are being infused
+ mw.loader.using( [ 'mediawiki.widgets', 'mediawiki.widgets.UserInputWidget' ] ).done( function () {
$nodes.each( function () {
OO.ui.infuse( this );
} );
} );
}
+ $nodes = $( '.catlinks[data-mw="interface"]' );
+ if ( $nodes.length ) {
+ /**
+ * Fired when categories are being added to the DOM
+ *
+ * It is encouraged to fire it before the main DOM is changed (when $content
+ * is still detached). However, this order is not defined either way, so you
+ * should only rely on $content itself.
+ *
+ * This includes the ready event on a page load (including post-edit loads)
+ * and when content has been previewed with LivePreview.
+ *
+ * @event wikipage_categories
+ * @member mw.hook
+ * @param {jQuery} $content The most appropriate element containing the content,
+ * such as .catlinks
+ */
+ mw.hook( 'wikipage.categories' ).fire( $nodes );
+ }
} );
}( mediaWiki, jQuery ) );