MediaWiki:Gadget-morebits.js: Difference between revisions
Content deleted Content added
Repo at 5152750: revert $.extend autofixes (#2107); autofix some eslint unicorn/prefer-string-slice (#2089) |
Repo at 04d11bb: fix no-underscore-dangle (#2114); fix no-throw-literal (#2102); fix no-useless-concat (#2100); fix prefer-const (#2099) |
||
Line 267:
namespaces = [namespaces];
}
let regex; $.each(mw.config.get('wgNamespaceIds'), (name, number) => {
if (namespaces.indexOf(number) !== -1) {
Line 1,405 ⟶ 1,406:
ipv6 = Morebits.ip.sanitizeIPv6(ipv6);
const ip_re = /^((?:[0-9A-F]{1,4}:){4})(?:[0-9A-F]{1,4}:){3}[0-9A-F]{1,4}(?:\/\d{1,3})?$/;
// eslint-disable-next-line no-useless-concat
return ipv6.replace(ip_re, '$1' + '0:0:0:0/64');
}
Line 1,501 ⟶ 1,503:
let reason = (str || '').toString().trim();
const unbinder = new Morebits.unbinder(reason);
// eslint-disable-next-line no-useless-concat
unbinder.unbind('<no' + 'wiki>', '</no' + 'wiki>');
unbinder.content = unbinder.content.replace(/\|/g, '{{subst:!}}');
Line 1,586 ⟶ 1,589:
uniq: function(arr) {
if (!Array.isArray(arr)) {
throw new Error('A non-array object passed to Morebits.array.uniq');
}
return arr.filter((item, idx) => arr.indexOf(item) === idx);
Line 1,601 ⟶ 1,604:
dups: function(arr) {
if (!Array.isArray(arr)) {
throw new Error('A non-array object passed to Morebits.array.dups');
}
return arr.filter((item, idx) => arr.indexOf(item) !== idx);
Line 1,616 ⟶ 1,619:
chunk: function(arr, size) {
if (!Array.isArray(arr)) {
throw new Error('A non-array object passed to Morebits.array.chunk');
}
if (typeof size !== 'number' || size <= 0) { // pretty impossible to do anything :)
Line 1,812 ⟶ 1,815:
if (digitMatch) {
// ..... year ... month .. date ... hour .... minute ..... second
this.
}
} else if (typeof param === 'string') {
Line 1,818 ⟶ 1,821:
const dateParts = Morebits.l10n.signatureTimestampFormat(param);
if (dateParts) {
this.
}
}
}
if (!this.
// Try standard date
this.
}
Line 2,146 ⟶ 2,149:
Object.getOwnPropertyNames(Date.prototype).forEach((func) => {
Morebits.date.prototype[func] = function() {
return this.
};
});
Line 3,832 ⟶ 3,835:
}
let rev;
ctx.pageExists = !page.missing;
if (ctx.pageExists) {
Line 5,232 ⟶ 5,236:
Morebits.status.errorEvent = handler;
} else {
throw new Error('Morebits.status.onError: handler is not a function');
}
};
|