MediaWiki:Gadget-morebits.js: Difference between revisions

Content deleted Content added
Repo at 5174cbe: Add Morebits.status.status; Accept nochange option
Repo at 97b8143: Minor jsdoc fixes and cleanup
Line 52:
/** Hardcodes whether the user is a sysop, used a lot.
*
* @constant
* @type {boolean}
*/
Line 1,584 ⟶ 1,583:
/* **************** Morebits.date **************** */
/**
* Create a date object with enhanced processing capabilities, a la {@link
* {@link https://momentjs.com/|moment.js}. MediaWiki timestamp format is also
* acceptable, in addition to everything that JS Date() accepts.
*
Line 1,763 ⟶ 1,762:
 
/**
* FormatsFormat the date into a string per the given format string.
* Replacement syntax is a subset of that in moment.js:
*
Line 1,926 ⟶ 1,925:
/* **************** Morebits.wiki **************** */
/**
* Various objects for wiki editing and API access, including {@link
* {@link Morebits.wiki.api} and {@link Morebits.wiki.page}.
*
* @namespace Morebits.wiki
Line 2,248 ⟶ 2,247:
};
 
var morebitsWikiApiUserAgent = 'morebits.js ([[w:WT:TW]])';
/**
* CustomSet the custom user agent header, usedwhich byis WMFused for server-side logging. Set via
* Note that doing so will set the useragent for every `Morebits.wiki.api`
* {@link Morebits.wiki.api.setApiUserAgent|setApiUserAgent}.
* process performed thereafter.
*
* @see {@link https://lists.wikimedia.org/pipermail/mediawiki-api-announce/2014-November/000075.html}
Line 2,256 ⟶ 2,257:
*
* @memberof Morebits.wiki.api
* @param {string} [ua=morebits.js ([[w:WT:TW]])] - User agent. The default
* @type {string}
* value of `morebits.js ([[w:WT:TW]])` will be appended to any provided
*/
* value.
var morebitsWikiApiUserAgent = 'morebits.js ([[w:WT:TW]])';
 
/**
* Sets the custom user agent header.
*
* @memberof Morebits.wiki.api
* @param {string} [ua] - User agent.
*/
Morebits.wiki.api.setApiUserAgent = function(ua) {
Line 2,274 ⟶ 2,269:
/**
* Change/revision tag applied to Morebits actions when no other tags are specified.
* DefaultsUnused toby unuseddefault per {@link https://en.wikipedia.org/w/index.php?oldid=970618849#Adding_tags_to_Twinkle_edits_and_actions|EnWiki consensus}.
*
* @constant
Line 2,849 ⟶ 2,844:
* - `false`|`'no'`|`'nochange'`: watchlist status of the page will not be changed.
* - `'default'`|`'preferences'`: watchlist status of the page will
* be set based on the user's preference settings when the action is
* called. Ignores ability of default + expiry.
* - `'unwatch'`: explicitly unwatch the page
* - {string|number}: watch page until the specified time (relative or absolute datestring)
Line 3,271 ⟶ 3,266:
* using {@link Morebits.wiki.api} is probably preferable.
*
* Will first check if the page is queued via {@link
* {@link Morebits.wiki.page~fnProcessTriageList|fnProcessTriageList}.
*
* No error handling since we don't actually care about the errors.
Line 3,474 ⟶ 3,469:
 
/**
* When functions can't use {@link
* {@link Morebits.wiki.page~fnCanUseMwUserToken|fnCanUseMwUserToken} or
* or require checking protection or watched status, maintain the query
* in one place. Used for {@link Morebits.wiki.page#deletePage|delete},
* {@link Morebits.wiki.page#undeletePage|undelete},
Line 3,823 ⟶ 3,818:
/**
* Common checks for action methods. Used for move, undelete, delete,
* protect, stabilize.
*
* @param {string} action - The action being checked.
Line 4,983 ⟶ 4,978:
* @memberof Morebits.status
* @param {string} text - Before colon
* @param {string} statsstatus - After colon
* @returns {Morebits.status} - `status`-type (blue)
*/
Line 4,992 ⟶ 4,987:
* @memberof Morebits.status
* @param {string} text - Before colon
* @param {string} statsstatus - After colon
* @returns {Morebits.status} - `info`-type (green)
*/
Line 5,001 ⟶ 4,996:
* @memberof Morebits.status
* @param {string} text - Before colon
* @param {string} statsstatus - After colon
* @returns {Morebits.status} - `warn`-type (red)
*/
Line 5,010 ⟶ 5,005:
* @memberof Morebits.status
* @param {string} text - Before colon
* @param {string} statsstatus - After colon
* @returns {Morebits.status} - `error`-type (bold red)
*/
Line 5,149 ⟶ 5,144:
* `run(worker, postFinish)`: Runs the callback `worker` for each page in the
* list. The callback must call `workerSuccess` when succeeding, or
* `workerFailure` when failing. If using {@link Morebits.wiki.api} or {@link
* {@link Morebits.wiki.page}, this is easily done by passing these two functions as
* functions as parameters to the methods on those objects: for instance,
* `page.save(batchOp.workerSuccess, batchOp.workerFailure)`. Make sure the
* methods are called directly if special success/failure cases arise. If you