-/**
- * JavaScript for the new debug toolbar, enabled through $wgDebugToolbar.
- *
- * @author John Du Hart
- * @since 1.19
- */
-
( function ( mw, $ ) {
'use strict';
var debug,
hovzer = $.getFootHovzer();
+ /**
+ * Debug toolbar.
+ *
+ * Enabled server-side through `$wgDebugToolbar`.
+ *
+ * @class mw.Debug
+ * @singleton
+ * @author John Du Hart
+ * @since 1.19
+ */
debug = mw.Debug = {
/**
* Toolbar container element
*
- * @var {jQuery}
+ * @property {jQuery}
*/
$container: null,
/**
* Object containing data for the debug toolbar
*
- * @var {Object}
+ * @property {Object}
*/
data: {},
/**
- * Initializes the debugging pane.
+ * Initialize the debugging pane
+ *
* Shouldn't be called before the document is ready
* (since it binds to elements on the page).
*
- * @param {Object} data, defaults to 'debugInfo' from mw.config
+ * @param {Object} [data] Defaults to 'debugInfo' from mw.config
*/
init: function ( data ) {
},
/**
- * Switches between panes
+ * Switch between panes
+ *
+ * Should be called with an HTMLElement as its thisArg,
+ * because it's meant to be an event handler.
+ *
+ * TODO: Store cookie for last pane open.
*
- * @todo Store cookie for last pane open
- * @context {Element}
* @param {jQuery.Event} e
*/
switchPane: function ( e ) {
var currentPaneId = debug.$container.data( 'currentPane' ),
- requestedPaneId = $(this).prop( 'id' ).substr( 9 ),
+ requestedPaneId = $( this ).prop( 'id' ).substr( 9 ),
$currentPane = $( '#mw-debug-pane-' + currentPaneId ),
$requestedPane = $( '#mw-debug-pane-' + requestedPaneId ),
hovDone = false;
// Skip hash fragment handling. Prevents screen from jumping.
e.preventDefault();
- $( this ).addClass( 'current ');
- $( '.mw-debug-panelink' ).not( this ).removeClass( 'current ');
+ $( this ).addClass( 'current ' );
+ $( '.mw-debug-panelink' ).not( this ).removeClass( 'current ' );
// Hide the current pane
if ( requestedPaneId === currentPaneId ) {
},
/**
- * Constructs the HTML for the debugging toolbar
+ * Construct the HTML for the debugging toolbar
*/
buildHtml: function () {
var $container, $bits, panes, id, gitInfo;
/**
* Returns a jQuery element for a debug-bit div
*
- * @param id
+ * @ignore
+ * @param {string} id
* @return {jQuery}
*/
function bitDiv( id ) {
- return $( '<div>' ).prop({
+ return $( '<div>' ).prop( {
id: 'mw-debug-' + id,
className: 'mw-debug-bit'
- })
+ } )
.appendTo( $bits );
}
/**
* Returns a jQuery element for a pane link
*
- * @param id
- * @param text
+ * @ignore
+ * @param {string} id
+ * @param {string} text
* @return {jQuery}
*/
function paneLabel( id, text ) {
return $( '<a>' )
- .prop({
+ .prop( {
className: 'mw-debug-panelabel',
href: '#mw-debug-pane-' + id
- })
+ } )
.text( text );
}
/**
* Returns a jQuery element for a debug-bit div with a for a pane link
*
- * @param id CSS id snippet. Will be prefixed with 'mw-debug-'
- * @param text Text to show
- * @param count Optional count to show
+ * @ignore
+ * @param {string} id CSS id snippet. Will be prefixed with 'mw-debug-'
+ * @param {string} text Text to show
+ * @param {string} count Optional count to show
* @return {jQuery}
*/
function paneTriggerBitDiv( id, text, count ) {
if ( count ) {
text = text + ' (' + count + ')';
}
- return $( '<div>' ).prop({
+ return $( '<div>' ).prop( {
id: 'mw-debug-' + id,
className: 'mw-debug-bit mw-debug-panelink'
- })
+ } )
.append( paneLabel( id, text ) )
.appendTo( $bits );
}
}
$( '<div>' )
- .prop({
+ .prop( {
className: 'mw-debug-pane',
id: 'mw-debug-pane-' + id
- })
+ } )
.append( panes[id] )
.appendTo( $container );
}
},
/**
- * Builds the console panel
+ * Build the console panel
*/
buildConsoleTable: function () {
var $table, entryTypeText, i, length, entry;
},
/**
- * Query list pane
+ * Build query list pane
+ *
+ * @return {jQuery}
*/
buildQueryTable: function () {
var $table, i, length, query;
},
/**
- * Legacy debug log pane
+ * Build legacy debug log pane
+ *
+ * @return {jQuery}
*/
buildDebugLogTable: function () {
var $list, i, length, line;
},
/**
- * Request information pane
+ * Build request information pane
+ *
+ * @return {jQuery}
*/
buildRequestPane: function () {
},
/**
- * Included files pane
+ * Build included files pane
+ *
+ * @return {jQuery}
*/
buildIncludesPane: function () {
var $table, i, length, file;