"disallowQuotedKeysInObjects": "allButReserved",
"requireDotNotation": { "allExcept": [ "keywords" ] },
"jsDoc": {
+ "requireNewlineAfterDescription": true,
"requireParamTypes": true,
"requireReturnTypes": true
},
},
/**
* Sets the value of a property, and updates the widget accordingly
+ *
* @param {String} property Name of property
* @param {Mixed} value Value to set property with
*/
/**
* Gets a localized message, using parameters from options if present.
- * @ignore
*
+ * @ignore
* @param {Object} options
* @param {string} key
* @return {string} Localized message
/**
* CompletenessTest
- * @constructor
*
+ * @constructor
* @example
* var myTester = new CompletenessTest( myLib );
* @param {Object} masterVariable The root variable that contains all object
* call to this function still pending will be canceled. If the value in the
* textbox is empty or hasn't changed since the last time suggestions were fetched,
* this function does nothing.
+ *
* @param {boolean} delayed Whether or not to delay this by the currently configured amount of time
*/
update: function ( context, delayed ) {
/**
* Sets the value of a property, and updates the widget accordingly
+ *
* @param {string} property Name of property
* @param {Mixed} value Value to set property with
*/
/**
* Highlight a result in the results table
+ *
* @param {jQuery|string} result `<tr>` to highlight, or 'prev' or 'next'
* @param {boolean} updateTextbox If true, put the suggestion in the textbox
*/
/**
* Respond to keypress event
+ *
* @param {number} key Code of key pressed
*/
keypress: function ( e, context, key ) {
*
* After this, it will look at all rows at the bottom for footer rows
* And place these in a tfoot using similar rules.
+ *
* @param {jQuery} $table jQuery object for a <table>
*/
function emulateTHeadAndFoot( $table ) {
*
* Scroll a textarea to the current cursor position. You can set the cursor
* position with setSelection()
+ *
* @param {boolean} options Whether to force a scroll even if the caret position
* is already visible. Defaults to false
*
/**
* Post a new section to the page.
+ *
* @see #postWithEditToken
* @param {mw.Title|String} title Target page
* @param {string} header
/**
* Make the two-step login easier.
+ *
* @author Niklas Laxström
* @class mw.Api.plugin.login
* @since 1.22
/**
* Provides an interface for uploading files to MediaWiki.
+ *
* @class mw.Api.plugin.upload
* @singleton
*/
/**
* @private
* Get nonce for iframe IDs on the page.
+ *
* @return {number}
*/
function getNonce() {
/**
* @private
* Get new iframe object for an upload.
+ *
* @return {HTMLIframeElement}
*/
function getNewIframe( id ) {
/**
* @private
* Shortcut for getting hidden inputs
+ *
* @return {jQuery}
*/
function getHiddenInput( name, val ) {
* This function will return a promise, which when resolved, will pass back a function
* to finish the stash upload. You can call that function with an argument containing
* more, or conflicting, data to pass to the server. For example:
+ *
* // upload a file to the stash with a placeholder filename
* api.uploadToStash( file, { filename: 'testing.png' } ).done( function ( finish ) {
* // finish is now the function we can use to finalize the upload
* // the upload is complete, data holds the API response
* } );
* } );
+ *
* @param {File|HTMLInputElement} file
* @param {Object} [data]
* @return {jQuery.Promise}
},
/**
- * Get the digit transform table for current UI language.
+ * Get the digit transform table for current UI language.
+ *
* @return {Object|Array}
*/
getDigitTransformTable: function () {
},
/**
- * Get the separator transform table for current UI language.
+ * Get the separator transform table for current UI language.
+ *
* @return {Object|Array}
*/
getSeparatorTransformTable: function () {
/**
* Find the highest protection level in any selector
+ *
* @return {number}
*/
getMaxLevel: function () {
/**
* Perform the layout justification.
+ *
* @ignore
* @context {HTMLElement} A `ul.mw-gallery-*` element
*/
( function ( mw, $ ) {
/**
* Given an email validity status (true, false, null) update the label CSS class
+ *
* @ignore
*/
function updateMailValidityLabel( mail ) {
/**
* Handle click events on the "up" button, switching to less precise view.
+ *
* @private
*/
mw.widgets.CalendarWidget.prototype.onUpButtonClick = function () {
/**
* Handle click events on the "previous" button, switching to previous pane.
+ *
* @private
*/
mw.widgets.CalendarWidget.prototype.onPrevButtonClick = function () {
/**
* Handle click events on the "next" button, switching to next pane.
+ *
* @private
*/
mw.widgets.CalendarWidget.prototype.onNextButtonClick = function () {
* Handle click events anywhere in the body of the widget, which contains the matrix of days,
* months or years to choose. Maybe change the pane or switch to more precise view, depending on
* what gets clicked.
+ *
* @private
*/
mw.widgets.CalendarWidget.prototype.onBodyClick = function ( e ) {
/**
* Add categories to the upload.
+ *
* @param {string[]} categories Array of categories to which this upload will be added.
*/
ForeignStructuredUpload.prototype.addCategories = function ( categories ) {
/**
* Add a description to the upload.
+ *
* @param {string} language The language code for the description's language. Must have a template on the target wiki to work properly.
* @param {string} description The description of the file.
*/
/**
* Set the date of creation for the upload.
+ *
* @param {Date} date
*/
ForeignStructuredUpload.prototype.setDate = function ( date ) {
/**
* Get the text of the file page, to be created on upload. Brings together
* several different pieces of information to create useful text.
+ *
* @return {string}
*/
ForeignStructuredUpload.prototype.getText = function () {
/**
* Gets the wikitext for the creation date of this upload.
+ *
* @private
* @return {string}
*/
/**
* Gets the name of the template to use for creating the file metadata.
* Override in subclasses for other templates.
+ *
* @private
* @return {string}
*/
/**
* Fetches the wikitext for any descriptions that have been added
* to the upload.
+ *
* @private
* @return {string}
*/
/**
* Fetches the wikitext for the categories to which the upload will
* be added.
+ *
* @private
* @return {string}
*/
/**
* Gets the wikitext for the license of the upload. Abstract for now.
+ *
* @private
* @return {string}
*/
/**
* Get the username.
+ *
* @private
* @return {string}
*/
/**
* Set the text of the file page, to be created on file upload.
+ *
* @param {string} text
*/
UP.setText = function ( text ) {
/**
* Set the filename, to be finalized on upload.
+ *
* @param {string} filename
*/
UP.setFilename = function ( filename ) {
/**
* Set the file to be uploaded.
+ *
* @param {HTMLInputElement|File} file
*/
UP.setFile = function ( file ) {
/**
* Set whether the file should be watchlisted after upload.
+ *
* @param {boolean} watchlist
*/
UP.setWatchlist = function ( watchlist ) {
/**
* Set the edit comment for the upload.
+ *
* @param {string} comment
*/
UP.setComment = function ( comment ) {
/**
* Get the text of the file page, to be created on file upload.
+ *
* @return {string}
*/
UP.getText = function () {
/**
* Get the filename, to be finalized on upload.
+ *
* @return {string}
*/
UP.getFilename = function () {
/**
* Get the file being uploaded.
+ *
* @return {HTMLInputElement|File}
*/
UP.getFile = function () {
/**
* Get the boolean for whether the file will be watchlisted after upload.
+ *
* @return {boolean}
*/
UP.getWatchlist = function () {
/**
* Get the current value of the edit comment for the upload.
+ *
* @return {string}
*/
UP.getComment = function () {
/**
* Gets the base filename from a path name.
+ *
* @param {string} path
* @return {string}
*/
/**
* Gets the state of the upload.
+ *
* @return {mw.Upload.State}
*/
UP.getState = function () {
* Get the imageinfo object for the finished upload.
* Only available once the upload is finished! Don't try to get it
* beforehand.
+ *
* @return {Object|undefined}
*/
UP.getImageInfo = function () {
/**
* Upload the file directly.
+ *
* @return {jQuery.Promise}
*/
UP.upload = function () {
/**
* Upload the file to the stash to be completed later.
+ *
* @return {jQuery.Promise}
*/
UP.uploadToStash = function () {
/**
* Finish a stash upload.
+ *
* @return {jQuery.Promise}
*/
UP.finishStashUpload = function () {
/**
* Return the object with functions to release and manually trigger the confirm alert
+ *
* @ignore
*/
return {
/**
* Remove all event listeners and don't show an alert anymore, if the user wants to leave
* the page.
+ *
* @ignore
*/
release: function () {
* Trigger the module's function manually: Check, if options.test() returns true and show
* an alert to the user if he/she want to leave this page. Returns false, if options.test() returns
* false or the user cancelled the alert window (~don't leave the page), true otherwise.
+ *
* @ignore
* @return {boolean}
*/
/**
* Try to catch errors in modules which don't do their own error handling.
+ *
* @class mw.errorLogger
* @singleton
*/
/**
* Install a window.onerror handler that will report via mw.track, while preserving
* any previous handler.
+ *
* @param {Object} window
*/
installGlobalHandler: function ( window ) {
/**
* Dumb window.onerror handler which forwards the errors via mw.track.
+ *
* @fires global_error
*/
window.onerror = function ( errorMessage, url, lineNumber, columnNumber, errorObject ) {
* Respond to dialog submit event. If the information was
* submitted, either successfully or with an error, open
* a MessageDialog to thank the user.
+ *
* @param {string} [status] A status of the end of operation
* of the main feedback dialog. Empty if the dialog was
* dismissed with no action or the user followed the button
/**
* Set the bug report link
+ *
* @param {string} link Link to the external bug report form
*/
mw.Feedback.Dialog.prototype.setBugReportLink = function ( link ) {
/**
* Get the bug report link
+ *
* @returns {string} Link to the external bug report form
*/
mw.Feedback.Dialog.prototype.getBugReportLink = function () {
* Try to parse a key and optional replacements, returning a jQuery object that may be a tree of jQuery nodes.
* If there was an error parsing, return the key and the error message (wrapped in jQuery). This should put the error right into
* the interface, without causing the page to halt script execution, and it hopefully should be clearer how to fix it.
+ *
* @private
* @param {Object} options Parser options
* @return {Function}
* Where the magic happens.
* Parses a message from the key, and swaps in replacements as necessary, wraps in jQuery
* If an error is thrown, returns original key, and logs the error
+ *
* @param {string} key Message key.
* @param {Array} replacements Variable replacements for $1, $2... $n
* @return {jQuery}
/**
* Fetch the message string associated with a key, return parsed structure. Memoized.
* Note that we pass '[' + key + ']' back for a missing message here.
+ *
* @param {string} key
* @return {string|Array} string of '[key]' if message missing, simple string if possible, array of arrays if needs parsing
*/
/**
* Try parsers until one works, if none work return null
+ *
* @private
* @param {Function[]} ps
* @return {string|null}
/**
* Try several ps in a row, all must succeed or return null.
* This is the only eager one.
+ *
* @private
* @param {Function[]} ps
* @return {string|null}
/**
* Run the same parser over and over until it fails.
* Must succeed a minimum of n times or return null.
+ *
* @private
* @param {number} n
* @param {Function} p
/**
* Just make parsers out of simpler JS builtin types
+ *
* @private
* @param {string} s
* @return {Function}
/**
* (We put this method definition here, and not in prototype, to make sure it's not overwritten by any magic.)
* Walk entire node structure, applying replacements and template functions when appropriate
+ *
* @param {Mixed} node Abstract syntax tree (top node or subnode)
* @param {Array} replacements for $1, $2, ... $n
* @return {Mixed} single-string node or array of nodes suitable for jQuery appending
* Parsing has been applied depth-first we can assume that all nodes here are single nodes
* Must return a single node to parents -- a jQuery with synthetic span
* However, unwrap any other synthetic spans in our children and pass them upwards
+ *
* @param {Mixed[]} nodes Some single nodes, some arrays of nodes
* @return {jQuery}
*/
* Transform parsed structure into pluralization
* n.b. The first node may be a non-integer (for instance, a string representing an Arabic number).
* So convert it back with the current language's convertNumber.
+ *
* @param {Array} nodes List of nodes, [ {string|number}, {string}, {string} ... ]
* @return {string} selected pluralized form according to current language
*/
/**
* Transform parsed structure into grammar conversion.
* Invoked by putting `{{grammar:form|word}}` in a message
+ *
* @param {Array} nodes List of nodes [{Grammar case eg: genitive}, {string word}]
* @return {string} selected grammatical form according to current language
*/
/**
* Tranform parsed structure into a int: (interface language) message include
* Invoked by putting `{{int:othermessage}}` into a message
+ *
* @param {Array} nodes List of nodes
* @return {string} Other message
*/
* Takes an unformatted number (arab, no group separators and . as decimal separator)
* and outputs it in the localized digit script and formatted with decimal
* separator, according to the current language.
+ *
* @param {Array} nodes List of nodes
* @return {number|string} Formatted number
*/
/**
* Dummy placeholder for {@link mw.log}
+ *
* @method
*/
log: ( function () {
/**
* Define loop-function here for efficiency
* and to avoid re-using badly scoped variables.
+ *
* @ignore
*/
function addLink( media, url ) {
/**
* Converts a module map of the form { foo: [ 'bar', 'baz' ], bar: [ 'baz, 'quux' ] }
* to a query string of the form foo.bar,baz|bar.baz,quux
+ *
* @private
*/
function buildModulesString( moduleMap ) {
/**
* Load modules from load.php
+ *
* @private
* @param {Object} moduleMap Module map, see #buildModulesString
* @param {Object} currReqBase Object with other parameters (other than 'modules') to use in the request
/**
* Construct a JSON-serializable object representing the content of the store.
+ *
* @return {Object} Module store contents.
*/
toJSON: function () {
/**
* Get a key on which to vary the module cache.
+ *
* @return {string} String of concatenated vary conditions.
*/
getVary: function () {
/**
* Wrapper object for raw HTML passed to mw.html.element().
+ *
* @class mw.html.Raw
*/
Raw: function ( value ) {
/**
* Wrapper object for CDATA element contents passed to mw.html.element()
+ *
* @class mw.html.Cdata
*/
Cdata: function ( value ) {
return {
/**
* Register a hook handler
+ *
* @param {Function...} handler Function to bind.
* @chainable
*/
/**
* Unregister a hook handler
+ *
* @param {Function...} handler Function to unbind.
* @chainable
*/
/**
* Run a hook.
+ *
* @param {Mixed...} data
* @chainable
*/
/**
* Initialisation.
* Must only be called once, and not before the document is ready.
+ *
* @ignore
*/
function init() {
/**
* Pause auto-hide timers for all notifications.
* Notifications will not auto-hide until resume is called.
+ *
* @see mw.Notification#pause
*/
pause: function () {
/**
* Callback that's run when the user changes the search input text
* 'this' is the search input box (jQuery object)
+ *
* @ignore
*/
function onBeforeUpdate() {
/**
* Callback that's run when suggestions have been updated either from the cache or the API
* 'this' is the search input box (jQuery object)
+ *
* @ignore
*/
function onAfterUpdate() {
/**
* Reset mw.config and others to a fresh copy of the live config for each test(),
* and restore it back to the live one afterwards.
+ *
* @param {Object} [localEnv]
* @example (see test suite at the bottom of this file)
* </code>
* The sync style load test (for @import). This is, in a way, also an open bug for
* ResourceLoader ("execute js after styles are loaded"), but browsers don't offer a
* way to get a callback from when a stylesheet is loaded (that is, including any
- * @import rules inside). To work around this, we'll have a little time loop to check
+ * `@import` rules inside). To work around this, we'll have a little time loop to check
* if the styles apply.
+ *
* Note: This test originally used new Image() and onerror to get a callback
* when the url is loaded, but that is fragile since it doesn't monitor the
* same request as the css @import, and Safari 4 has issues with