Skip to content
Snippets Groups Projects
Commit 0d6e471f authored by TonyFord's avatar TonyFord
Browse files

move to html/

parent 19499f49
No related branches found
No related tags found
No related merge requests found
Showing with 482 additions and 0 deletions
---
saison: '26'
date: '2021-10-11'
step: 1
finals_step: 2
---
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="assets/css/custom.css">
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/script.js"></script>
</head>
<body>
<script>
var DATA={{ site.data | jsonify }};
const STEP={{ page.step | default: '1' }};
const FINALS_STEP={{ page.finals_step | default: '0' }};
$(document).ready( function(){
calculatePartien('{{ page.saison }}', '{{ page.date }}');
calculateTabelle('{{ page.saison }}', '7');
}
);
</script>
<div id="partien" class="div_left">
</div>
<div class="div_right">
<h2 class="tabelle">Tabelle</h2>
<table id="tabelle" class="tabelle">
<thead>
<tr>
<th>Pl.</th>
<th>Sp.</th>
<th>Team</th>
<th>S/U/N</th>
<th>Hist.</th>
<th>Tore</th>
<th>Dif</th>
<th>Pkt.</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</body>
</html>
T,H,A,TH,TA,MID
2021-10-11,BW,CM,0,2,885778
2021-10-11,XX,IS,0,2,0
T,H,A,TH,TA,MID
2021-10-12,BW,XX,2,0,0
2021-10-12,CM,IS,3,1,885797
T,H,A,TH,TA,MID
2021-10-13,BW,IS,0,0,885800
2021-10-13,CM,XX,2,0,0
T,H,A,TH,TA,MID
2021-10-14,CM,BW,0,1,885813
2021-10-14,IS,XX,2,0,0
T,H,A,TH,TA,MID
2021-10-15,XX,BW,0,2,0
2021-10-15,IS,CM,0,2,885837
T,H,A,TH,TA,MID
2021-10-16,IS,BW,1,0,885840
2021-10-16,XX,CM,0,2,0
T,H,A,TH,TA,MID
2021-10-24,CM,IS,3,0,885893
T,H,A,TH,TA,MID
2021-10-22,CM,XX,2,0,0
2021-10-22,BW,IS,0,3,885873
kontinent: Afrika
id: BW
name: Botswana (NL)
link: 'https://ultrasoccer.de/players/?id=1452'
manager: FC Lampertheim
start: 26
kontinent: Afrika
id: CM
name: KAMERUN (NL)
link: 'https://ultrasoccer.de/players/?id=687'
manager: lipeco
start: 26
kontinent: Europa
id: IS
name: Island (NL)
link: 'https://ultrasoccer.de/players/?id=2233'
manager: Tony Ford
start: 26
kontinent: Dummy
id: XX
name: <i>Dummy (NL)</i>
link: 'https://ultrasoccer.de/players/?id=2233'
manager: Dummy
start: 26
---
---
body {
font-family: "Helvetica", Helvetica, Arial;
font-size: 0.9em;
}
.saison {
background: darkcyan;
padding: 5px;
padding-right: 10px;
}
.runde {
background: cadetblue;
padding: 5px;
padding-right: 10px;
}
.spieltag {
background: aliceblue;
padding: 5px;
padding-right: 10px;
}
.partien {
width: 100%;
tr td {
&:nth-child(3), &:nth-child(6) {
text-align: center;
}
&:nth-child(4), &:nth-child(7) {
text-align: left;
}
&:nth-child(1) { width: 100px; }
&:nth-child(2) { width: 180px; }
&:nth-child(3) { width: 20px; }
&:nth-child(4) { width: 180px; }
&:nth-child(5) { width: 20px; }
&:nth-child(6) { width: 20px; }
&:nth-child(7) { width: 20px; }
}
}
.tabelle {
width: 100%;
padding: 5px;
padding-left: 10px;
}
h2.tabelle {
background: cornflowerblue;
}
table.tabelle {
border-collapse: collapse;
thead tr th {
text-align: left;
background: lavender;
padding:3px;
}
tbody {
tr:nth-child(2n) {
background: whitesmoke;
}
tr td a {
text-decoration: none;
color: midnightblue;
&:hover {
text-decoration: underline;
}
&:visited {
color: midnightblue;
}
}
}
td {
padding-left: 3px;
}
}
s,u,n {
display: block;
height: 13px;
width: 5px;
float:left;
margin-right:1px;
border-radius: 2px;
}
s {
background:green;
}
u {
background:goldenrod;
}
n {
background:firebrick;
}
.div_left, .div_right {
width: calc( 50% - 40px );
float: left;
padding:10px;
}
.div_left {
text-align: right;
}
.div_right {
position: fixed;
right: 20px;
top: 9px;
}
tr.begegnungen {
&:nth-child(4n+1), &:nth-child(4n+2){
background: ghostwhite;
}
td a {
text-decoration: none;
color: midnightblue;
&:hover {
text-decoration: underline;
}
&:visited {
color: midnightblue;
}
}
}
img.flags {
width: 20px;
}
This diff is collapsed.
const DAY=24*3600*1000;
function calculateTabelle(saison,runde,show=true){
$.each( DATA.teams,
function( i,v ){
//if( v[saison] == undefined )
DATA.teams[i][saison] = { P: 0, Tp: 0, Tn: 0, Td: 0, Tr: ['X'], active: (( DATA.teams[i].start <= saison )) }
}
);
$.each( ( ( DATA.ergebnisse[saison] != undefined ) ? DATA.ergebnisse[saison] : {} ),
function(k,z){
$.each(z,
function(j,w){
w.forEach(
function( v,i ){
if( runde < k || !$.isNumeric(k) ) return;
var H=DATA.teams[v.H][saison];
var A=DATA.teams[v.A][saison];
if( parseInt(v.TH) > parseInt(v.TA) ){
H.P+=3;
H.Tr.push('S');
A.Tr.push('N');
} else if( parseInt(v.TH) < parseInt(v.TA) ){
A.P+=3;
H.Tr.push('N');
A.Tr.push('S');
} else {
H.P+=1;
A.P+=1;
H.Tr.push('U');
A.Tr.push('U');
}
H.Tp+=parseInt(v.TH); H.Tn+=parseInt(v.TA); H.Td=H.Tp-H.Tn;
A.Tp+=parseInt(v.TA); A.Tn+=parseInt(v.TH); A.Td=A.Tp-A.Tn;
}
);
}
);
}
);
var Tabelle=Object.values(DATA.teams).filter( (a) => ( a.start <= saison+1 ) )
.sort(
function(a,b){
return a[saison].P < b[saison].P ||
( a[saison].P == b[saison].P && a[saison].Td < b[saison].Td ) ||
( a[saison].P == b[saison].P && a[saison].Td == b[saison].Td && a[saison].Tp < b[saison].Tp ) ||
( a[saison].P == b[saison].P && a[saison].Td == b[saison].Td && a[saison].Tp == b[saison].Tp && a.id > b.id ) ? 1 : -1;
}
);
if( !show ){
return Tabelle;
}
$('#tabelle tbody').html('');
Tabelle.forEach(
function(v,i){
if( ! v[saison].active ) return;
var tmp='<td>'+(i+1)+'</td>';
var t=v[saison].Tr.map( (a) => ( a != 'X' ) ? 1 : 0 );
if( t.length == 0 ) t.push(0);
tmp+='<td>'+t.reduce( (a,b) => a+b )+'</td>';
tmp+='<td><img class="flags" src="./images/flags/'+v.id.toLowerCase()+'.svg"> <a href="'+v.link+'" target="ultrasoccer">'+v.name.replace(/\(NL\)/g,'<sup>'+v.id+'</sup>')+'</a></td>';
tmp+='<td>'+
v[saison].Tr.map( (a) => ( ( a == 'S') ? 1 : 0 ) ).reduce( (a,b) => a+b )+'/'+
v[saison].Tr.map( (a) => ( ( a == 'U') ? 1 : 0 ) ).reduce( (a,b) => a+b )+'/'+
v[saison].Tr.map( (a) => ( ( a == 'N') ? 1 : 0 ) ).reduce( (a,b) => a+b )+'</td>';
var hist=v[saison].Tr.map( (a) => '<'+a+'></'+a+'>' ).slice(-6).join('');
tmp+='<td>'+hist+'</td>';
tmp+='<td>'+v[saison].Tp+'/'+v[saison].Tn+'</td>';
tmp+='<td>'+v[saison].Td+'</td>';
tmp+='<td>'+v[saison].P+'</td>';
$('#tabelle tbody').append('<tr>'+tmp+'</tr>')
}
);
}
var Grps=[];
function calculatePartien(saison,date){
$('#partien').append('<h2 class="saison s_'+saison+'">Saison '+saison+'</h2>');
// prüfe ob alle Rundenpartien gespielt und generiere neue Rundenpartien
var runde=0;
date=new Date(date).getTime();
do {
var done=[];
runde++;
// kalkuliere Tabelle der vergangenen Saison
var Tabelle=calculateTabelle( ( parseInt(saison)-(( runde == 1 ) ? 1 : 0 ) ).toString(), ((runde == 1) ? 7 : runde-1 ) , false);
// stelle die 4er Gruppen zusammen
Grps=[]
while( Tabelle.length > 3 ){
Grps.push( [ Tabelle.shift(), Tabelle.shift(), Tabelle.pop(), Tabelle.pop() ] );
}
var tmp='<h3 class="runde s_'+saison+' r_'+runde+'">Runde '+runde+(( Grps.length == 1 ) ? ' (Endrunde)' : '')+'</h3>';
$('#partien').append(tmp);
// Hinrunde
done.push( grpPartien(new Date(date),saison,runde,1,0,1,2,3) );
;
done.push( grpPartien(new Date(date+=DAY*STEP),saison,runde,2,0,2,1,3) );
done.push( grpPartien(new Date(date+=DAY*STEP),saison,runde,3,0,3,1,2) );
// Rückrunde
done.push( grpPartien(new Date(date+=DAY*STEP),saison,runde,4,1,0,3,2) );
done.push( grpPartien(new Date(date+=DAY*STEP),saison,runde,5,2,0,3,1) );
done.push( grpPartien(new Date(date+=DAY*STEP),saison,runde,6,3,0,2,1) );
} while( done.reduce( (a,b) => a && b ) == true && Grps.length > 1 );
var Tabelle = calculateTabelle( saison, runde, false );
Grps.shift();
Grps.push( [ Tabelle.shift(), Tabelle.shift(), Tabelle.shift(), Tabelle.shift() ] );
runde='HF';
var tmp='<h3 class="runde s_'+saison+' r_'+runde+'">Halbfinale</h3>';
$('#partien').append(tmp);
done.push( grpPartien(new Date(date+=DAY*FINALS_STEP),saison,runde,1,0,3,1,2) );
if( done.reduce( (a,b) => a && b ) == true ){
Grps.shift(); Grps.push([]);
var p1=DATA.ergebnisse[saison][runde][1][0];
if( p1.TH >= p1.TA ){ Grps[0].push( DATA.teams[p1.H] ); } else { Grps[0].push( DATA.teams[p1.A] ); }
var p2=DATA.ergebnisse[saison][runde][1][1];
if( p2.TH >= p2.TA ){ Grps[0].push( DATA.teams[p2.H] ); } else { Grps[0].push( DATA.teams[p2.A] ); }
runde='F'
var tmp='<h3 class="runde s_'+saison+' r_'+runde+'">Finale</h3>';
$('#partien').append(tmp);
done.push( grpPartien(new Date(date+=DAY*FINALS_STEP),saison,runde,1,0,1,-1,-1) );
}
}
function grpPartien( date,saison,runde,spieltag,h1,a1,h2,a2 ){
var done=true;
var tmp='';
tmp+='<h4 class="spieltag s_'+saison+' r_'+runde+' t_'+spieltag+'">Spieltag '+spieltag+'</h4>';
tmp+='<table class="partien s_'+saison+' r_'+runde+' t_'+spieltag+'">';
Grps.forEach(
function(v,i){
if( h1 == -1 || a1 == -1 ) return;
if( DATA.ergebnisse[saison] == undefined ){
var th='-'; var ta='-'; var dt='<i>'+new Date(date).toJSON().slice(0,10)+'</i>'; done=false; var match='';
} else if( DATA.ergebnisse[saison][runde] == undefined ){
var th='-'; var ta='-'; var dt='<i>'+new Date(date).toJSON().slice(0,10)+'</i>'; done=false; var match='';
} else if( DATA.ergebnisse[saison][runde][spieltag] == undefined ){
var th='-'; var ta='-'; var dt='<i>'+new Date(date).toJSON().slice(0,10)+'</i>'; done=false; var match='';
} else {
var result=DATA.ergebnisse[saison][runde][spieltag].filter( (a) => ( a.H == v[h1].id && a.A == v[a1].id ) )[0];
var th=(( result != undefined ) ? (( result.MID > 0 ) ? '<a href="https://ultrasoccer.de/match/?id='+result.MID+'" target="ultrasoccer">'+result.TH+'</a>' : result.TH ) : '-' );
var ta=(( result != undefined ) ? (( result.MID > 0 ) ? '<a href="https://ultrasoccer.de/match/?id='+result.MID+'" target="ultrasoccer">'+result.TA+'</a>' : result.TA ) : '-' );
var dt=(( result != undefined ) ? new Date(result.T).toJSON().slice(0,10) : '<i>'+new Date(date).toJSON().slice(0,10)+'</i>' );
if( result == undefined ) done=false;
}
tmp+='<tr class="begegnungen h_'+v[h1].id+' a_'+v[a1].id+'">';
tmp+='<td>'+dt+'</td>';
tmp+='<td><sup>'+v[h1].id+'</sup> '+v[h1].name.replace(/\(NL\)/g,'')+' <img class="flags" src="./images/flags/'+v[h1].id.toLowerCase()+'.svg"></td>';
tmp+='<td> - </td>';
tmp+='<td><img class="flags" src="./images/flags/'+v[a1].id.toLowerCase()+'.svg"> '+v[a1].name.replace(/\(NL\)/g,'<sup>'+v[a1].id+'</sup>')+'</td>';
tmp+='<td>'+th+'</td>';
tmp+='<td>:</td>';
tmp+='<td>'+ta+'</td>';
tmp+='</tr>';
if( h2 == -1 || a2 == -1 ) return;
if( DATA.ergebnisse[saison] == undefined ){
var th='-'; var ta='-'; var dt='<i>'+new Date(date).toJSON().slice(0,10)+'</i>'; done=false;
} else if( DATA.ergebnisse[saison][runde] == undefined ){
var th='-'; var ta='-'; var dt='<i>'+new Date(date).toJSON().slice(0,10)+'</i>'; done=false;
} else if( DATA.ergebnisse[saison][runde][spieltag] == undefined ){
var th='-'; var ta='-'; var dt='<i>'+new Date(date).toJSON().slice(0,10)+'</i>'; done=false;
} else {
var result=DATA.ergebnisse[saison][runde][spieltag].filter( (a) => a.H == v[h2].id && a.A == v[a2].id )[0];
var th=(( result != undefined ) ? (( result.MID > 0 ) ? '<a href="https://ultrasoccer.de/match/?id='+result.MID+'" target="ultrasoccer">'+result.TH+'</a>' : result.TH ) : '-' );
var ta=(( result != undefined ) ? (( result.MID > 0 ) ? '<a href="https://ultrasoccer.de/match/?id='+result.MID+'" target="ultrasoccer">'+result.TA+'</a>' : result.TA ) : '-' );
var dt=(( result != undefined ) ? new Date(result.T).toJSON().slice(0,10) : '<i>'+new Date(date).toJSON().slice(0,10)+'</i>' );
if( result == undefined ) done=false;
}
tmp+='<tr class="begegnungen h_'+v[h2].id+' a_'+v[a2].id+'">';
tmp+='<td>'+dt+'</td>';
tmp+='<td><sup>'+v[h2].id+'</sup> '+v[h2].name.replace(/\(NL\)/g,'')+' <img class="flags" src="./images/flags/'+v[h2].id.toLowerCase()+'.svg"></td>';
tmp+='<td> - </td>';
tmp+='<td><img class="flags" src="./images/flags/'+v[a2].id.toLowerCase()+'.svg"> '+v[a2].name.replace(/\(NL\)/g,'<sup>'+v[a2].id+'</sup>')+'</td>';
tmp+='<td>'+th+'</td>';
tmp+='<td>:</td>';
tmp+='<td>'+ta+'</td>';
tmp+='</tr>';
//tmp+='<tr><td colspan="7"><hr></td></tr>';
}
);
tmp+='</table>';
$('#partien').append(tmp);
return done;
}
---
---
<html>
<meta http-equiv="refresh" content="0;URL=./26.html">
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment