MediaWiki:Gadget-morebits.js: Difference between revisions

Content deleted Content added
Repo at f9aea90: Update watchlist expiry handling for expiry return after T268834
Repo at 5174cbe: Add Morebits.status.status; Accept nochange option
Line 2,847:
* Basically a mix of MW API and Twinkley options available pre-expiry:
* - `true`|`'yes'`: page will be added to the user's watchlist when the action is called
* - `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
Line 2,855:
*/
this.setWatchlist = function(watchlistOption) {
if (!watchlistOption || watchlistOption === 'no' || watchlistOption === 'nochange') {
ctx.watchlistOption = 'nochange';
} else if (watchlistOption === 'default' || watchlistOption === 'preferences') {
Line 2,873:
* string, so this is here largely for completeness and compatibility.
*
* @param {string} watchlistExpiry - A date-like string or array of strings
* Can be relative (2 weeks) or other similarly date-like (i.e. NOT "potato"):
* */
* ISO 8601: 2038-01-09T03:14:07Z
* MediaWiki: 20380109031407
* UNIX: 2147483647
* SQL: 2038-01-09 03:14:07
* Can also be `infinity` or infinity-like (`infinite`, `indefinite`, and `never`).
* See {@link https://phabricator.wikimedia.org/source/mediawiki-libs-Timestamp/browse/master/src/ConvertibleTimestamp.php;4e53b859a9580c55958078f46dd4f3a44d0fcaa0$57-109?as=source&blame=off}
* */
this.setWatchlistExpiry = function(watchlistExpiry) {
ctx.watchlistExpiry = watchlistExpiry;
Line 4,973 ⟶ 4,980:
}
};
/**
* @memberof Morebits.status
* @param {string} text - Before colon
* @param {string} stats - After colon
* @returns {Morebits.status} - `status`-type (blue)
*/
Morebits.status.status = function(text, status) {
return new Morebits.status(text, status);
};
/**
* @memberof Morebits.status
* @param {string} text - Before colon
* @param {string} stats - After colon
* @returns {Morebits.status} - `info`-type (green)
*/
Morebits.status.info = function(text, status) {
return new Morebits.status(text, status, 'info');
};
/**
 
* @memberof Morebits.status
* @param {string} text - Before colon
* @param {string} stats - After colon
* @returns {Morebits.status} - `warn`-type (red)
*/
Morebits.status.warn = function(text, status) {
return new Morebits.status(text, status, 'warn');
};
/**
 
* @memberof Morebits.status
* @param {string} text - Before colon
* @param {string} stats - After colon
* @returns {Morebits.status} - `error`-type (bold red)
*/
Morebits.status.error = function(text, status) {
return new Morebits.status(text, status, 'error');