mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-12 09:58:17 +00:00
ffafc1a752
* Run the 'wikipage.content' hook before our initialization. This way collapsible elements and other changes to the page layout are processed before we measure where the new reply is and try to highlight and scroll it into view. (T252903) * Remove the code dealing with 'mw-parser-output' and 'dt-init-done'. This was needed to avoid initializing twice on the same element, which can't happen now. (T254807) This is much closer to the original approach Ed proposed in I05a3c766668999f05cfe06473652429025595196 before I changed it: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/550693/7..8 Bug: T252903 Bug: T254807 Change-Id: Ibc3fcbd3c92c8eceda19b68cee9e69f6e92456f5
34 lines
965 B
JavaScript
34 lines
965 B
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' ),
|
|
utils: require( './utils.js' ),
|
|
logger: require( './logger.js' ),
|
|
config: require( './config.json' )
|
|
};
|