mediawiki-extensions-Discus.../modules/dt.init.js
Bartosz Dziewoński ee524d6bd6 Remove cookie hack for loading unavailable tools
Bug: T277783
Change-Id: I521db842b4b7a98d8d255d418abd0ccb167c5aa0
2021-05-25 20:27:46 +02:00

39 lines
1 KiB
JavaScript

var controller = require( './controller.js' ),
config = require( './config.json' ),
uri = new mw.Uri();
/**
* @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 ( uri.query.dtdebug ) {
mw.loader.load( 'ext.discussionTools.debug' );
} else {
// 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: controller,
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: config
};