You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
1004 B

fetch('/world_comment')
.then(response => response.json())
.then(data => {
const container = document.getElementById('container');
data.forEach(entry => {
const div = document.createElement('div');
div.id = 'l2';
div.style.setProperty('--t', entry.time);
const innerDiv = document.createElement('div');
entry.items.forEach(item => {
const span = document.createElement('span');
span.textContent = item;
innerDiv.appendChild(span);
});
div.appendChild(innerDiv.cloneNode(true)); // 克隆一份 innerDiv
div.appendChild(innerDiv); // 添加原始 innerDiv
container.appendChild(div);
});
})
.catch(error => console.error('Error fetching data:', error));