Skip to content

Commit

Permalink
use string.endsWith()
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Jul 19, 2023
1 parent f4e4203 commit a678668
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions modules/friendlytag.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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;
Expand Down

0 comments on commit a678668

Please sign in to comment.