mediawiki-extensions-Discus.../modules/dt.init.js
Bartosz Dziewoński 9cb497fc97 Check wgIsProbablyEditable before showing 'Reply' buttons
Bug: T240582
Change-Id: I127cd937ed2725c649dc34a8d18a29560c09fb44
2020-03-10 21:19:33 +01:00

23 lines
609 B
JavaScript

var controller = require( 'ext.discussionTools.controller' );
/**
* @class mw.dt
* @singleton
*/
mw.dt = {};
if ( new mw.Uri().query.dtdebug ) {
mw.loader.load( 'ext.discussionTools.debug' );
} else if ( mw.config.get( 'wgIsProbablyEditable' ) ) {
mw.hook( 'wikipage.content' ).add( function ( $container ) {
$container.find( '.mw-parser-output' ).each( function () {
var $node = $( this );
// Don't re-run if we already handled this element
// eslint-disable-next-line no-jquery/no-class-state
if ( !$node.hasClass( 'dt-init-done' ) ) {
controller.init( $node );
}
} );
} );
}