|
|
@ -16,30 +16,15 @@ const x_scale = { |
|
|
|
ticks: { |
|
|
|
ticks: { |
|
|
|
callback: (value, index, ticks) => { |
|
|
|
callback: (value, index, ticks) => { |
|
|
|
let tickdate = new Date(value); |
|
|
|
let tickdate = new Date(value); |
|
|
|
if (index === 0) return `${tickdate.getDate()}.${month_names[tickdate.getMonth()]}`; |
|
|
|
if (index === 0) return `${tickdate.getDate()}.${tickdate.getMonth() + 1}.`; |
|
|
|
let prev_tickdate = new Date(ticks[index-1].value); |
|
|
|
let prev_tickdate = new Date(ticks[index-1].value); |
|
|
|
if (prev_tickdate.getDate() === tickdate.getDate()) { |
|
|
|
if (prev_tickdate.getDate() === tickdate.getDate()) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
return `${tickdate.getDate()}.${month_names[tickdate.getMonth()]}`; |
|
|
|
return `${tickdate.getDate()}.${tickdate.getMonth() + 1}.`; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const zoom_plugin = { |
|
|
|
|
|
|
|
zoom: { |
|
|
|
|
|
|
|
wheel: { |
|
|
|
|
|
|
|
enabled: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
pinch: { |
|
|
|
|
|
|
|
enabled: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
mode: "x", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
pan: { |
|
|
|
|
|
|
|
enabled: true, |
|
|
|
|
|
|
|
mode: "x", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.onload = create_charts; |
|
|
|
window.onload = create_charts; |
|
|
|
|
|
|
|
|
|
|
@ -123,8 +108,7 @@ async function create_charts() { |
|
|
|
return context[0].dataset.label; |
|
|
|
return context[0].dataset.label; |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
zoom: zoom_plugin, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
scales: { |
|
|
|
scales: { |
|
|
|
x: x_scale, |
|
|
|
x: x_scale, |
|
|
@ -158,8 +142,7 @@ async function create_charts() { |
|
|
|
return context[0].dataset.label; |
|
|
|
return context[0].dataset.label; |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
zoom: zoom_plugin, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
scales: { |
|
|
|
scales: { |
|
|
|
x: x_scale, |
|
|
|
x: x_scale, |
|
|
@ -207,8 +190,7 @@ async function create_charts() { |
|
|
|
return context[0].dataset.label; |
|
|
|
return context[0].dataset.label; |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
zoom: zoom_plugin, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
scales: { |
|
|
|
scales: { |
|
|
|
x: x_scale, |
|
|
|
x: x_scale, |
|
|
@ -304,16 +286,15 @@ function toggle_combined_chart() { |
|
|
|
chart.classList.add("closed"); |
|
|
|
chart.classList.add("closed"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
function toggle_leaderboard_chart(event) { |
|
|
|
function toggle_leaderboard_chart() { |
|
|
|
if (this.classList.contains("closed")) { |
|
|
|
if (this.classList.contains("closed")) { |
|
|
|
this.classList.remove("closed"); |
|
|
|
this.classList.remove("closed"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (event.target.nodeName === "CANVAS") return; |
|
|
|
|
|
|
|
this.classList.add("closed"); |
|
|
|
this.classList.add("closed"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
document.querySelectorAll("button.open-general-graph").forEach(element => element.addEventListener("click", toggle_combined_chart)); |
|
|
|
document.querySelectorAll("button.open-general-graph").forEach(element => element.addEventListener("click", toggle_combined_chart)); |
|
|
|
document.querySelectorAll("button.leaderboard-element").forEach(element => element.addEventListener("mousedown", toggle_leaderboard_chart)); |
|
|
|
document.querySelectorAll("button.leaderboard-element").forEach(element => element.addEventListener("click", toggle_leaderboard_chart)); |
|
|
|
|
|
|
|
|
|
|
|
async function update_leaderboard_entries() { |
|
|
|
async function update_leaderboard_entries() { |
|
|
|
this.disabled = true; |
|
|
|
this.disabled = true; |
|
|
@ -364,7 +345,6 @@ function format_time_minsec(date) { |
|
|
|
} |
|
|
|
} |
|
|
|
return min + trenner + nullausgleich + date.getSeconds() + format; |
|
|
|
return min + trenner + nullausgleich + date.getSeconds() + format; |
|
|
|
} |
|
|
|
} |
|
|
|
const month_names = ["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function update_leaderboard_elements() { |
|
|
|
async function update_leaderboard_elements() { |
|
|
|
fetch(`./leaderboard_list.php`, { |
|
|
|
fetch(`./leaderboard_list.php`, { |
|
|
|