mirror of
https://hk.gh-proxy.com/https://github.com/NodeBB/nodebb-theme-harmony.git
synced 2025-10-03 05:01:05 +08:00
fix: don't crash for guests @julianlam or if component is misisng
This commit is contained in:
parent
c4ae8d2ae7
commit
11685db7b1
1 changed files with 8 additions and 1 deletions
|
@ -234,8 +234,15 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
function fixPlaceholders() {
|
||||
if (!config.loggedIn) {
|
||||
return;
|
||||
}
|
||||
['notifications', 'chat'].forEach((type) => {
|
||||
const count = parseInt(document.querySelector(`[component="${type}/count"]`).innerText, 10);
|
||||
const countEl = document.querySelector(`[component="${type}/count"]`);
|
||||
if (!countEl) {
|
||||
return;
|
||||
}
|
||||
const count = parseInt(countEl.innerText, 10);
|
||||
if (count > 1) {
|
||||
const listEls = document.querySelectorAll(`[component="${type}/list"]`);
|
||||
listEls.forEach((listEl) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue