From 5e704b4d71f4c4c99435b07f6ac43bbda682e0c0 Mon Sep 17 00:00:00 2001 From: xiplus Date: Sun, 8 Dec 2024 10:12:28 +0800 Subject: [PATCH] Remove unused regex s flag --- modules/twinkleclose.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/twinkleclose.js b/modules/twinkleclose.js index 058f51fb..0eaee499 100644 --- a/modules/twinkleclose.js +++ b/modules/twinkleclose.js @@ -815,13 +815,13 @@ Twinkle.close.callbacks = { var params = pageobj.getCallbackParameters(); var text = pageobj.getPageText(); - + // HACK: match template w/ or w/o date param, and {{vfd|(reason)}} in one regex - if (/{{[rsaiftcmv]fd\s*\|\s*[^|}]*}}/is.test(text) && !/{{[rsaiftcmv]fd\s*\|\s*date\s*=/is.test(text)) { - text = text.replace(/({{[rsaiftcmv]fd[^|}]*)\|([^|}]*}})/is, '$1|date=' + params.date + '|$2'); - } else if (/{{[rsaiftcmv]fd[^|}]*(?:\|[^}]*)?\|(?:[^|}]*date[^|}]*=)?(?=\d{4})[^|}]*[^}]*}}/is.test(text)) { - text = text.replace(/({{[rsaiftcmv]fd[^|}]*(?:\|[^}]*)?\|(?:[^|}]*date[^|}]*=)?(?=\d{4}))[^|}]*([^}]*}})/is, '$1' + params.date + '$2'); + if (/{{[rsaiftcmv]fd\s*\|\s*[^|}]*}}/i.test(text) && !/{{[rsaiftcmv]fd\s*\|\s*date\s*=/i.test(text)) { + text = text.replace(/({{[rsaiftcmv]fd[^|}]*)\|([^|}]*}})/i, '$1|date=' + params.date + '|$2'); + } else if (/{{[rsaiftcmv]fd[^|}]*(?:\|[^}]*)?\|(?:[^|}]*date[^|}]*=)?(?=\d{4})[^|}]*[^}]*}}/i.test(text)) { + text = text.replace(/({{[rsaiftcmv]fd[^|}]*(?:\|[^}]*)?\|(?:[^|}]*date[^|}]*=)?(?=\d{4}))[^|}]*([^}]*}})/i, '$1' + params.date + '$2'); } else { Morebits.status.warn(conv({ hans: '重新标记', hant: '重新標記' }), conv({ hans: '找不到提删模板,重新插入', hant: '找不到提刪模板,重新插入' })); // Insert tag after short description or any hatnotes