<script>
function moveTagsToTitle() {
const mainLinks = document.querySelectorAll('.main-link');
mainLinks.forEach(mainLink => {
const discourseTags = mainLink.querySelector('.discourse-tags');
const titleElement = mainLink.querySelector('.title');
if (discourseTags && titleElement) {
const tags = discourseTags.querySelectorAll('.discourse-tag');
tags.forEach(tag => {
const tagSpan = document.createElement('span');
tagSpan.className = 'discourse-tag box';
tagSpan.textContent = tag.textContent;
tagSpan.style.fontSize = 'var(--font-down-2)';
tagSpan.style.borderRadius = '10px';
tagSpan.style.border = '1px solid #444460';
tagSpan.style.backgroundColor = '#1f1f33';
tagSpan.style.margin = '2px';
tagSpan.style.display = 'inline-block';
tagSpan.style.overflow = 'hidden';
tagSpan.style.whiteSpace = 'nowrap';
tagSpan.style.textOverflow = 'ellipsis';
tagSpan.style.verticalAlign = 'middle';
tagSpan.style.marginRight = '5px';
tagSpan.style.marginLeft = '-6px';
titleElement.insertBefore(tagSpan, titleElement.firstChild);
});
if (discourseTags.parentNode) {
discourseTags.parentNode.removeChild(discourseTags);
}
}
});
const topicHeaderExtras = document.querySelectorAll('.topic-header-extra');
topicHeaderExtras.forEach(topicHeaderExtra => {
const discourseTags = topicHeaderExtra.querySelector('.discourse-tags');
const tags = discourseTags.querySelectorAll('.discourse-tag');
tags.forEach(tag => {
tag.className = 'discourse-tag box';
tag.style.borderRadius = '10px';
tag.style.border = '1px solid #444460';
tag.style.backgroundColor = '#1f1f33';
tag.style.margin = '1px';
tag.style.padding = '2px 8px';
tag.style.display = 'inline-block';
tag.style.overflow = 'hidden';
tag.style.whiteSpace = 'nowrap';
tag.style.textOverflow = 'ellipsis';
tag.style.verticalAlign = 'middle';
tag.style.marginRight = '5px';
tag.style.marginBottom = '5px';
});
});
}
window.addEventListener('load', moveTagsToTitle);
const observer = new MutationObserver(moveTagsToTitle);
const targetNode = document.body;
const observerOptions = {
childList: true,
subtree: true
};
observer.observe(targetNode, observerOptions);
</script>
These codes cause this error.
I don’t know how can I fix.
I need these codes ![]()