mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-11 18:04:27 +08:00
Merge pull request #426 from corey-b/master
Saved chart accuracy toggle to user config
This commit is contained in:
commit
5214e754d7
3 changed files with 48 additions and 16 deletions
|
|
@ -2628,6 +2628,17 @@ key {
|
|||
background: var(--main-color);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
&:hover {
|
||||
color: var(--sub-color);
|
||||
background: var(--bg-color);
|
||||
cursor: default;
|
||||
}
|
||||
color: var(--sub-color);
|
||||
background: var(--bg-color);
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.text-button {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
$(".pageLogin .register input").keyup((e) => {
|
||||
if ($(".pageLogin .register .button").hasClass("disabled")) return;
|
||||
if (e.key == "Enter") {
|
||||
signUp();
|
||||
}
|
||||
});
|
||||
|
||||
$(".pageLogin .register .button").click((e) => {
|
||||
if ($(".pageLogin .register .button").hasClass("disabled")) return;
|
||||
signUp();
|
||||
});
|
||||
|
||||
|
|
@ -96,6 +98,7 @@ function signIn() {
|
|||
let dontCheckUserName = false;
|
||||
|
||||
function signUp() {
|
||||
$(".pageLogin .register .button").addClass("disabled");
|
||||
$(".pageLogin .preloader").removeClass("hidden");
|
||||
let nname = $(".pageLogin .register input")[0].value;
|
||||
let email = $(".pageLogin .register input")[1].value;
|
||||
|
|
@ -108,6 +111,7 @@ function signUp() {
|
|||
if (d.data === -1) {
|
||||
showNotification("Name unavailable", 3000);
|
||||
$(".pageLogin .preloader").addClass("hidden");
|
||||
$(".pageLogin .register .button").removeClass("disabled");
|
||||
return;
|
||||
} else if (d.data === -2) {
|
||||
showNotification(
|
||||
|
|
@ -115,11 +119,13 @@ function signUp() {
|
|||
8000
|
||||
);
|
||||
$(".pageLogin .preloader").addClass("hidden");
|
||||
$(".pageLogin .register .button").removeClass("disabled");
|
||||
return;
|
||||
} else if (d.data === 1) {
|
||||
if (password != passwordVerify) {
|
||||
showNotification("Passwords do not match", 3000);
|
||||
$(".pageLogin .preloader").addClass("hidden");
|
||||
$(".pageLogin .register .button").removeClass("disabled");
|
||||
return;
|
||||
}
|
||||
firebase
|
||||
|
|
@ -171,9 +177,11 @@ function signUp() {
|
|||
}
|
||||
changePage("account");
|
||||
usr.sendEmailVerification();
|
||||
$(".pageLogin .register .button").removeClass("disabled");
|
||||
})
|
||||
.catch(function (error) {
|
||||
// An error happened.
|
||||
$(".pageLogin .register .button").removeClass("disabled");
|
||||
console.error(error);
|
||||
usr
|
||||
.delete()
|
||||
|
|
@ -193,6 +201,7 @@ function signUp() {
|
|||
})
|
||||
.catch(function (error) {
|
||||
// Handle Errors here.
|
||||
$(".pageLogin .register .button").removeClass("disabled");
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
showNotification(errorMessage, 5000);
|
||||
|
|
@ -2494,21 +2503,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