mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-21 17:09:45 +08:00
Saved chart accuracy toggle to user config
This commit is contained in:
parent
4850628da5
commit
df0730cac5
2 changed files with 28 additions and 16 deletions
|
|
@ -2494,21 +2494,6 @@ function hideResultEditTagsPanel() {
|
|||
}
|
||||
}
|
||||
|
||||
let chartAccuracyVisible = true;
|
||||
|
||||
function toggleChartAccuracy() {
|
||||
if (chartAccuracyVisible) {
|
||||
resultHistoryChart.data.datasets[1].hidden = true;
|
||||
resultHistoryChart.options.scales.yAxes[1].display = false;
|
||||
chartAccuracyVisible = false;
|
||||
} else {
|
||||
resultHistoryChart.data.datasets[1].hidden = false;
|
||||
resultHistoryChart.options.scales.yAxes[1].display = true;
|
||||
chartAccuracyVisible = true;
|
||||
}
|
||||
resultHistoryChart.update();
|
||||
}
|
||||
|
||||
$(".pageAccount .toggleAccuracyOnChart").click((params) => {
|
||||
toggleChartAccuracy();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ let defaultConfig = {
|
|||
showOutOfFocusWarning: true,
|
||||
paceCaret: "off",
|
||||
paceCaretCustomSpeed: 100,
|
||||
pageWidth: "100"
|
||||
pageWidth: "100",
|
||||
chartAccuracy: true
|
||||
};
|
||||
|
||||
let cookieConfig = null;
|
||||
|
|
@ -203,6 +204,7 @@ function applyConfig(configObj) {
|
|||
setPaceCaret(configObj.paceCaret, true);
|
||||
setPaceCaretCustomSpeed(configObj.paceCaretCustomSpeed, true);
|
||||
setPageWidth(configObj.pageWidth, true);
|
||||
setChartAccuracy(configObj.chartAccuracy, true);
|
||||
|
||||
config.startGraphsAtZero = configObj.startGraphsAtZero;
|
||||
// if (
|
||||
|
|
@ -308,6 +310,31 @@ function setBlindMode(blind, nosave) {
|
|||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
function updateChartAccuracy() {
|
||||
resultHistoryChart.data.datasets[1].hidden = !config.chartAccuracy;
|
||||
resultHistoryChart.options.scales.yAxes[1].display = config.chartAccuracy;
|
||||
resultHistoryChart.update();
|
||||
}
|
||||
|
||||
function toggleChartAccuracy() {
|
||||
if (config.chartAccuracy) {
|
||||
config.chartAccuracy = false;
|
||||
} else {
|
||||
config.chartAccuracy = true;
|
||||
}
|
||||
updateChartAccuracy();
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
function setChartAccuracy(chartAccuracy, nosave) {
|
||||
if (chartAccuracy == undefined) {
|
||||
chartAccuracy = true;
|
||||
}
|
||||
config.chartAccuracy = chartAccuracy;
|
||||
updateChartAccuracy();
|
||||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
//read ahead mode
|
||||
// function toggleReadAheadMode() {
|
||||
// config.readAheadMode = !config.readAheadMode;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue