소스 검색

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 7 달 전
부모
커밋
57e3eaecd9
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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})`);
     }
 }