СЧЁТ
[html]<div id="teams-container"></div>
<script>
const CSV_URL = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vSWzITD73lNzDtny7BQBzfYOpl1d1XR2QxUnlXRP6IsdGhlSYMUvgYkCEoY5XaPk58JYlT3Er4nyV3z/pub?output=csv';
const teamImages = {
'Crowley': 'https://upforme.ru/uploads/001a/fa/19/2/570903.png',
'Agrippa': 'https://upforme.ru/uploads/001a/fa/19/2/236546.png',
'Valpurgis': 'https://upforme.ru/uploads/001a/fa/19/2/922579.png',
'Magi': 'https://upforme.ru/uploads/001a/fa/19/2/213188.png',
'Human': 'https://upforme.ru/uploads/001a/fa/19/2/291942.png'
};
const resourceImages = {
'\u044f\u0434\u043e\u0432\u0438\u0442\u044b\u0435 \u0440\u0430\u0441\u0442\u0435\u043d\u0438\u044f': 'https://forumstatic.ru/files/001a/fa/19/14516.png',
'\u043b\u0435\u0447\u0435\u0431\u043d\u044b\u0435 \u0440\u0430\u0441\u0442\u0435\u043d\u0438\u044f': 'https://forumstatic.ru/files/001a/fa/19/30721.png',
'\u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0430\u0441\u0442\u0435\u043d\u0438\u044f': 'https://forumstatic.ru/files/001a/fa/19/22081.png',
'\u0440\u0435\u0434\u043a\u0438\u0435 \u0440\u0430\u0441\u0442\u0435\u043d\u0438\u044f': 'https://forumstatic.ru/files/001a/fa/19/54096.png',
'\u043a\u0443\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0441\u0442\u0435\u043d\u0438\u044f': 'https://forumstatic.ru/files/001a/fa/19/65459.png',
'\u0446\u0432\u0435\u0442\u044b': 'https://forumstatic.ru/files/001a/fa/19/15218.png',
'\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b': 'https://forumstatic.ru/files/001a/fa/19/89095.png',
'\u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u044b': 'https://forumstatic.ru/files/001a/fa/19/90368.png',
'\u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043a\u0430\u043c\u043d\u0438 \u0438 \u043c\u0438\u043d\u0435\u0440\u0430\u043b\u044b': 'https://forumstatic.ru/files/001a/fa/19/41570.png',
'\u0440\u0435\u0434\u043a\u0438\u0435 \u043a\u0430\u043c\u043d\u0438 \u0438 \u043c\u0438\u043d\u0435\u0440\u0430\u043b\u044b': 'https://forumstatic.ru/files/001a/fa/19/16521.png',
'\u0434\u0440\u0430\u0433\u043e\u0446\u0435\u043d\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438 \u0438 \u043c\u0438\u043d\u0435\u0440\u0430\u043b\u044b': 'https://forumstatic.ru/files/001a/fa/19/14105.png',
'\u043f\u043e\u043b\u0443\u0434\u0440\u0430\u0433\u043e\u0446\u0435\u043d\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438 \u0438 \u043c\u0438\u043d\u0435\u0440\u0430\u043b\u044b': 'https://forumstatic.ru/files/001a/fa/19/85331.png',
'\u044d\u0441\u0441\u0435\u043d\u0446\u0438\u0438': 'https://forumstatic.ru/files/001a/fa/19/78437.png',
'\u0437\u0430\u0447\u0430\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0440\u0443\u0436\u0438\u0435': 'https://forumstatic.ru/files/001a/fa/19/36404.png',
'\u0436\u0435\u0437\u043b\u044b \u0438 \u043f\u043e\u0441\u043e\u0445\u0438': 'https://forumstatic.ru/files/001a/fa/19/85387.png',
'\u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0435 \u043f\u0430\u043b\u043e\u0447\u043a\u0438': 'https://forumstatic.ru/files/001a/fa/19/18618.png',
'\u0433\u0440\u0438\u043c\u0443\u0430\u0440\u044b \u0438 \u043a\u043d\u0438\u0433\u0438': 'https://forumstatic.ru/files/001a/fa/19/53546.png',
'\u0437\u0435\u043b\u044c\u044f': 'https://forumstatic.ru/files/001a/fa/19/55947.png',
'\u043a\u043e\u043b\u0431\u044b': 'https://forumstatic.ru/files/001a/fa/19/32235.png',
'\u043e\u0434\u0435\u0436\u0434\u0430': 'https://forumstatic.ru/files/001a/fa/19/15587.png',
'\u0433\u043e\u0440\u0448\u043a\u0438 \u0438 \u043a\u043e\u0442\u043b\u044b': 'https://forumstatic.ru/files/001a/fa/19/73443.png',
'\u0441\u0432\u0435\u0447\u0438': 'https://forumstatic.ru/files/001a/fa/19/37350.png',
'\u0441\u0432\u0438\u0442\u043a\u0438': 'https://forumstatic.ru/files/001a/fa/19/68963.png',
'\u043e\u0431\u0435\u0440\u0435\u0433\u0438': 'https://forumstatic.ru/files/001a/fa/19/30920.png'
};
const validTeams = ['Crowley', 'Agrippa', 'Valpurgis', 'Magi', 'Human'];
function formatNumber(n){return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,'.');}
function parseCSV(text){
var lines = text.trim().split('\n');
var headers = lines[0].split(',').map(function(h){return h.trim().replace(/^"|"$/g,'');});
var teams = [];
for(var i=1; i<lines.length; i++){
var values = lines[i].split(',').map(function(v){return v.trim().replace(/^"|"$/g,'');});
if(!values[0]) continue;
var teamName = values[0];
// ЖЁСТКИЙ ФИЛЬТР: только известные команды
if(validTeams.indexOf(teamName) === -1) continue;
var team = {name: teamName, score: parseInt(values[1]) || 0, resources: {}};
for(var j=2; j<headers.length; j++){
var resName = headers[j];
if(!resourceImages[resName]) continue;
var count = parseInt(values[j]) || 0;
if(count > 0) team.resources[resName] = count;
}
teams.push(team);
}
return teams;
}
function renderTeams(teams){
var container = document.getElementById('teams-container');
if(!container) return;
var html = '';
teams.forEach(function(team, idx){
html += '<div style="margin-bottom:20px;">';
html += '<table style="width:100%;border-collapse:collapse;"><tr>';
html += '<td style="width:220px;text-align:center;padding:10px;"><img src="'+(teamImages[team.name]||'')+'" alt="'+team.name+'" style="max-width:200px;"></td>';
html += '<td style="text-align:center;font-family:Lora,serif;font-size:18px;font-weight:bold;">'+formatNumber(team.score)+'</td>';
html += '</tr></table>';
html += '<div style="text-align:center;margin:10px 0;">';
html += '<button onclick="toggleRes('+idx+')" style="padding:10px 25px;font-family:Lora,serif;font-size:16px;font-weight:bold;text-transform:uppercase;letter-spacing:1px;cursor:pointer;background:transparent;border:2px solid #999;border-radius:12px;">\u041a\u043b\u0430\u0434\u043e\u0432\u0430\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432</button>';
html += '</div>';
html += '<div id="res-'+idx+'" style="display:none;margin-top:10px;"><table style="width:100%;border-collapse:collapse;"><tr>';
var resourceEntries = Object.entries(team.resources);
resourceEntries.forEach(function(entry, ri){
if(ri > 0 && ri % 4 === 0) html += '</tr><tr>';
html += '<td style="text-align:center;padding:10px;width:25%;">';
html += '<img src="'+(resourceImages[entry[0]]||'')+'" alt="'+entry[0]+'" style="max-width:60px;display:block;margin:0 auto 5px;">';
html += '<div style="font-family:Lora,serif;font-weight:bold;font-size:14px;">'+entry[0]+'</div>';
html += '<div style="font-family:Lora,serif;font-size:16px;margin-top:5px;">'+entry[1]+'</div>';
html += '</td>';
});
var remainder = resourceEntries.length % 4;
if(remainder > 0){
for(var k=0; k<4-remainder; k++) html += '<td style="width:25%;"></td>';
}
html += '</tr></table></div></div>';
});
container.innerHTML = html;
}
function toggleRes(i){
var el = document.getElementById('res-'+i);
if(el) el.style.display = el.style.display === 'none' ? 'block' : 'none';
}
// КЛЮЧЕВОЕ ИЗМЕНЕНИЕ: принудительная обработка UTF-8
fetch(CSV_URL)
.then(function(response){
return response.arrayBuffer();
})
.then(function(buffer){
var decoder = new TextDecoder('utf-8');
var text = decoder.decode(buffer);
return text;
})
.then(function(csv){
var teams = parseCSV(csv);
renderTeams(teams);
})
.catch(function(error){
var container = document.getElementById('teams-container');
if(container) container.innerHTML = 'Ошибка: ' + error;
});
</script>[/html]
- Подпись автора
ничто не происходит если просто ожидать

только тот, кто делает, способен побеждать























































