2020-10-18 11:52:02 +00:00
|
|
|
var controller = require( './controller.js' ),
|
|
|
|
config = require( './config.json' ),
|
|
|
|
uri = new mw.Uri();
|
2019-12-10 21:46:22 +00:00
|
|
|
|
2019-10-10 20:17:24 +00:00
|
|
|
/**
|
2019-12-10 21:46:22 +00:00
|
|
|
* @class mw.dt
|
2019-10-10 20:17:24 +00:00
|
|
|
* @singleton
|
|
|
|
*/
|
2019-12-10 21:46:22 +00:00
|
|
|
mw.dt = {};
|
2019-10-10 20:17:24 +00:00
|
|
|
|
2020-06-24 20:27:53 +00:00
|
|
|
mw.dt.initState = {};
|
2021-07-29 06:12:10 +00:00
|
|
|
|
|
|
|
if ( uri.query.dtrepliedto ) {
|
|
|
|
// If we had to reload the page to highlight the new comment, extract that data from the URL and
|
|
|
|
// clean it up.
|
|
|
|
mw.dt.initState.repliedTo = uri.query.dtrepliedto;
|
|
|
|
if ( window.history.replaceState ) {
|
|
|
|
delete uri.query.dtrepliedto;
|
|
|
|
window.history.replaceState( {}, '', uri.toString() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-24 20:27:53 +00:00
|
|
|
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 = {};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-10-18 11:52:02 +00:00
|
|
|
if ( uri.query.dtdebug ) {
|
2019-10-24 14:38:31 +00:00
|
|
|
mw.loader.load( 'ext.discussionTools.debug' );
|
2021-03-24 18:41:39 +00:00
|
|
|
} else {
|
2020-06-24 20:27:53 +00:00
|
|
|
// Don't use an anonymous function, because ReplyWidget needs to be able to remove this handler
|
|
|
|
mw.hook( 'wikipage.content' ).add( mw.dt.init );
|
2019-10-24 14:38:31 +00:00
|
|
|
}
|
2020-02-25 02:10:27 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2020-10-18 11:52:02 +00:00
|
|
|
controller: controller,
|
2020-07-20 21:15:03 +00:00
|
|
|
Parser: require( './Parser.js' ),
|
2020-02-25 02:10:27 +00:00
|
|
|
modifier: require( './modifier.js' ),
|
2020-07-20 14:13:59 +00:00
|
|
|
ThreadItem: require( './ThreadItem.js' ),
|
|
|
|
HeadingItem: require( './HeadingItem.js' ),
|
|
|
|
CommentItem: require( './CommentItem.js' ),
|
2020-03-08 14:32:38 +00:00
|
|
|
utils: require( './utils.js' ),
|
2020-04-29 18:45:20 +00:00
|
|
|
logger: require( './logger.js' ),
|
2020-10-18 11:52:02 +00:00
|
|
|
config: config
|
2020-02-25 02:10:27 +00:00
|
|
|
};
|