2024-08-20 14:05:35 +00:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
function groupItemsByAuthor() {
|
|
|
|
const items = document.querySelectorAll('.item.entry-item');
|
2024-11-18 12:09:25 +00:00
|
|
|
if (!items.length) {
|
|
|
|
setTimeout(groupItemsByAuthor, 500); // Retry after 500 ms
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-08-20 14:05:35 +00:00
|
|
|
const grouped = {};
|
|
|
|
|
|
|
|
items.forEach(item => {
|
|
|
|
const author = item.querySelector('.item-meta-info-title a').innerText.trim();
|
|
|
|
if (!grouped[author]) {
|
|
|
|
grouped[author] = [];
|
|
|
|
}
|
|
|
|
grouped[author].push(item);
|
|
|
|
});
|
|
|
|
|
|
|
|
const container = document.querySelector('.items');
|
|
|
|
while (container.firstChild) {
|
|
|
|
container.removeChild(container.firstChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
Object.keys(grouped).forEach(author => {
|
|
|
|
const block = document.createElement('div');
|
|
|
|
block.classList.add('author-block');
|
|
|
|
const header = document.createElement('h2');
|
|
|
|
header.textContent = author;
|
|
|
|
block.appendChild(header);
|
|
|
|
|
|
|
|
grouped[author].forEach(item => {
|
|
|
|
block.appendChild(item);
|
|
|
|
});
|
|
|
|
|
|
|
|
container.appendChild(block);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-11-18 12:09:25 +00:00
|
|
|
setTimeout(groupItemsByAuthor, 500); // Delay after initial page loading
|
|
|
|
})();
|