Explorar el Código

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 hace 7 meses
padre
commit
57e3eaecd9
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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')) {
         const oldValue = parseInt(document.title.split('(')[1], 10);
         const newValue = oldValue + delta;
-        document.title = document.title.replace(/(.*?)\(\d+\)(.*?)/, `$1(${newValue})$2`);
+        document.title = document.title.replace(/\(\d+\)/, `(${newValue})`);
     }
 }