|
|
@ -91,7 +91,15 @@ async function create_charts() { |
|
|
|
return format_rank(player_entries_byName[context.dataset.label][context.parsed.x / 1000]["tier"], player_entries_byName[context.dataset.label][context.parsed.x / 1000]["rank"], player_entries_byName[context.dataset.label][context.parsed.x / 1000]["points"]) |
|
|
|
return format_rank(player_entries_byName[context.dataset.label][context.parsed.x / 1000]["tier"], player_entries_byName[context.dataset.label][context.parsed.x / 1000]["rank"], player_entries_byName[context.dataset.label][context.parsed.x / 1000]["points"]) |
|
|
|
}, |
|
|
|
}, |
|
|
|
title: items => { |
|
|
|
title: items => { |
|
|
|
return new Date(items[0].raw.x).toLocaleDateString(); |
|
|
|
let ms = items[0].raw.x; |
|
|
|
|
|
|
|
let options = { |
|
|
|
|
|
|
|
weekday: "short", |
|
|
|
|
|
|
|
day: "numeric", |
|
|
|
|
|
|
|
month: "short", |
|
|
|
|
|
|
|
hour: "2-digit", |
|
|
|
|
|
|
|
minute: "2-digit" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new Date(ms).toLocaleDateString("de-DE", options); |
|
|
|
}, |
|
|
|
}, |
|
|
|
beforeTitle: function (context) { |
|
|
|
beforeTitle: function (context) { |
|
|
|
return context[0].dataset.label; |
|
|
|
return context[0].dataset.label; |
|
|
@ -376,22 +384,24 @@ async function update_leaderboard_entries() { |
|
|
|
this.style.setProperty("--button-loading-bar-width", `${e.data * 100}%`); |
|
|
|
this.style.setProperty("--button-loading-bar-width", `${e.data * 100}%`); |
|
|
|
}) |
|
|
|
}) |
|
|
|
eventSource.addEventListener("forbidden", e => { |
|
|
|
eventSource.addEventListener("forbidden", e => { |
|
|
|
|
|
|
|
eventSource.close(); |
|
|
|
|
|
|
|
let response = JSON.parse(e.data); |
|
|
|
const currenttime = new Date(); |
|
|
|
const currenttime = new Date(); |
|
|
|
const updatetime = new Date(e.data); |
|
|
|
const updatetime = new Date(response.last); |
|
|
|
let timediff = new Date(currenttime - updatetime); |
|
|
|
let timediff = new Date(currenttime - updatetime); |
|
|
|
let resttime = new Date(600000 - (currenttime - updatetime)); |
|
|
|
let resttime = new Date( 1000 * 60 * response.limit - (currenttime - updatetime)); |
|
|
|
window.alert(`Das letzte Update wurde vor ${format_time_minsec(timediff)} durchgeführt. Versuche es in ${format_time_minsec(resttime)} noch einmal`); |
|
|
|
window.alert(`Das letzte Update wurde vor ${format_time_minsec(timediff)} durchgeführt. Versuche es in ${format_time_minsec(resttime)} noch einmal`); |
|
|
|
reset_button(this); |
|
|
|
reset_button(this); |
|
|
|
eventSource.close(); |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
eventSource.onerror = e => { |
|
|
|
eventSource.onerror = e => { |
|
|
|
|
|
|
|
eventSource.close(); |
|
|
|
window.alert(`Beim Update ist ein Fehler aufgetreten. Versuche es später noch einmal`) |
|
|
|
window.alert(`Beim Update ist ein Fehler aufgetreten. Versuche es später noch einmal`) |
|
|
|
reset_button(this); |
|
|
|
reset_button(this); |
|
|
|
eventSource.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
eventSource.addEventListener("done", e => { |
|
|
|
eventSource.addEventListener("done", e => { |
|
|
|
reset_button(this); |
|
|
|
|
|
|
|
eventSource.close(); |
|
|
|
eventSource.close(); |
|
|
|
|
|
|
|
reset_button(this); |
|
|
|
|
|
|
|
|
|
|
|
update_leaderboard_elements(); |
|
|
|
update_leaderboard_elements(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|