mediawiki-extensions-Discus.../modules/dt.init.js
Ed Sanders a2431fe006 Refactor CommentParser
* Pass rootNode to the constructor
* Rename getters to match CommentItem/HeadingItem/ThreadItem
  value classes.
* Always build the thread tree so CommentItem's always have
  and ID and replies/parent.

Change-Id: I508be9534de59016ff806e3d84edcbb1c76cb0c6
2020-07-20 23:38:10 +01:00

37 lines
1.1 KiB
JavaScript

var controller = require( './controller.js' );
/**
* @class mw.dt
* @singleton
*/
mw.dt = {};
mw.dt.initState = {};
mw.dt.init = function ( $container ) {
if ( $container.is( '#mw-content-text' ) || $container.find( '#mw-content-text' ).length ) {
// eslint-disable-next-line no-jquery/no-global-selector
controller.init( $( '#mw-content-text' ), mw.dt.initState );
// Reset for next init
mw.dt.initState = {};
}
};
if ( new mw.Uri().query.dtdebug ) {
mw.loader.load( 'ext.discussionTools.debug' );
} else if ( mw.config.get( 'wgIsProbablyEditable' ) ) {
// Don't use an anonymous function, because ReplyWidget needs to be able to remove this handler
mw.hook( 'wikipage.content' ).add( mw.dt.init );
}
module.exports = {
controller: require( './controller.js' ),
Parser: require( './Parser.js' ),
modifier: require( './modifier.js' ),
ThreadItem: require( './ThreadItem.js' ),
HeadingItem: require( './HeadingItem.js' ),
CommentItem: require( './CommentItem.js' ),
utils: require( './utils.js' ),
logger: require( './logger.js' ),
config: require( './config.json' )
};