mediawiki-extensions-Discus.../modules/dt.init.js
Bartosz Dziewoński 25eb55000f Fix re-initialization after page is updated
I did this wrong in a6147ffac8, the
'dt-init-done' class was never cleared. Put it on another element.

Bug: T241861
Change-Id: I136bd9c12bcc80cff01f5d26a8a53524f0c533c6
2020-01-04 18:49:55 +01:00

23 lines
562 B
JavaScript

var controller = require( 'ext.discussionTools.controller' );
/**
* @class mw.dt
* @singleton
*/
mw.dt = {};
if ( new mw.Uri().query.dtdebug ) {
mw.loader.load( 'ext.discussionTools.debug' );
} else {
mw.hook( 'wikipage.content' ).add( function ( $container ) {
$container.find( '.mw-parser-output' ).each( function () {
var $node = $( this );
// Don't re-run if we already handled this element
// eslint-disable-next-line no-jquery/no-class-state
if ( !$node.hasClass( 'dt-init-done' ) ) {
controller.init( $node );
}
} );
} );
}