mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-30 19:16:39 +00:00
d0bcec6196
Bug: T265499 Change-Id: Ied330c633732651d1c4e136646afd676ceb570c7
46 lines
1.3 KiB
JavaScript
46 lines
1.3 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 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 );
|
|
}
|
|
|
|
// If the tool is not enabled on this wiki, then the user
|
|
// is using a local hack to load this code. Set a cookie
|
|
// so reply links are added on the server.
|
|
if ( !config.enable && !uri.query.dtenable ) {
|
|
mw.cookie.set( 'discussiontools-tempenable', 1 );
|
|
}
|
|
|
|
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
|
|
};
|