[JS] Fix an error in older browsers caused by replaceAll (#747)

Fixes #744
This commit is contained in:
Cinder 2024-09-03 02:07:26 -07:00 committed by GitHub
parent a20aaae0e0
commit 28ebc378e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -279,7 +279,7 @@ Autocomplete.render_item = function(list, item) {
if (item.type === "tag") {
$link.addClass("tag-type-" + item.category);
} else if (item.type === "user") {
var level_class = "user-" + item.level.replaceAll(" ", "-").toLowerCase();
var level_class = "user-" + item.level.replace(/ /g, "-").toLowerCase();
$link.addClass(level_class);
if (Utility.meta("style-usernames") === "true") {
$link.addClass("with-style");

View File

@ -2,7 +2,7 @@ let ForumTopic = {};
ForumTopic.init_mark_all_as_read = function () {
$("#subnav-mark-all-as-read-link").on("click.danbooru", () => {
return confirm(`Are you sure that you want to mark all ${$("body").data("controller").replaceAll("-", " ")} as read?`);
return confirm(`Are you sure that you want to mark all ${$("body").data("controller").replace(/-/g, " ")} as read?`);
});
};

View File

@ -140,7 +140,7 @@ class FilterToken {
this.type = FilterUtils.getFilterType(raw);
if (this.type !== "tag") raw = raw.slice(this.type.length + 1);
else if (raw.includes("*")) {
this.value = new RegExp(raw.replaceAll(/\*/g, ".*"));
this.value = new RegExp(raw.replace(/\*/g, ".*"));
this.type = "wildcard";
return;
}