gdfgd
This commit is contained in:
+16
-1
@@ -46,6 +46,7 @@
|
||||
const tagsContainer = document.querySelector("#tags");
|
||||
if (!tagsContainer) return;
|
||||
const inner = tagsContainer.querySelector(".tags-inner") || tagsContainer;
|
||||
const activePostId = tagsContainer.dataset.itemId || (typeof window.getCurrentItemId === 'function' ? window.getCurrentItemId() : null);
|
||||
|
||||
const canManage = !!(
|
||||
document.querySelector('#tags[data-can-manage="true"]') ||
|
||||
@@ -76,7 +77,7 @@
|
||||
contentEl.textContent = tag.tag;
|
||||
} else {
|
||||
contentEl = document.createElement("a");
|
||||
contentEl.href = `/tag/${tag.normalized}`;
|
||||
contentEl.href = "/tag/" + tag.normalized;
|
||||
contentEl.style = "color: inherit !important";
|
||||
contentEl.textContent = tag.tag;
|
||||
}
|
||||
@@ -92,6 +93,7 @@
|
||||
if (isRating) {
|
||||
span.classList.add('rating-tag', `is-${tag.normalized}`);
|
||||
span.dataset.rating = tag.normalized;
|
||||
if (activePostId) span.dataset.itemId = activePostId;
|
||||
if (canManage) {
|
||||
span.classList.add('can-cycle');
|
||||
}
|
||||
@@ -120,6 +122,7 @@
|
||||
const untaggedSpan = document.createElement("span");
|
||||
untaggedSpan.className = `badge badge-untagged rating-tag is-untagged${canManage ? ' can-cycle' : ''}`;
|
||||
untaggedSpan.dataset.rating = 'untagged';
|
||||
if (activePostId) untaggedSpan.dataset.itemId = activePostId;
|
||||
const lbl = document.createElement("span");
|
||||
lbl.className = "rating-label";
|
||||
lbl.textContent = "untagged";
|
||||
@@ -135,6 +138,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Update thumbnail data-mode in background grid (ensures div.posts > a > p::before updates in Onara)
|
||||
if (activePostId) {
|
||||
const modeAttr = lastRatingTag ? lastRatingTag.normalized : 'null';
|
||||
document.querySelectorAll(`.posts > a.thumb[data-item-id="${activePostId}"], .posts a[data-item-id="${activePostId}"], .posts a[href$="/${activePostId}"]`).forEach(th => {
|
||||
th.setAttribute('data-mode', modeAttr);
|
||||
});
|
||||
if (document.body.classList.contains('onara-modal-open')) {
|
||||
const onaraThumb = document.querySelector('.posts > a.thumb.onara-active');
|
||||
if (onaraThumb) onaraThumb.setAttribute('data-mode', modeAttr);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle show more/less toggle visibility and count
|
||||
const allBadges = [...inner.querySelectorAll(".badge")];
|
||||
const realTags = allBadges.filter(b => !b.querySelector('#a_addtag') && !b.querySelector('#a_toggle') && !b.classList.contains('tag-ac-wrapper'));
|
||||
|
||||
Reference in New Issue
Block a user