mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-13 18:37:07 +00:00
3e5a67010f
The packageFiles system makes it easier to export site config data from PHP to JS, which we need a lot of, but it's awkward when mixing it with defining and accessing classes via a namespace like mw.dt. The only thing remaining in mw.dt is mw.dt.pageThreads, which is described to be "for debugging", so we should keep it easy to type. Also we still use the namespace for documenting classes. Everything else can be reached by require()'ing a ResourceLoader module, for example instead of `mw.dt.ui.ReplyWidget` you'd do `require( 'ext.discussionTools.ReplyWidget' )`. (When debugging from browser console, use `mw.loader.require` instead.) Change-Id: I6496abcf58c21658d6fd0f3fc1db1f7380a89df7
19 lines
487 B
JavaScript
19 lines
487 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 {
|
|
mw.hook( 'wikipage.content' ).add( function ( $container ) {
|
|
// Don't re-run if we already handled this element
|
|
if ( $container.closest( '.dt-init-done' ).length === 0 ) {
|
|
controller.init( $container.find( '#mw-content-text' ).addBack( '#mw-content-text' ) );
|
|
}
|
|
} );
|
|
}
|