From a67866860e64d05ce1826d11506afdf789f4c290 Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Wed, 19 Jul 2023 12:44:39 -0700 Subject: [PATCH] use string.endsWith() --- modules/friendlytag.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/friendlytag.js b/modules/friendlytag.js index f237ce67d..f70999f53 100644 --- a/modules/friendlytag.js +++ b/modules/friendlytag.js @@ -219,12 +219,6 @@ Twinkle.tag.callback = function friendlytagCallback() { case 'redirect': Window.setTitle('Redirect tagging'); - // https://stackoverflow.com/questions/280634/endswith-in-javascript/2548133#2548133 - // Author chakrit, CC BY-SA 4.0 - var endsWith = function(str, suffix) { - return str.indexOf(suffix, str.length - suffix.length) !== -1; - }; - // If a tag has a restriction for this namespace or title, return true, so that we know not to display it in the list of check boxes. var isRestricted = function(item) { if (typeof item.restriction === 'undefined') { @@ -248,7 +242,7 @@ Twinkle.tag.callback = function friendlytagCallback() { } break; case 'disambiguationPagesOnly': - if (!endsWith(mw.config.get('wgPageName'), '_(disambiguation)')) { + if (!mw.config.get('wgPageName').endsWith('_(disambiguation)')) { return true; } break;