mirror of
https://hk.gh-proxy.com/https://github.com/NodeBB/nodebb-theme-harmony.git
synced 2025-10-03 05:01:05 +08:00
This commit is contained in:
parent
90d5d0d464
commit
04c6383ffe
1 changed files with 8 additions and 13 deletions
|
@ -254,22 +254,17 @@ $(document).ready(function () {
|
|||
return;
|
||||
}
|
||||
['notifications', 'chat'].forEach((type) => {
|
||||
const countEl = document.querySelector(`[component="${type}/count"]`);
|
||||
if (!countEl) {
|
||||
const countEl = $(`nav.sidebar [component="${type}/count"]`).first();
|
||||
if (!countEl.length) {
|
||||
return;
|
||||
}
|
||||
const count = parseInt(countEl.innerText, 10);
|
||||
const count = parseInt(countEl.text(), 10);
|
||||
if (count > 1) {
|
||||
const listEls = document.querySelectorAll(`[component="${type}/list"]`);
|
||||
listEls.forEach((listEl) => {
|
||||
const placeholder = listEl.querySelector('*');
|
||||
if (placeholder) {
|
||||
for (let x = 0; x < count - 1; x++) {
|
||||
const cloneEl = placeholder.cloneNode(true);
|
||||
listEl.insertBefore(cloneEl, placeholder);
|
||||
}
|
||||
}
|
||||
});
|
||||
const placeholder = $(`nav.sidebar [component="${type}/list"]`).children().first();
|
||||
for (let x = 0; x < count - 1; x++) {
|
||||
const cloneEl = placeholder.clone(true);
|
||||
cloneEl.insertAfter(placeholder);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue