Browse Source

refactor(js): minor regex simplification

There is no need to match on the whole title, use two groups, then merge the
whole thing together, when we can simply search-and-replace only the matching
value.
jvoisin 5 months ago
parent
commit
57e3eaecd9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      internal/ui/static/js/app.js

+ 1 - 1
internal/ui/static/js/app.js

@@ -897,7 +897,7 @@ function updateUnreadCounterValue(delta) {
     if (window.location.href.endsWith('/unread')) {
     if (window.location.href.endsWith('/unread')) {
         const oldValue = parseInt(document.title.split('(')[1], 10);
         const oldValue = parseInt(document.title.split('(')[1], 10);
         const newValue = oldValue + delta;
         const newValue = oldValue + delta;
-        document.title = document.title.replace(/(.*?)\(\d+\)(.*?)/, `$1(${newValue})$2`);
+        document.title = document.title.replace(/\(\d+\)/, `(${newValue})`);
     }
     }
 }
 }