14 lines
		
	
	
	
		
			555 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
	
		
			555 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
document.addEventListener("DOMContentLoaded", () => {
 | 
						|
    const table = document.getElementById("download_contents").getElementsByTagName("tbody")[0];
 | 
						|
    if (table.children.length === 0) { return; }
 | 
						|
 | 
						|
    setInterval(() => {
 | 
						|
        fetch(`info?code=${CODE}`)
 | 
						|
            .then((res) => res.json())
 | 
						|
            .then((info) => {
 | 
						|
                for (const [index, offset] of info.offsets.entries()) {
 | 
						|
                    table.children[index].className = (offset > info.available) ? "unavailable" : "";
 | 
						|
                }
 | 
						|
            });
 | 
						|
    }, 5000);
 | 
						|
});
 |