Add Special:ApiSandbox

Like Extension:ApiSandbox, but rewritten to use OOJS-UI and to add many
long-requested features.

Bug: T89386
Bug: T92893
Bug: T98457
Bug: T98083
Bug: T89229
Bug: T66008
Bug: T50607
Bug: T47811
Bug: T38875
Bug: T36962
Bug: T34740
Change-Id: Ic42a6c5ef54b811cd63cfef2132942b27a626fe5
Depends-On: I85c0eedcd31a0e419d8055eca0d9cb1ba872ae62
Depends-On: Ic85ff4abbbcd2076ebf5cdfaa0e95e98878e2308
This commit is contained in:
Brad Jorsch 2015-05-07 13:11:09 -04:00
parent 920c06e42c
commit f0207e8ca6
19 changed files with 2010 additions and 24 deletions

View file

@ -65,6 +65,8 @@ production.
* $wgAllowAsyncCopyUploads and $CopyUploadAsyncTimeout were removed. This was an
experimental feature that has never worked.
* $wgEnotifUseJobQ was removed and the job queue is always used.
* The functionality of the ApiSandbox extension has been merged into core. The
extension should no longer be used.
=== New features in 1.27 ===
* $wgDataCenterUpdateStickTTL was also added. This decides how long a user

View file

@ -1153,6 +1153,7 @@ $wgAutoloadLocalClasses = array(
'SpecialAllMyUploads' => __DIR__ . '/includes/specials/SpecialMyRedirectPages.php',
'SpecialAllPages' => __DIR__ . '/includes/specials/SpecialAllPages.php',
'SpecialApiHelp' => __DIR__ . '/includes/specials/SpecialApiHelp.php',
'SpecialApiSandbox' => __DIR__ . '/includes/specials/SpecialApiSandbox.php',
'SpecialBlankpage' => __DIR__ . '/includes/specials/SpecialBlankpage.php',
'SpecialBlock' => __DIR__ . '/includes/specials/SpecialBlock.php',
'SpecialBlockList' => __DIR__ . '/includes/specials/SpecialBlockList.php',

View file

@ -32,6 +32,7 @@
abstract class ApiFormatBase extends ApiBase {
private $mIsHtml, $mFormat, $mUnescapeAmps, $mHelp;
private $mBuffer, $mDisabled = false;
private $mIsWrappedHtml = false;
protected $mForceDefaultParams = false;
/**
@ -45,6 +46,7 @@ abstract class ApiFormatBase extends ApiBase {
$this->mIsHtml = ( substr( $format, -2, 2 ) === 'fm' ); // ends with 'fm'
if ( $this->mIsHtml ) {
$this->mFormat = substr( $format, 0, -2 ); // remove ending 'fm'
$this->mIsWrappedHtml = $this->getMain()->getCheck( 'wrappedhtml' );
} else {
$this->mFormat = $format;
}
@ -79,6 +81,15 @@ abstract class ApiFormatBase extends ApiBase {
return $this->mIsHtml;
}
/**
* Returns true when the special wrapped mode is enabled.
* @since 1.27
* @return bool
*/
protected function getIsWrappedHtml() {
return $this->mIsWrappedHtml;
}
/**
* Disable the formatter.
*
@ -145,7 +156,9 @@ abstract class ApiFormatBase extends ApiBase {
return;
}
$mime = $this->getIsHtml() ? 'text/html' : $this->getMimeType();
$mime = $this->getIsWrappedHtml()
? 'text/mediawiki-api-prettyprint-wrapped'
: ( $this->getIsHtml() ? 'text/html' : $this->getMimeType() );
// Some printers (ex. Feed) do their own header settings,
// in which case $mime will be set to null
@ -185,19 +198,21 @@ abstract class ApiFormatBase extends ApiBase {
$out->addModuleStyles( 'mediawiki.apipretty' );
$out->setPageTitle( $context->msg( 'api-format-title' ) );
// When the format without suffix 'fm' is defined, there is a non-html version
if ( $this->getMain()->getModuleManager()->isDefined( $lcformat, 'format' ) ) {
$msg = $context->msg( 'api-format-prettyprint-header' )->params( $format, $lcformat );
} else {
$msg = $context->msg( 'api-format-prettyprint-header-only-html' )->params( $format );
}
if ( !$this->getIsWrappedHtml() ) {
// When the format without suffix 'fm' is defined, there is a non-html version
if ( $this->getMain()->getModuleManager()->isDefined( $lcformat, 'format' ) ) {
$msg = $context->msg( 'api-format-prettyprint-header' )->params( $format, $lcformat );
} else {
$msg = $context->msg( 'api-format-prettyprint-header-only-html' )->params( $format );
}
$header = $msg->parseAsBlock();
$out->addHTML(
Html::rawElement( 'div', array( 'class' => 'api-pretty-header' ),
ApiHelp::fixHelpLinks( $header )
)
);
$header = $msg->parseAsBlock();
$out->addHTML(
Html::rawElement( 'div', array( 'class' => 'api-pretty-header' ),
ApiHelp::fixHelpLinks( $header )
)
);
}
if ( Hooks::run( 'ApiFormatHighlight', array( $context, $result, $mime, $format ) ) ) {
$out->addHTML(
@ -205,10 +220,38 @@ abstract class ApiFormatBase extends ApiBase {
);
}
// API handles its own clickjacking protection.
// Note, that $wgBreakFrames will still override $wgApiFrameOptions for format mode.
$out->allowClickjacking();
$out->output();
if ( $this->getIsWrappedHtml() ) {
// This is a special output mode mainly intended for ApiSandbox use
$time = microtime( true ) - $this->getConfig()->get( 'RequestTime' );
$json = FormatJson::encode(
array(
'html' => $out->getHTML(),
'modules' => array_values( array_unique( array_merge(
$out->getModules(),
$out->getModuleScripts(),
$out->getModuleStyles()
) ) ),
'time' => round( $time * 1000 ),
),
false, FormatJson::ALL_OK
);
// Bug 66776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
// Flash, but what it does isn't friendly for the API, so we need to
// work around it.
if ( preg_match( '/\<\s*cross-domain-policy\s*\>/i', $json ) ) {
$json = preg_replace(
'/\<(\s*cross-domain-policy\s*)\>/i', '\\u003C$1\\u003E', $json
);
}
echo $json;
} else {
// API handles its own clickjacking protection.
// Note, that $wgBreakFrames will still override $wgApiFrameOptions for format mode.
$out->allowClickjacking();
$out->output();
}
} else {
// For non-HTML output, clear all errors that might have been
// displayed if display_errors=On
@ -234,6 +277,18 @@ abstract class ApiFormatBase extends ApiBase {
return $this->mBuffer;
}
public function getAllowedParams() {
$ret = array();
if ( $this->getIsHtml() ) {
$ret['wrappedhtml'] = array(
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_HELP_MSG => 'apihelp-format-param-wrappedhtml',
);
}
return $ret;
}
protected function getExamplesMessages() {
return array(
'action=query&meta=siteinfo&siprop=namespaces&format=' . $this->getModuleName()

View file

@ -121,10 +121,10 @@ class ApiFormatJson extends ApiFormatBase {
public function getAllowedParams() {
if ( $this->isRaw ) {
return array();
return parent::getAllowedParams();
}
$ret = array(
$ret = parent::getAllowedParams() + array(
'callback' => array(
ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-callback',
),

View file

@ -78,7 +78,7 @@ class ApiFormatPhp extends ApiFormatBase {
}
public function getAllowedParams() {
$ret = array(
$ret = parent::getAllowedParams() + array(
'formatversion' => array(
ApiBase::PARAM_TYPE => array( 1, 2, 'latest' ),
ApiBase::PARAM_DFLT => 1,

View file

@ -288,7 +288,7 @@ class ApiFormatXml extends ApiFormatBase {
}
public function getAllowedParams() {
return array(
return parent::getAllowedParams() + array(
'xslt' => array(
ApiBase::PARAM_HELP_MSG => 'apihelp-xml-param-xslt',
),

View file

@ -690,9 +690,12 @@ class ApiHelp extends ApiBase {
) );
$link = wfAppendQuery( wfScript( 'api' ), $qs );
$sandbox = SpecialPage::getTitleFor( 'ApiSandbox' )->getLocalURL() . '#' . $qs;
$help['examples'] .= Html::rawElement( 'dt', null, $msg->parse() );
$help['examples'] .= Html::rawElement( 'dd', null,
Html::element( 'a', array( 'href' => $link ), "api.php?$qs" )
Html::element( 'a', array( 'href' => $link ), "api.php?$qs" ) . ' ' .
Html::rawElement( 'a', array( 'href' => $sandbox ),
$context->msg( 'api-help-open-in-apisandbox' )->parse() )
);
}
$help['examples'] .= Html::closeElement( 'dl' );

View file

@ -6,7 +6,7 @@
]
},
"apihelp-main-description": "<div class=\"hlist plainlinks api-main-links\">\n* [[mw:API:Main_page|Documentation]]\n* [[mw:API:FAQ|FAQ]]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api Mailing list]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce API Announcements]\n* [https://phabricator.wikimedia.org/maniphest/query/GebfyV4uCaLd/#R Bugs & requests]\n</div>\n<strong>Status:</strong> All features shown on this page should be working, but the API is still in active development, and may change at any time. Subscribe to [https://lists.wikimedia.org/pipermail/mediawiki-api-announce/ the mediawiki-api-announce mailing list] for notice of updates.\n\n<strong>Erroneous requests:</strong> When erroneous requests are sent to the API, an HTTP header will be sent with the key \"MediaWiki-API-Error\" and then both the value of the header and the error code sent back will be set to the same value. For more information see [[mw:API:Errors_and_warnings|API: Errors and warnings]].",
"apihelp-main-description": "<div class=\"hlist plainlinks api-main-links\">\n* [[mw:API:Main_page|Documentation]]\n* [[mw:API:FAQ|FAQ]]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api Mailing list]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce API Announcements]\n* [https://phabricator.wikimedia.org/maniphest/query/GebfyV4uCaLd/#R Bugs & requests]\n</div>\n<strong>Status:</strong> All features shown on this page should be working, but the API is still in active development, and may change at any time. Subscribe to [https://lists.wikimedia.org/pipermail/mediawiki-api-announce/ the mediawiki-api-announce mailing list] for notice of updates.\n\n<strong>Erroneous requests:</strong> When erroneous requests are sent to the API, an HTTP header will be sent with the key \"MediaWiki-API-Error\" and then both the value of the header and the error code sent back will be set to the same value. For more information see [[mw:API:Errors_and_warnings|API: Errors and warnings]].\n\n<strong>Testing:</strong> For ease of testing API requests, see [[Special:ApiSandbox]].",
"apihelp-main-param-action": "Which action to perform.",
"apihelp-main-param-format": "The format of the output.",
"apihelp-main-param-maxlag": "Maximum lag can be used when MediaWiki is installed on a database replicated cluster. To save actions causing any more site replication lag, this parameter can make the client wait until the replication lag is less than the specified value. In case of excessive lag, error code <samp>maxlag</samp> is returned with a message like <samp>Waiting for $host: $lag seconds lagged</samp>.<br />See [[mw:Manual:Maxlag_parameter|Manual: Maxlag parameter]] for more information.",
@ -1370,6 +1370,7 @@
"apihelp-watch-example-generator": "Watch the first few pages in the main namespace.",
"apihelp-format-example-generic": "Return the query result in the $1 format.",
"apihelp-format-param-wrappedhtml": "Return the pretty-printed HTML and associated ResourceLoader modules as a JSON object.",
"apihelp-json-description": "Output data in JSON format.",
"apihelp-json-param-callback": "If specified, wraps the output into a given function call. For safety, all user-specific data will be restricted.",
"apihelp-json-param-utf8": "If specified, encodes most (but not all) non-ASCII characters as UTF-8 instead of replacing them with hexadecimal escape sequences. Default when <var>formatversion</var> is not <kbd>1</kbd>.",
@ -1451,6 +1452,7 @@
"api-help-permissions": "{{PLURAL:$1|Permission|Permissions}}:",
"api-help-permissions-granted-to": "{{PLURAL:$1|Granted to}}: $2",
"api-help-right-apihighlimits": "Use higher limits in API queries (slow queries: $1; fast queries: $2). The limits for slow queries also apply to multivalue parameters.",
"api-help-open-in-apisandbox": "<small>[open in sandbox]</small>",
"api-credits-header": "Credits",
"api-credits": "API developers:\n* Yuri Astrakhan (creator, lead developer Sep 2006Sep 2007)\n* Roan Kattouw (lead developer Sep 20072009)\n* Victor Vasiliev\n* Bryan Tong Minh\n* Sam Reed\n* Brad Jorsch (lead developer 2013present)\n\nPlease send your comments, suggestions and questions to mediawiki-api@lists.wikimedia.org\nor file a bug report at https://phabricator.wikimedia.org/."

View file

@ -1275,6 +1275,7 @@
"apihelp-watch-example-unwatch": "{{doc-apihelp-example|watch}}",
"apihelp-watch-example-generator": "{{doc-apihelp-example|watch}}",
"apihelp-format-example-generic": "{{doc-apihelp-example|format|params=* $1 - Format name|paramstart=2|noseealso=1}}",
"apihelp-format-param-wrappedhtml": "{{doc-apihelp-param|format|wrappedhtml|description=the \"wrappedhtml\" parameter in pretty-printing format modules}}",
"apihelp-json-description": "{{doc-apihelp-description|json|seealso=* {{msg-mw|apihelp-jsonfm-description}}}}",
"apihelp-json-param-callback": "{{doc-apihelp-param|json|callback}}",
"apihelp-json-param-utf8": "{{doc-apihelp-param|json|utf8}}",
@ -1353,6 +1354,7 @@
"api-help-permissions": "Label for the \"permissions\" section in the main module's help output.\n\nParameters:\n* $1 - Number of permissions displayed\n{{Identical|Permission}}",
"api-help-permissions-granted-to": "Used to introduce the list of groups each permission is assigned to.\n\nParameters:\n* $1 - Number of groups\n* $2 - List of group names, comma-separated",
"api-help-right-apihighlimits": "{{technical}}{{doc-right|apihighlimits|prefix=api-help}}\nThis message is used instead of {{msg-mw|right-apihighlimits}} in the API help to display the actual limits.\n\nParameters:\n* $1 - Limit for slow queries\n* $2 - Limit for fast queries",
"api-help-open-in-apisandbox": "Text for the link to open an API example in [[Special:ApiSandbox]].",
"api-credits-header": "Header for the API credits section in the API help output\n{{Identical|Credit}}",
"api-credits": "API credits text, displayed in the API help output"
}

View file

@ -123,6 +123,7 @@ class SpecialPageFactory {
'ListDuplicatedFiles' => 'ListDuplicatedFilesPage',
// Data and tools
'ApiSandbox' => 'SpecialApiSandbox',
'Statistics' => 'SpecialStatistics',
'Allmessages' => 'SpecialAllMessages',
'Version' => 'SpecialVersion',

View file

@ -0,0 +1,58 @@
<?php
/**
* Implements Special:ApiSandbox
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup SpecialPage
*/
/**
* @ingroup SpecialPage
* @since 1.27
*/
class SpecialApiSandbox extends SpecialPage {
public function __construct() {
parent::__construct( 'ApiSandbox' );
}
public function execute( $par ) {
$this->setHeaders();
$out = $this->getOutput();
if ( !$this->getConfig()->get( 'EnableAPI' ) ) {
$out->showErrorPage( 'error', 'apisandbox-api-disabled' );
}
$out->addJsConfigVars( 'apihighlimits', $this->getUser()->isAllowed( 'apihighlimits' ) );
$out->addModuleStyles( array(
'mediawiki.special.apisandbox.styles',
) );
$out->addModules( array(
'mediawiki.special.apisandbox',
'mediawiki.apipretty',
) );
$out->wrapWikiMsg(
"<div id='mw-apisandbox'><div class='mw-apisandbox-nojs error'>\n$1\n</div></div>",
'apisandbox-jsonly'
);
}
protected function getGroupName() {
return 'wiki';
}
}

View file

@ -1822,6 +1822,41 @@
"apihelp-summary": "",
"apihelp-no-such-module": "Module \"$1\" not found.",
"apihelp-link": "[[Special:ApiHelp/$1|$2]]",
"apisandbox": "API sandbox",
"apisandbox-summary": "",
"apisandbox-jsonly": "JavaScript is required to use the API sandbox.",
"apisandbox-api-disabled": "The API is disabled on this site.",
"apisandbox-intro": "Use this page to experiment with the <strong>MediaWiki web service API</strong>.\nRefer to [[mw:API:Main page|the API documentation]] for further details of API usage. Example: [//www.mediawiki.org/wiki/API#A_simple_example get the content of a Main Page]. Select an action to see more examples.\n\nNote that, although this is a sandbox, actions you carry out on this page may modify the wiki.",
"apisandbox-fullscreen": "Expand panel",
"apisandbox-fullscreen-tooltip": "Expand the sandbox panel to fill the browser window.",
"apisandbox-unfullscreen": "Show page",
"apisandbox-unfullscreen-tooltip": "Reduce the sandbox panel, so MediaWiki navigation links are available.",
"apisandbox-submit": "Make request",
"apisandbox-reset": "Clear",
"apisandbox-retry": "Retry",
"apisandbox-loading": "Loading information for API module \"$1\"...",
"apisandbox-load-error": "An error occurred while loading information for API module \"$1\": $2",
"apisandbox-no-parameters": "This API module has no parameters.",
"apisandbox-helpurls": "Help links",
"apisandbox-examples": "Examples",
"apisandbox-dynamic-parameters": "Additional parameters",
"apisandbox-dynamic-parameters-add-label": "Add parameter:",
"apisandbox-dynamic-parameters-add-placeholder": "Parameter name",
"apisandbox-dynamic-error-exists": "A parameter named \"$1\" already exists.",
"apisandbox-deprecated-parameters": "Deprecated parameters",
"apisandbox-fetch-token": "Auto-fill the token",
"apisandbox-submit-invalid-fields-title": "Some fields are invalid",
"apisandbox-submit-invalid-fields-message": "Please correct the marked fields and try again.",
"apisandbox-results": "Results",
"apisandbox-sending-request": "Sending API request...",
"apisandbox-loading-results": "Receiving API results...",
"apisandbox-results-error": "An error occurred while loading the API query response: $1.",
"apisandbox-request-url-label": "Request URL:",
"apisandbox-request-time": "Request time: {{PLURAL:$1|$1 ms}}",
"apisandbox-results-fixtoken": "Correct token and resubmit",
"apisandbox-results-fixtoken-fail": "Failed to fetch \"$1\" token.",
"apisandbox-alert-page": "Fields on this page are not valid.",
"apisandbox-alert-field": "The value of this field is not valid.",
"booksources": "Book sources",
"booksources-summary": "",
"booksources-search-legend": "Search for book sources",

View file

@ -1997,6 +1997,41 @@
"apihelp-summary": "{{doc-specialpagesummary|ApiHelp}}",
"apihelp-no-such-module": "Used as an error message if the requested API module is not found.\n\nParameters:\n* $1 - Requested module name",
"apihelp-link": "{{notranslate}} Used to construct a link to [[Special:ApiHelp]]\n\nParameters:\n* $1 - module to link\n* $2 - link text",
"apisandbox": "{{doc-special|ApiSandbox}}",
"apisandbox-summary": "{{doc-specialpagesummary|ApiSandbox}}",
"apisandbox-jsonly": "Displayed as an error message if the browser does not have JavaScript enabled.",
"apisandbox-api-disabled": "Displayed as an error message if the API is disabled on this site.",
"apisandbox-intro": "Displayed (from JavaScript) as a header on [[Special:ApiSandbox]].",
"apisandbox-fullscreen": "JavaScript button label for enabling full-page mode.",
"apisandbox-fullscreen-tooltip": "Tooltip for the {{msg-mw|apisandbox-fullscreen}} button.",
"apisandbox-unfullscreen": "JavaScript button label for disabling full-page mode.",
"apisandbox-unfullscreen-tooltip": "Tooltip for the {{msg-mw|apisandbox-unfullscreen}} button.",
"apisandbox-submit": "JavaScript button label for submitting the request.",
"apisandbox-reset": "JavaScript button label for clearing the form.",
"apisandbox-retry": "JavaScript button label for retrying the submission.",
"apisandbox-loading": "JavaScript message displayed while data is loading.\n\nParameters:\n* $1 - Module being loaded",
"apisandbox-load-error": "Displayed as an error message from JavaScript when data failed to load.\n\nParameters:\n* $1 - Module being loaded\n* $2 - Error message from the API",
"apisandbox-no-parameters": "Displayed (from JavaScript) when the loaded API module has no parameters.",
"apisandbox-helpurls": "JavaScript button label for showing help URLs.",
"apisandbox-examples": "JavaScript button label for showing example queries.",
"apisandbox-dynamic-parameters": "JavaScript fieldset legend for the section containing the widgets to add arbitrary parameters to a module that can accept dynamic parameters.",
"apisandbox-dynamic-parameters-add-label": "JavaScript label for the widget to add a new arbitrary parameter.",
"apisandbox-dynamic-parameters-add-placeholder": "JavaScript text field placeholder for the widget to add a new arbitrary parameter.",
"apisandbox-dynamic-error-exists": "Displayed as an error message from JavaScript when trying to add a new arbitrary parameter with a name that already exists. Parameters:\n* $1 - Parameter name that failed.",
"apisandbox-deprecated-parameters": "JavaScript button label and fieldset legend for separating deprecated parameters in the UI.",
"apisandbox-fetch-token": "Tooltop for the button that fetches a CSRF token.",
"apisandbox-submit-invalid-fields-title": "Title for a JavaScript error message when fields are invalid.",
"apisandbox-submit-invalid-fields-message": "Content for a JavaScript error message when fields are invalid.",
"apisandbox-results": "JavaScript tab label for the tab displaying the API query results.",
"apisandbox-sending-request": "JavaScript message displayed while the request is being sent.",
"apisandbox-loading-results": "JavaScript message displayed while the response is being read.",
"apisandbox-results-error": "Displayed as an error message from JavaScript when the request failed.\n\nParameters:\n* $1 - Error message",
"apisandbox-request-url-label": "Label for the text field displaying the URL used to make this request.",
"apisandbox-request-time": "Label and value for displaying the time taken by the request.\n\nParameters:\n* $1 - Time taken in milliseconds",
"apisandbox-results-fixtoken": "JavaScript button label",
"apisandbox-results-fixtoken-fail": "Displayed as an error message from JavaScript when a CSRF token could not be fetched.\n\nParameters:\n* $1 - Token type",
"apisandbox-alert-page": "Tooltip for the alert icon on a module's page tab when the page contains fields with issues.",
"apisandbox-alert-field": "Tooltip for the alert icon on a field when the field has issues.",
"booksources": "{{doc-special|BookSources}}\n\n'''This message shouldn't be changed unless it has serious mistakes.'''\n\nIt's used as the page name of the configuration page of [[Special:BookSources]]. Changing it breaks existing sites using the default version of this message.\n\nSee also:\n* {{msg-mw|Booksources|title}}\n* {{msg-mw|Booksources-text|text}}",
"booksources-summary": "{{doc-specialpagesummary|booksources}}",
"booksources-search-legend": "Box heading on [[Special:BookSources|book sources]] special page. The box is for searching for places where a particular book can be bought or viewed.",

View file

@ -390,6 +390,7 @@ $specialPageAliases = array(
'AllMyUploads' => array( 'AllMyUploads', 'AllMyFiles' ),
'Allpages' => array( 'AllPages' ),
'ApiHelp' => array( 'ApiHelp' ),
'ApiSandbox' => array( 'ApiSandbox' ),
'Ancientpages' => array( 'AncientPages' ),
'Badtitle' => array( 'Badtitle' ),
'Blankpage' => array( 'BlankPage' ),

View file

@ -1695,6 +1695,61 @@ return array(
'scripts' => 'resources/src/mediawiki.special/mediawiki.special.js',
'styles' => 'resources/src/mediawiki.special/mediawiki.special.css',
),
'mediawiki.special.apisandbox.styles' => array(
'styles' => 'resources/src/mediawiki.special/mediawiki.special.apisandbox.top.css',
),
'mediawiki.special.apisandbox' => array(
'styles' => 'resources/src/mediawiki.special/mediawiki.special.apisandbox.css',
'scripts' => 'resources/src/mediawiki.special/mediawiki.special.apisandbox.js',
'dependencies' => array(
'mediawiki.special',
'mediawiki.api',
'mediawiki.jqueryMsg',
'oojs-ui',
'mediawiki.widgets.datetime',
),
'messages' => array(
'apisandbox-intro',
'apisandbox-submit',
'apisandbox-reset',
'apisandbox-fullscreen',
'apisandbox-fullscreen-tooltip',
'apisandbox-unfullscreen',
'apisandbox-unfullscreen-tooltip',
'apisandbox-retry',
'apisandbox-loading',
'apisandbox-load-error',
'apisandbox-fetch-token',
'apisandbox-helpurls',
'apisandbox-examples',
'apisandbox-dynamic-parameters',
'apisandbox-dynamic-parameters-add-label',
'apisandbox-dynamic-parameters-add-placeholder',
'apisandbox-dynamic-error-exists',
'apisandbox-deprecated-parameters',
'apisandbox-no-parameters',
'api-help-param-limit',
'api-help-param-limit2',
'api-help-param-integer-min',
'api-help-param-integer-max',
'api-help-param-integer-minmax',
'api-help-param-multi-separate',
'api-help-param-multi-max',
'apisandbox-submit-invalid-fields-title',
'apisandbox-submit-invalid-fields-message',
'apisandbox-results',
'apisandbox-sending-request',
'apisandbox-loading-results',
'apisandbox-results-error',
'apisandbox-request-url-label',
'apisandbox-request-time',
'apisandbox-results-fixtoken',
'apisandbox-results-fixtoken-fail',
'apisandbox-alert-page',
'apisandbox-alert-field',
'blanknamespace',
),
),
'mediawiki.special.block' => array(
'scripts' => 'resources/src/mediawiki.special/mediawiki.special.block.js',
'styles' => 'resources/src/mediawiki.special/mediawiki.special.block.css',

View file

@ -0,0 +1,74 @@
.mw-apisandbox-fullscreen {
overflow: hidden;
}
.mw-apisandbox-toolbar {
text-align: right;
padding: 0.5em;
}
.mw-apisandbox-popup .oo-ui-popupWidget-body > .oo-ui-widget {
vertical-align: middle;
}
/* So DateTimeInputWidget's calendar popup works... */
.mw-apisandbox-popup .oo-ui-popupWidget-popup,
.mw-apisandbox-popup .oo-ui-popupWidget-body {
overflow: visible;
}
.mw-apisandbox-fullscreen #mw-apisandbox-ui {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: #fff;
z-index: 100;
}
.mw-apisandbox-spacer {
display: inline-block;
height: 1px;
width: 5em;
}
.mw-apisandbox-optionalWidget {
width: 100%;
}
.mw-apisandbox-optionalWidget.oo-ui-widget-disabled {
position: relative;
z-index: 0; /* New stacking context to prevent the overlay from leaking out */
}
.mw-apisandbox-optionalWidget-overlay {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 2;
cursor: pointer;
}
.mw-apisandbox-optionalWidget-fields {
display: table;
width: 100%;
}
.mw-apisandbox-optionalWidget-widget,
.mw-apisandbox-optionalWidget-checkbox {
display: table-cell;
vertical-align: middle;
}
.mw-apisandbox-optionalWidget-checkbox {
width: 1%; /* Will be expanded by content */
white-space: nowrap;
padding-left: 0.5em;
}
.oo-ui-textInputWidget.oo-ui-widget-enabled > .oo-ui-indicatorElement-indicator.mw-apisandbox-clickable-indicator {
cursor: pointer;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
.client-js .mw-apisandbox-nojs {
display: none;
}

View file

@ -1,4 +1,4 @@
h1.firstHeading {
.mw-special-ApiHelp h1.firstHeading {
display: none;
}