https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112114
Revision: 112114
Author: maxsem
Date: 2012-02-22 16:22:35 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
Show request time
Modified Paths:
--------------
trunk/extensions/ApiSandbox/ApiSandbox.i18n.php
trunk/extensions/ApiSandbox/ApiSandbox.php
trunk/extensions/ApiSandbox/ext.apiSandbox.js
Modified: trunk/extensions/ApiSandbox/ApiSandbox.i18n.php
===================================================================
--- trunk/extensions/ApiSandbox/ApiSandbox.i18n.php 2012-02-22 15:59:11 UTC
(rev 112113)
+++ trunk/extensions/ApiSandbox/ApiSandbox.i18n.php 2012-02-22 16:22:35 UTC
(rev 112114)
@@ -40,6 +40,7 @@
'apisb-example' => 'Example',
'apisb-examples' => 'Examples',
'apisb-clear' => 'Clear',
+ 'apisb-request-time' => 'Request time: $1',
);
/** Message documentation (Message documentation)
@@ -76,6 +77,7 @@
'apisb-example' => 'Button text that will reveal the example list, used
if the list contains only 1 entry. See also {{msg-mw|apisb-examples}}',
'apisb-examples' => 'Button text that will reveal the example list,
used if the list contains multiple entries. See also {{msg-mw|apisb-example}}',
'apisb-clear' => 'Title of the button that clears all inputs',
+ 'apisb-request-time' => 'TIme it took to process this request',
);
/** Afrikaans (Afrikaans)
Modified: trunk/extensions/ApiSandbox/ApiSandbox.php
===================================================================
--- trunk/extensions/ApiSandbox/ApiSandbox.php 2012-02-22 15:59:11 UTC (rev
112113)
+++ trunk/extensions/ApiSandbox/ApiSandbox.php 2012-02-22 16:22:35 UTC (rev
112114)
@@ -40,6 +40,7 @@
'apisb-examples',
'apisb-clear',
'apisb-submit',
+ 'apisb-request-time',
'parentheses',
),
'dependencies' => array(
Modified: trunk/extensions/ApiSandbox/ext.apiSandbox.js
===================================================================
--- trunk/extensions/ApiSandbox/ext.apiSandbox.js 2012-02-22 15:59:11 UTC
(rev 112113)
+++ trunk/extensions/ApiSandbox/ext.apiSandbox.js 2012-02-22 16:22:35 UTC
(rev 112114)
@@ -643,7 +643,11 @@
success: function ( data ) {
var match = data.match(
/<pre>[\s\S]*<\/pre>/ );
if ( $.isArray( match ) ) {
+ var time = data.match( /<!--
Served .*?in (\d+(\.\d+)?) secs. -->/ );
data = match[0];
+ if ( $.isArray( time ) ) {
+ data += '\n<br/>' +
mw.html.escape( mw.msg( 'apisb-request-time', time[1] ) );
+ }
} else {
// some actions don't honor
user-specified format
data = '<pre>' +
mw.html.escape( data ) + '</pre>';
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs