mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-12-18 02:51:26 +00:00
b6f554a945
Topic subscription test is going to be all logged in users only, no transitory enrollment conditions, so we can remove the anonymous user handling and DB writes. Bug: T302515 Bug: T304030 Change-Id: I5e57bb9b7958576f3a04373748331a86f4626fb5
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
var controller = require( './controller.js' ),
|
|
url = new URL( location.href );
|
|
|
|
/**
|
|
* @class mw.dt
|
|
* @singleton
|
|
*/
|
|
mw.dt = {};
|
|
|
|
mw.dt.initState = {
|
|
firstLoad: true
|
|
};
|
|
|
|
// Cleaning up anonymous A/B test token; remove later.
|
|
mw.storage.remove( 'DTNewTopicABToken' );
|
|
|
|
if ( url.searchParams.get( '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 = url.searchParams.get( 'dtrepliedto' );
|
|
if ( window.history.replaceState ) {
|
|
url.searchParams.delete( 'dtrepliedto' );
|
|
window.history.replaceState( {}, '', url );
|
|
}
|
|
}
|
|
|
|
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 ( url.searchParams.get( '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' ),
|
|
parserData: require( './parser/data.json' ),
|
|
modifier: require( './modifier.js' ),
|
|
ThreadItem: require( './ThreadItem.js' ),
|
|
HeadingItem: require( './HeadingItem.js' ),
|
|
CommentItem: require( './CommentItem.js' ),
|
|
utils: require( './utils.js' ),
|
|
logger: require( './logger.js' )
|
|
};
|