Index: trunk/phase3/resources/mediawiki/mediawiki.debug.css |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | position: fixed; |
6 | 6 | bottom: 0; |
7 | 7 | background-color: #eee; |
8 | | - border-top: 1px solid #ccc; |
| 8 | + border-top: 1px solid #aaa; |
9 | 9 | } |
10 | 10 | |
11 | 11 | .mw-debug pre { |
— | — | @@ -16,49 +16,85 @@ |
17 | 17 | border: none; |
18 | 18 | } |
19 | 19 | |
| 20 | +.mw-debug table { |
| 21 | + border-spacing: 0; |
| 22 | + width: 100%; |
| 23 | +} |
| 24 | + |
| 25 | +.mw-debug table tr { |
| 26 | + background-color: #fff; |
| 27 | +} |
| 28 | + |
| 29 | +.mw-debug table tr:nth-child(even) { |
| 30 | + background-color: #f9f9f9; |
| 31 | +} |
| 32 | + |
| 33 | +.mw-debug table td { |
| 34 | + padding: 4px 10px; |
| 35 | + border-bottom: 1px solid #eee; |
| 36 | +} |
| 37 | + |
| 38 | +.mw-debug table td.nr { |
| 39 | + text-align: right; |
| 40 | +} |
| 41 | + |
| 42 | +.mw-debug table td span.stats { |
| 43 | + color: #808080; |
| 44 | +} |
| 45 | + |
20 | 46 | .mw-debug ul { |
21 | 47 | margin: 0; |
22 | 48 | list-style: none; |
23 | | - box-sizing: border-box; |
24 | 49 | } |
25 | 50 | |
26 | 51 | .mw-debug li { |
27 | | - padding: 2px 5px; |
| 52 | + padding: 4px 0; |
28 | 53 | width: 100%; |
29 | | - display: table; |
30 | 54 | } |
31 | 55 | |
| 56 | +.mw-debug-bits { |
| 57 | + text-align: center; |
| 58 | + border-bottom: 1px solid #aaa; |
| 59 | +} |
| 60 | + |
32 | 61 | .mw-debug-bit { |
33 | | - min-height: 25px; |
34 | 62 | display: inline-block; |
35 | | - padding: 5px; |
36 | | - border-right: 1px solid #ccc; |
| 63 | + padding: 10px 5px; |
37 | 64 | font-size: 13px; |
38 | 65 | } |
39 | 66 | |
| 67 | +.mw-debug-panelink { |
| 68 | + background-color: #eee; |
| 69 | + border-right: 1px solid #ccc; |
| 70 | +} |
| 71 | + |
| 72 | +.mw-debug-panelink:first-child { |
| 73 | + border-left: 1px solid #ccc; |
| 74 | +} |
| 75 | + |
| 76 | +.mw-debug-panelink:hover { |
| 77 | + background-color: #fefefe; |
| 78 | + cursor: pointer; |
| 79 | +} |
| 80 | +.mw-debug-panelink.current { |
| 81 | + background-color: #dedede; |
| 82 | + |
| 83 | +} |
| 84 | +a.mw-debug-panelabel, |
| 85 | +a.mw-debug-panelabel:visited { |
| 86 | + color: #000; |
| 87 | +} |
| 88 | + |
40 | 89 | .mw-debug-pane { |
41 | 90 | max-height: 300px; |
42 | 91 | overflow: scroll; |
43 | | - border-top: 2px solid #ccc; |
44 | 92 | display: none; |
45 | 93 | font-size: 11px; |
46 | 94 | background-color: #e1eff2; |
47 | 95 | box-sizing: border-box; |
48 | 96 | } |
49 | 97 | |
50 | | -.mw-debug-right { |
51 | | - float: right; |
52 | | -} |
53 | | - |
54 | | -#mw-debug-querylist td { |
55 | | - padding: 2px 5px; |
56 | | - border-bottom: 1px solid #ccc; |
57 | | -} |
58 | | - |
59 | | -.mw-debug-query-time { |
60 | | - color: #808080; |
61 | | -} |
62 | | - |
| 98 | +#mw-debug-pane-debuglog, |
63 | 99 | #mw-debug-pane-request { |
64 | 100 | padding: 20px; |
65 | 101 | } |
— | — | @@ -91,17 +127,3 @@ |
92 | 128 | #mw-debug-pane-request td { |
93 | 129 | background-color: white; |
94 | 130 | } |
95 | | - |
96 | | -#mw-debug-pane-querylist table { |
97 | | - border-spacing: 0; |
98 | | -} |
99 | | - |
100 | | -#mw-debug-pane-includes li, |
101 | | -#mw-debug-pane-querylist tr td { |
102 | | - background-color: #ccc; |
103 | | -} |
104 | | - |
105 | | -#mw-debug-pane-includes li:nth-child(odd), |
106 | | -#mw-debug-pane-querylist tr:nth-child(odd) td { |
107 | | - background-color: #ddd; |
108 | | -} |
Index: trunk/phase3/resources/mediawiki/mediawiki.debug.js |
— | — | @@ -47,11 +47,14 @@ |
48 | 48 | */ |
49 | 49 | switchPane: function ( e ) { |
50 | 50 | var currentPaneId = debug.$container.data( 'currentPane' ), |
51 | | - requestedPaneId = $(this).parent().attr( 'id' ).substr( 9 ), |
| 51 | + requestedPaneId = $(this).prop( 'id' ).substr( 9 ), |
52 | 52 | $currentPane = $( '#mw-debug-pane-' + currentPaneId ), |
53 | 53 | $requestedPane = $( '#mw-debug-pane-' + requestedPaneId ); |
54 | | - e.preventDefault(); |
55 | 54 | |
| 55 | + $( this ).addClass( 'current ') |
| 56 | + $( '.mw-debug-panelink' ).not( this ).removeClass( 'current '); |
| 57 | + |
| 58 | + |
56 | 59 | // Hide the current pane |
57 | 60 | if ( requestedPaneId === currentPaneId ) { |
58 | 61 | $currentPane.slideUp(); |
— | — | @@ -73,14 +76,12 @@ |
74 | 77 | * Constructs the HTML for the debugging toolbar |
75 | 78 | */ |
76 | 79 | buildHtml: function () { |
77 | | - var $container, panes, id; |
| 80 | + var $container, $bits, panes, id; |
78 | 81 | |
79 | | - $container = $( '<div>' ) |
80 | | - .attr({ |
81 | | - id: 'mw-debug-container', |
82 | | - 'class': 'mw-debug' |
83 | | - }); |
| 82 | + $container = $( '<div id="mw-debug-container" class="mw-debug"></div>' ); |
84 | 83 | |
| 84 | + $bits = $( '<div class="mw-debug-bits"></div>' ); |
| 85 | + |
85 | 86 | /** |
86 | 87 | * Returns a jQuery element for a debug-bit div |
87 | 88 | * |
— | — | @@ -91,7 +92,8 @@ |
92 | 93 | return $( '<div>' ).attr({ |
93 | 94 | id: 'mw-debug-' + id, |
94 | 95 | 'class': 'mw-debug-bit' |
95 | | - }); |
| 96 | + }) |
| 97 | + .appendTo( $bits ); |
96 | 98 | } |
97 | 99 | |
98 | 100 | /** |
— | — | @@ -101,50 +103,56 @@ |
102 | 104 | * @param text |
103 | 105 | * @return {jQuery} |
104 | 106 | */ |
105 | | - function paneLink( id, text ) { |
| 107 | + function paneLabel( id, text ) { |
106 | 108 | return $( '<a>' ) |
107 | 109 | .attr({ |
108 | | - href: '#', |
109 | | - 'class': 'mw-debug-panelink', |
110 | | - id: 'mw-debug-' + id + '-link' |
| 110 | + 'class': 'mw-debug-panelabel', |
| 111 | + href: '#mw-debug-pane-' + id |
111 | 112 | }) |
112 | 113 | .text( text ); |
113 | 114 | } |
114 | 115 | |
| 116 | + /** |
| 117 | + * Returns a jQuery element for a debug-bit div with a for a pane link |
| 118 | + * |
| 119 | + * @param id |
| 120 | + * @return {jQuery} |
| 121 | + */ |
| 122 | + function paneTriggerBitDiv( id, text ) { |
| 123 | + return $( '<div>' ).attr({ |
| 124 | + id: 'mw-debug-' + id, |
| 125 | + 'class': 'mw-debug-bit mw-debug-panelink' |
| 126 | + }) |
| 127 | + .append( paneLabel( id, text ) ) |
| 128 | + .appendTo( $bits ); |
| 129 | + } |
| 130 | + |
| 131 | + paneTriggerBitDiv( 'querylist', 'Queries: ' + this.data.queries.length ); |
| 132 | + |
| 133 | + paneTriggerBitDiv( 'debuglog', 'Debug Log (' + this.data.debugLog.length + ' lines)' ); |
| 134 | + |
| 135 | + paneTriggerBitDiv( 'request', 'Request' ); |
| 136 | + |
| 137 | + paneTriggerBitDiv( 'includes', this.data.includes.length + ' Files Included' ); |
| 138 | + |
115 | 139 | bitDiv( 'mwversion' ) |
116 | 140 | .append( $( '<a href="https://www.mediawiki.org//www.mediawiki.org/"></a>' ).text( 'MediaWiki' ) ) |
117 | | - .append( ': ' + this.data.mwVersion ) |
118 | | - .appendTo( $container ); |
| 141 | + .append( ': ' + this.data.mwVersion ); |
119 | 142 | |
120 | 143 | bitDiv( 'phpversion' ) |
121 | 144 | .append( $( '<a href="https://www.mediawiki.org//www.php.net/"></a>' ).text( 'PHP' ) ) |
122 | | - .append( ': ' + this.data.phpVersion ) |
123 | | - .appendTo( $container ); |
| 145 | + .append( ': ' + this.data.phpVersion ); |
124 | 146 | |
125 | 147 | bitDiv( 'time' ) |
126 | | - .text( 'Time: ' + this.data.time.toFixed( 5 ) ) |
127 | | - .appendTo( $container ); |
| 148 | + .text( 'Time: ' + this.data.time.toFixed( 5 ) ); |
| 149 | + |
128 | 150 | bitDiv( 'memory' ) |
129 | 151 | .text( 'Memory: ' + this.data.memory ) |
130 | | - .append( $( '<span title="Peak usage"></span>' ).text( ' (' + this.data.memoryPeak + ')' ) ) |
131 | | - .appendTo( $container ); |
| 152 | + .append( $( '<span title="Peak usage"></span>' ).text( ' (' + this.data.memoryPeak + ')' ) ); |
| 153 | + |
132 | 154 | |
133 | | - bitDiv( 'querylist' ) |
134 | | - .append( paneLink( 'query', 'Queries: ' + this.data.queries.length ) ) |
135 | | - .appendTo( $container ); |
| 155 | + $bits.appendTo( $container ); |
136 | 156 | |
137 | | - bitDiv( 'debuglog' ) |
138 | | - .append( paneLink( 'debuglog', 'Debug Log (' + this.data.debugLog.length + ' lines)' ) ) |
139 | | - .appendTo( $container ); |
140 | | - |
141 | | - bitDiv( 'request' ) |
142 | | - .append( paneLink( 'request', 'Request' ) ) |
143 | | - .appendTo( $container ); |
144 | | - |
145 | | - bitDiv( 'includes' ) |
146 | | - .append( paneLink( 'files-includes', this.data.includes.length + ' Files Included' ) ) |
147 | | - .appendTo( $container ); |
148 | | - |
149 | 157 | panes = { |
150 | 158 | querylist: this.buildQueryTable(), |
151 | 159 | debuglog: this.buildDebugLogTable(), |
— | — | @@ -184,7 +192,7 @@ |
185 | 193 | .append( $( '<td>' ).text( i + 1 ) ) |
186 | 194 | .append( $( '<td>' ).text( query.sql ) ) |
187 | 195 | .append( $( '<td>' ) |
188 | | - .append( $( '<span class="mw-debug-query-time"></span>' ).text( '(' + query.time.toFixed( 4 ) + 'ms) ' ) ) |
| 196 | + .append( $( '<span class="stats"></span>' ).text( '(' + query.time.toFixed( 4 ) + 'ms) ' ) ) |
189 | 197 | .append( query['function'] ) |
190 | 198 | ) |
191 | 199 | .appendTo( $table ); |
— | — | @@ -250,19 +258,19 @@ |
251 | 259 | * Included files pane |
252 | 260 | */ |
253 | 261 | buildIncludesPane: function () { |
254 | | - var $list, i, len, file; |
| 262 | + var $table, i, length, file; |
255 | 263 | |
256 | | - $list = $( '<ul>' ); |
| 264 | + $table = $( '<table>' ); |
257 | 265 | |
258 | | - for ( i = 0, len = this.data.includes.length; i < len; i += 1 ) { |
| 266 | + for ( i = 0, length = this.data.includes.length; i < length; i += 1 ) { |
259 | 267 | file = this.data.includes[i]; |
260 | | - $( '<li>' ) |
261 | | - .text( file.name ) |
262 | | - .prepend( $( '<span class="mw-debug-right"></span>' ).text( file.size ) ) |
263 | | - .appendTo( $list ); |
| 268 | + $( '<tr>' ) |
| 269 | + .append( $( '<td>' ).text( file.name ) ) |
| 270 | + .append( $( '<td class="nr">' ).text( file.size ) ) |
| 271 | + .appendTo( $table ); |
264 | 272 | } |
265 | 273 | |
266 | | - return $list; |
| 274 | + return $table; |
267 | 275 | } |
268 | 276 | }; |
269 | 277 | |