From 3f59c9e8b2b59829d48ba55a44d261f9cf369a9b Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Fri, 29 Sep 2023 12:52:34 +0200 Subject: [PATCH] Replace deprecated String.prototype.substr() String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with slice() which works similarily but isn't deprecated. Signed-off-by: Tobias Speicher --- src/modules/chat/tokenizers.jsx | 2 +- src/modules/main_menu/components/chat-tester.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/chat/tokenizers.jsx b/src/modules/chat/tokenizers.jsx index 31084d27..161e17c0 100644 --- a/src/modules/chat/tokenizers.jsx +++ b/src/modules/chat/tokenizers.jsx @@ -376,7 +376,7 @@ function mention_processAll(tokens, msg, user, color_mentions) { this.applyHighlight(msg, priority, null, 'mention', true); // Push the remaining text from the token. - text.push(segment.substr(match[0].length)); + text.push(segment.slice(match[0].length)); } } else diff --git a/src/modules/main_menu/components/chat-tester.vue b/src/modules/main_menu/components/chat-tester.vue index 521f949b..ef235db5 100644 --- a/src/modules/main_menu/components/chat-tester.vue +++ b/src/modules/main_menu/components/chat-tester.vue @@ -438,8 +438,8 @@ export default { if ( idx === -1 ) msg.user = null; else { - msg.user = msg.prefix.substr(0, idx); - msg.prefix = msg.prefix.substr(idx); + msg.user = msg.prefix.slice(0, idx); + msg.prefix = msg.prefix.slice(idx); } return msg;