mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-01 11:48:04 +08:00
Merge branch 'master' into newnav
This commit is contained in:
commit
549adf937c
26 changed files with 488 additions and 376 deletions
|
|
@ -35,7 +35,10 @@ const CONFIG_SCHEMA = joi.object({
|
|||
mode: joi.string().valid("time", "words", "quote", "zen", "custom"),
|
||||
quoteLength: joi.array().items(joi.number()),
|
||||
language: joi.string(),
|
||||
fontSize: joi.string().valid("1", "125", "15", "2", "3", "4"),
|
||||
fontSize: joi.alternatives().try(
|
||||
joi.string().valid("1", "125", "15", "2", "3", "4"), //remove after a week
|
||||
joi.number().min(0)
|
||||
),
|
||||
freedomMode: joi.boolean(),
|
||||
difficulty: joi.string().valid("normal", "expert", "master"),
|
||||
blindMode: joi.boolean(),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#caret {
|
||||
height: 1.5rem;
|
||||
height: 1.2em;
|
||||
background: var(--caret-color);
|
||||
animation: caretFlashSmooth 1s infinite;
|
||||
position: absolute;
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
#paceCaret {
|
||||
height: 1.5rem;
|
||||
height: 1.2em;
|
||||
// background: var(--sub-color);
|
||||
background: var(--sub-color);
|
||||
opacity: 0.5;
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
border-radius: var(--roundness);
|
||||
// transition: 0.25s;
|
||||
transform-origin: top left;
|
||||
width: 2px;
|
||||
}
|
||||
|
||||
#caret,
|
||||
|
|
@ -27,7 +26,7 @@
|
|||
}
|
||||
|
||||
&.default {
|
||||
width: 2px;
|
||||
width: 0.1em;
|
||||
}
|
||||
|
||||
&.carrot {
|
||||
|
|
@ -36,16 +35,7 @@
|
|||
background-size: contain;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
width: 0.25rem;
|
||||
&.size2 {
|
||||
margin-left: -0.1rem;
|
||||
}
|
||||
&.size3 {
|
||||
margin-left: -0.2rem;
|
||||
}
|
||||
&.size4 {
|
||||
margin-left: -0.3rem;
|
||||
}
|
||||
width: 0.25em;
|
||||
}
|
||||
|
||||
&.banana {
|
||||
|
|
@ -54,20 +44,11 @@
|
|||
background-size: contain;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
width: 1rem;
|
||||
&.size2 {
|
||||
margin-left: -0.1rem;
|
||||
}
|
||||
&.size3 {
|
||||
margin-left: -0.5rem;
|
||||
}
|
||||
&.size4 {
|
||||
margin-left: -0.3rem;
|
||||
}
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
&.block {
|
||||
width: 0.7em;
|
||||
width: 0.6em;
|
||||
border-radius: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
|
@ -82,66 +63,12 @@
|
|||
&.block,
|
||||
&.outline,
|
||||
&.underline {
|
||||
margin-left: 0.1rem;
|
||||
|
||||
&.size15 {
|
||||
margin-left: 0.15rem;
|
||||
}
|
||||
|
||||
&.size2 {
|
||||
margin-left: 0.2rem;
|
||||
}
|
||||
|
||||
&.size3 {
|
||||
margin-left: 0.25em;
|
||||
}
|
||||
&.size4 {
|
||||
margin-left: 0.3rem;
|
||||
}
|
||||
margin-left: 0.1em;
|
||||
}
|
||||
|
||||
&.underline {
|
||||
height: 2px;
|
||||
width: 0.8em;
|
||||
margin-top: 1.3em;
|
||||
|
||||
&.size125 {
|
||||
margin-top: 1.8em;
|
||||
}
|
||||
|
||||
&.size15 {
|
||||
margin-top: 2.1em;
|
||||
}
|
||||
|
||||
&.size2 {
|
||||
margin-top: 2.7em;
|
||||
}
|
||||
|
||||
&.size3 {
|
||||
margin-top: 3.9em;
|
||||
}
|
||||
&.size4 {
|
||||
margin-top: 5em;
|
||||
}
|
||||
}
|
||||
|
||||
&.size125 {
|
||||
transform: scale(1.25);
|
||||
}
|
||||
|
||||
&.size15 {
|
||||
transform: scale(1.45);
|
||||
}
|
||||
|
||||
&.size2 {
|
||||
transform: scale(1.9);
|
||||
}
|
||||
|
||||
&.size3 {
|
||||
transform: scale(2.8);
|
||||
}
|
||||
|
||||
&.size4 {
|
||||
transform: scale(3.7);
|
||||
height: 0.1em;
|
||||
width: 0.6em;
|
||||
margin-top: 1.2em;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
.fas {
|
||||
margin-right: 0rem;
|
||||
vertical-align: sub;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -235,10 +235,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.fontSize .buttons {
|
||||
grid-template-columns: 1fr 1fr 1fr 1fr;
|
||||
}
|
||||
|
||||
&.themes {
|
||||
.tabContainer {
|
||||
position: relative;
|
||||
|
|
|
|||
|
|
@ -254,60 +254,32 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.tape {
|
||||
&.size125 .word {
|
||||
margin: 0.31rem 0.62rem 0.31rem 0;
|
||||
}
|
||||
|
||||
&.size15 .word {
|
||||
margin: 0.37rem 0.74rem 0.37rem 0;
|
||||
}
|
||||
|
||||
&.size2 .word {
|
||||
margin: 0.5rem 1rem 0.5rem 0;
|
||||
}
|
||||
|
||||
&.size3 .word {
|
||||
margin: 0.75rem 1.5rem 0.75rem 0;
|
||||
}
|
||||
|
||||
&.size4 .word {
|
||||
margin: 1rem 2rem 1rem 0;
|
||||
}
|
||||
&.tape .word {
|
||||
margin: 0.25em 0.5em 0.75em 0;
|
||||
}
|
||||
|
||||
&.tape.indicateTyposBelow {
|
||||
&.size125 .word {
|
||||
margin: 0.31rem 0.62rem 0.93rem 0;
|
||||
}
|
||||
&.nospace .word {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
&.size15 .word {
|
||||
margin: 0.37rem 0.74rem 1.11rem 0;
|
||||
}
|
||||
|
||||
&.size2 .word {
|
||||
margin: 0.5rem 1rem 1.5rem 0;
|
||||
}
|
||||
|
||||
&.size3 .word {
|
||||
margin: 0.75rem 1.5rem 2.25rem 0;
|
||||
}
|
||||
|
||||
&.size4 .word {
|
||||
margin: 1rem 2rem 3rem 0;
|
||||
&.arrows .word {
|
||||
margin: 0.5em 0;
|
||||
letter {
|
||||
margin: 0 0.25em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.word {
|
||||
margin: 0.25rem;
|
||||
font-size: 1em;
|
||||
line-height: 1em;
|
||||
margin: 0.25em;
|
||||
color: var(--sub-color);
|
||||
font-variant: no-common-ligatures;
|
||||
// display: flex;
|
||||
// transition: 0.25s
|
||||
/* margin-bottom: 1px; */
|
||||
border-bottom: 2px solid transparent;
|
||||
line-height: 1rem;
|
||||
letter {
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
@ -342,64 +314,19 @@
|
|||
font-size: 0.75rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#words.size125 .word {
|
||||
line-height: 1.25rem;
|
||||
font-size: 1.25rem;
|
||||
margin: 0.31rem;
|
||||
}
|
||||
|
||||
#words.size15 .word {
|
||||
line-height: 1.5rem;
|
||||
font-size: 1.5rem;
|
||||
margin: 0.37rem;
|
||||
}
|
||||
|
||||
#words.size2 .word {
|
||||
line-height: 2rem;
|
||||
font-size: 2rem;
|
||||
margin: 0.5rem;
|
||||
}
|
||||
|
||||
#words.size3 .word {
|
||||
line-height: 3rem;
|
||||
font-size: 3rem;
|
||||
margin: 0.75rem;
|
||||
}
|
||||
|
||||
#words.size4 .word {
|
||||
line-height: 4rem;
|
||||
font-size: 4rem;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
#words.nospace {
|
||||
.word {
|
||||
margin: 0.5rem 0;
|
||||
&.error {
|
||||
/* margin-bottom: 1px; */
|
||||
border-bottom: 2px solid var(--error-color);
|
||||
text-shadow: 1px 0px 0px var(--bg-color),
|
||||
// 2px 0px 0px var(--bg-color),
|
||||
-1px 0px 0px var(--bg-color),
|
||||
// -2px 0px 0px var(--bg-color),
|
||||
0px 1px 0px var(--bg-color),
|
||||
1px 1px 0px var(--bg-color), -1px 1px 0px var(--bg-color);
|
||||
}
|
||||
}
|
||||
|
||||
#words.arrows {
|
||||
.word {
|
||||
margin: 0.5rem 0;
|
||||
letter {
|
||||
margin: 0 0.25rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.word.error {
|
||||
/* margin-bottom: 1px; */
|
||||
border-bottom: 2px solid var(--error-color);
|
||||
text-shadow: 1px 0px 0px var(--bg-color),
|
||||
// 2px 0px 0px var(--bg-color),
|
||||
-1px 0px 0px var(--bg-color),
|
||||
// -2px 0px 0px var(--bg-color),
|
||||
0px 1px 0px var(--bg-color),
|
||||
1px 1px 0px var(--bg-color), -1px 1px 0px var(--bg-color);
|
||||
}
|
||||
|
||||
#words.noErrorBorder,
|
||||
#resultWordsHistory.noErrorBorder {
|
||||
.word.error {
|
||||
|
|
@ -1135,14 +1062,17 @@
|
|||
}
|
||||
#miniTimerAndLiveWpm {
|
||||
height: 0;
|
||||
margin-left: 0.37rem;
|
||||
margin-left: 0.25em;
|
||||
display: flex;
|
||||
font-size: 1rem;
|
||||
line-height: 1rem;
|
||||
margin-top: -1.5rem;
|
||||
position: absolute;
|
||||
color: black;
|
||||
|
||||
div {
|
||||
margin-top: -1.25em;
|
||||
font-size: 1em;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
.time {
|
||||
margin-right: 2rem;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export function isConfigValueValid(
|
|||
break;
|
||||
|
||||
case "number":
|
||||
if (typeof val === "number") isValid = true;
|
||||
if (typeof val === "number" && !isNaN(val)) isValid = true;
|
||||
break;
|
||||
|
||||
case "numberArray":
|
||||
|
|
|
|||
|
|
@ -1532,60 +1532,35 @@ export function setLayout(layout: string, nosave?: boolean): boolean {
|
|||
// return true;
|
||||
// }
|
||||
|
||||
export function setFontSize(
|
||||
fontSize: MonkeyTypes.FontSize,
|
||||
nosave?: boolean
|
||||
): boolean {
|
||||
export function setFontSize(fontSize: number, nosave?: boolean): boolean {
|
||||
if (
|
||||
!isConfigValueValid("font size", fontSize, [
|
||||
["1", "125", "15", "2", "3", "4"],
|
||||
])
|
||||
typeof fontSize === "string" &&
|
||||
["1", "125", "15", "2", "3", "4"].includes(fontSize)
|
||||
) {
|
||||
if (fontSize === "125") {
|
||||
fontSize = 1.25;
|
||||
} else if (fontSize === "15") {
|
||||
fontSize = 1.5;
|
||||
} else {
|
||||
fontSize = parseInt(fontSize);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isConfigValueValid("font size", fontSize, ["number"])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
config.fontSize = fontSize;
|
||||
$("#words").removeClass("size125");
|
||||
$("#caret, #paceCaret").removeClass("size125");
|
||||
$("#words").removeClass("size15");
|
||||
$("#caret, #paceCaret").removeClass("size15");
|
||||
$("#words").removeClass("size2");
|
||||
$("#caret, #paceCaret").removeClass("size2");
|
||||
$("#words").removeClass("size3");
|
||||
$("#caret, #paceCaret").removeClass("size3");
|
||||
$("#words").removeClass("size35");
|
||||
$("#caret, #paceCaret").removeClass("size35");
|
||||
$("#words").removeClass("size4");
|
||||
$("#caret, #paceCaret").removeClass("size4");
|
||||
|
||||
$("#miniTimerAndLiveWpm").removeClass("size125");
|
||||
$("#miniTimerAndLiveWpm").removeClass("size15");
|
||||
$("#miniTimerAndLiveWpm").removeClass("size2");
|
||||
$("#miniTimerAndLiveWpm").removeClass("size3");
|
||||
$("#miniTimerAndLiveWpm").removeClass("size35");
|
||||
$("#miniTimerAndLiveWpm").removeClass("size4");
|
||||
|
||||
if (fontSize == "125") {
|
||||
$("#words").addClass("size125");
|
||||
$("#caret, #paceCaret").addClass("size125");
|
||||
$("#miniTimerAndLiveWpm").addClass("size125");
|
||||
} else if (fontSize == "15") {
|
||||
$("#words").addClass("size15");
|
||||
$("#caret, #paceCaret").addClass("size15");
|
||||
$("#miniTimerAndLiveWpm").addClass("size15");
|
||||
} else if (fontSize == "2") {
|
||||
$("#words").addClass("size2");
|
||||
$("#caret, #paceCaret").addClass("size2");
|
||||
$("#miniTimerAndLiveWpm").addClass("size2");
|
||||
} else if (fontSize == "3") {
|
||||
$("#words").addClass("size3");
|
||||
$("#caret, #paceCaret").addClass("size3");
|
||||
$("#miniTimerAndLiveWpm").addClass("size3");
|
||||
} else if (fontSize == "4") {
|
||||
$("#words").addClass("size4");
|
||||
$("#caret, #paceCaret").addClass("size4");
|
||||
$("#miniTimerAndLiveWpm").addClass("size4");
|
||||
if (fontSize < 0) {
|
||||
fontSize = 1;
|
||||
}
|
||||
|
||||
config.fontSize = fontSize;
|
||||
|
||||
$("#words, #caret, #paceCaret, #miniTimerAndLiveWpm").css(
|
||||
"fontSize",
|
||||
fontSize + "rem"
|
||||
);
|
||||
|
||||
saveToLocalStorage("fontSize", nosave);
|
||||
ConfigEvent.dispatch("fontSize", config.fontSize);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export default <MonkeyTypes.Config>{
|
|||
mode: "time",
|
||||
quoteLength: [1],
|
||||
language: "english",
|
||||
fontSize: "15",
|
||||
fontSize: 1.5,
|
||||
freedomMode: false,
|
||||
resultFilters: null,
|
||||
difficulty: "normal",
|
||||
|
|
|
|||
|
|
@ -379,6 +379,7 @@ export const accountHistory: ChartWithUpdateColors<
|
|||
`punctuation: ${resultData.punctuation}` +
|
||||
"\n" +
|
||||
`language: ${resultData.language}` +
|
||||
`${resultData.isPb ? "\n\nnew personal best" : ""}` +
|
||||
"\n\n" +
|
||||
`date: ${format(
|
||||
new Date(resultData.timestamp),
|
||||
|
|
@ -698,6 +699,7 @@ export async function updateColors<
|
|||
const subcolor = await ThemeColors.get("sub");
|
||||
const maincolor = await ThemeColors.get("main");
|
||||
const errorcolor = await ThemeColors.get("error");
|
||||
const textcolor = await ThemeColors.get("text");
|
||||
|
||||
if (
|
||||
chart.data.datasets.every(
|
||||
|
|
@ -715,7 +717,12 @@ export async function updateColors<
|
|||
return;
|
||||
}
|
||||
|
||||
chart.data.datasets[0].borderColor = maincolor;
|
||||
//@ts-ignore
|
||||
chart.data.datasets[0].borderColor = (ctx): string => {
|
||||
const isPb = ctx.raw?.["isPb"];
|
||||
const color = isPb ? textcolor : maincolor;
|
||||
return color;
|
||||
};
|
||||
chart.data.datasets[1].borderColor = subcolor;
|
||||
if (chart.data.datasets[2]) {
|
||||
chart.data.datasets[2].borderColor = errorcolor;
|
||||
|
|
@ -725,7 +732,12 @@ export async function updateColors<
|
|||
if (chart.config.type === "line") {
|
||||
(
|
||||
chart.data.datasets as ChartDataset<"line", TData>[]
|
||||
)[0].pointBackgroundColor = maincolor;
|
||||
)[0].pointBackgroundColor = (ctx): string => {
|
||||
//@ts-ignore
|
||||
const isPb = ctx.raw?.["isPb"];
|
||||
const color = isPb ? textcolor : maincolor;
|
||||
return color;
|
||||
};
|
||||
} else if (chart.config.type === "bar") {
|
||||
chart.data.datasets[0].backgroundColor = maincolor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ export async function update(
|
|||
export async function updateXpBar(
|
||||
currentXp: number,
|
||||
addedXp: number,
|
||||
withDailyBonus: boolean,
|
||||
breakdown: Record<string, number>
|
||||
): Promise<void> {
|
||||
skipBreakdown = false;
|
||||
|
|
@ -97,11 +96,7 @@ export async function updateXpBar(
|
|||
}
|
||||
|
||||
const xpBarPromise = animateXpBar(startingLevel, endingLevel);
|
||||
const xpBreakdownPromise = animateXpBreakdown(
|
||||
addedXp,
|
||||
withDailyBonus,
|
||||
breakdown
|
||||
);
|
||||
const xpBreakdownPromise = animateXpBreakdown(addedXp, breakdown);
|
||||
|
||||
await Promise.all([xpBarPromise, xpBreakdownPromise]);
|
||||
await Misc.sleep(2000);
|
||||
|
|
@ -116,12 +111,8 @@ export async function updateXpBar(
|
|||
|
||||
async function animateXpBreakdown(
|
||||
addedXp: number,
|
||||
withDailyBonus: boolean,
|
||||
breakdown: Record<string, number>
|
||||
): Promise<void> {
|
||||
//
|
||||
|
||||
console.log("animateXpBreakdown", addedXp, withDailyBonus, breakdown);
|
||||
const delay = 1000;
|
||||
let total = 0;
|
||||
const xpGain = $("#menu .xpBar .xpGain");
|
||||
|
|
@ -184,10 +175,6 @@ async function animateXpBreakdown(
|
|||
);
|
||||
}
|
||||
|
||||
// $("#menu .xpBar .xpGain").text(
|
||||
// `+${addedXp} ${withDailyBonus === true ? "daily bonus" : ""}`
|
||||
// );
|
||||
|
||||
xpGain.text(`+0`);
|
||||
xpBreakdown.append(
|
||||
`<div class='text next'>time typing +${breakdown["base"]}</div>`
|
||||
|
|
@ -209,14 +196,17 @@ async function animateXpBreakdown(
|
|||
await Misc.sleep(delay);
|
||||
await append(`quote +${breakdown["quote"]}`);
|
||||
total += breakdown["quote"];
|
||||
} else if (breakdown["punctuation"]) {
|
||||
await Misc.sleep(delay);
|
||||
await append(`punctuation +${breakdown["punctuation"]}`);
|
||||
total += breakdown["punctuation"];
|
||||
} else if (breakdown["numbers"]) {
|
||||
await Misc.sleep(delay);
|
||||
await append(`numbers +${breakdown["numbers"]}`);
|
||||
total += breakdown["numbers"];
|
||||
} else {
|
||||
if (breakdown["punctuation"]) {
|
||||
await Misc.sleep(delay);
|
||||
await append(`punctuation +${breakdown["punctuation"]}`);
|
||||
total += breakdown["punctuation"];
|
||||
}
|
||||
if (breakdown["numbers"]) {
|
||||
await Misc.sleep(delay);
|
||||
await append(`numbers +${breakdown["numbers"]}`);
|
||||
total += breakdown["numbers"];
|
||||
}
|
||||
}
|
||||
|
||||
if (skipBreakdown) return;
|
||||
|
|
|
|||
|
|
@ -2391,67 +2391,6 @@ const commandsStopOnError: MonkeyTypes.CommandsGroup = {
|
|||
],
|
||||
};
|
||||
|
||||
const commandsFontSize: MonkeyTypes.CommandsGroup = {
|
||||
title: "Font size...",
|
||||
configKey: "fontSize",
|
||||
list: [
|
||||
{
|
||||
id: "changeFontSize1",
|
||||
display: "1x",
|
||||
configValue: "1",
|
||||
exec: (): void => {
|
||||
UpdateConfig.setFontSize("1");
|
||||
TestLogic.restart();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeFontSize125",
|
||||
display: "1.25x",
|
||||
configValue: "125",
|
||||
exec: (): void => {
|
||||
UpdateConfig.setFontSize("125");
|
||||
TestLogic.restart();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeFontSize15",
|
||||
display: "1.5x",
|
||||
configValue: "15",
|
||||
exec: (): void => {
|
||||
UpdateConfig.setFontSize("15");
|
||||
TestLogic.restart();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeFontSize2",
|
||||
display: "2x",
|
||||
configValue: "2",
|
||||
exec: (): void => {
|
||||
UpdateConfig.setFontSize("2");
|
||||
TestLogic.restart();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeFontSize3",
|
||||
display: "3x",
|
||||
configValue: "3",
|
||||
exec: (): void => {
|
||||
UpdateConfig.setFontSize("3");
|
||||
TestLogic.restart();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeFontSize4",
|
||||
display: "4x",
|
||||
configValue: "4",
|
||||
exec: (): void => {
|
||||
UpdateConfig.setFontSize("4");
|
||||
TestLogic.restart();
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const commandsPageWidth: MonkeyTypes.CommandsGroup = {
|
||||
title: "Page width...",
|
||||
configKey: "pageWidth",
|
||||
|
|
@ -2978,15 +2917,6 @@ export const defaultCommands: MonkeyTypes.CommandsGroup = {
|
|||
icon: "fa-ad",
|
||||
subgroup: commandsEnableAds,
|
||||
},
|
||||
{
|
||||
id: "watchVideoAd",
|
||||
display: "Watch video ad",
|
||||
alias: "support donate",
|
||||
icon: "fa-ad",
|
||||
exec: (): void => {
|
||||
VideoAdPopup.show();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeTheme",
|
||||
display: "Theme...",
|
||||
|
|
@ -3189,7 +3119,14 @@ export const defaultCommands: MonkeyTypes.CommandsGroup = {
|
|||
id: "changeFontSize",
|
||||
display: "Font size...",
|
||||
icon: "fa-font",
|
||||
subgroup: commandsFontSize,
|
||||
input: true,
|
||||
exec: (input): void => {
|
||||
if (!input) return;
|
||||
UpdateConfig.setFontSize(parseFloat(input));
|
||||
setTimeout(() => {
|
||||
TestUI.updateWordsHeight();
|
||||
}, 0); //honestly no clue why it i need to wait for the next event loop to do this
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "changeFontFamily",
|
||||
|
|
@ -3433,6 +3370,15 @@ export const defaultCommands: MonkeyTypes.CommandsGroup = {
|
|||
visible: false,
|
||||
subgroup: commandsMonkeyPowerLevel,
|
||||
},
|
||||
{
|
||||
id: "watchVideoAd",
|
||||
display: "Watch video ad",
|
||||
alias: "support donate",
|
||||
icon: "fa-ad",
|
||||
exec: (): void => {
|
||||
VideoAdPopup.show();
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "shareTestSettings",
|
||||
display: "Share test settings",
|
||||
|
|
|
|||
|
|
@ -614,7 +614,10 @@ $(document).on("keydown", (e) => {
|
|||
$.each(entries, (index, obj) => {
|
||||
if ($(obj).hasClass("activeKeyboard")) activenum = index;
|
||||
});
|
||||
if (e.key === "ArrowUp" || (e.key === "Tab" && e.shiftKey)) {
|
||||
if (
|
||||
e.key === "ArrowUp" ||
|
||||
(e.key === "Tab" && e.shiftKey && Config.quickRestart !== "esc")
|
||||
) {
|
||||
entries.removeClass("activeKeyboard");
|
||||
if (activenum == 0) {
|
||||
$(entries[entries.length - 1]).addClass("activeKeyboard");
|
||||
|
|
@ -624,7 +627,10 @@ $(document).on("keydown", (e) => {
|
|||
hoverId = $(entries[activenum]).attr("command") as string;
|
||||
}
|
||||
}
|
||||
if (e.key === "ArrowDown" || (e.key === "Tab" && !e.shiftKey)) {
|
||||
if (
|
||||
e.key === "ArrowDown" ||
|
||||
(e.key === "Tab" && !e.shiftKey && Config.quickRestart !== "esc")
|
||||
) {
|
||||
entries.removeClass("activeKeyboard");
|
||||
if (activenum + 1 == entries.length) {
|
||||
$(entries[0]).addClass("activeKeyboard");
|
||||
|
|
|
|||
|
|
@ -598,6 +598,7 @@ function fillContent(): void {
|
|||
raw: Config.alwaysShowCPM
|
||||
? Misc.roundTo2(result.rawWpm * 5)
|
||||
: result.rawWpm,
|
||||
isPb: result.isPb ?? false,
|
||||
});
|
||||
|
||||
wpmChartData.push(result.wpm);
|
||||
|
|
|
|||
|
|
@ -533,6 +533,8 @@ export async function fillSettingsPage(): Promise<void> {
|
|||
Config.customBackground
|
||||
);
|
||||
|
||||
$(".pageSettings .section.fontSize input").val(Config.fontSize);
|
||||
|
||||
$(".pageSettings .section.customLayoutfluid input").val(
|
||||
Config.customLayoutfluid.replace(/#/g, " ")
|
||||
);
|
||||
|
|
@ -968,6 +970,32 @@ $(".pageSettings .section.customBackgroundSize .inputAndButton input").keypress(
|
|||
}
|
||||
);
|
||||
|
||||
$(".pageSettings .section.fontSize .inputAndButton .save").on("click", () => {
|
||||
const didConfigSave = UpdateConfig.setFontSize(
|
||||
parseFloat(
|
||||
$(".pageSettings .section.fontSize .inputAndButton input").val() as string
|
||||
)
|
||||
);
|
||||
if (didConfigSave) {
|
||||
Notifications.add("Saved", 1, 1);
|
||||
}
|
||||
});
|
||||
|
||||
$(".pageSettings .section.fontSize .inputAndButton input").keypress((e) => {
|
||||
if (e.key === "Enter") {
|
||||
const didConfigSave = UpdateConfig.setFontSize(
|
||||
parseFloat(
|
||||
$(
|
||||
".pageSettings .section.fontSize .inputAndButton input"
|
||||
).val() as string
|
||||
)
|
||||
);
|
||||
if (didConfigSave === true) {
|
||||
Notifications.add("Saved", 1, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".pageSettings .section.customLayoutfluid .inputAndButton .save").on(
|
||||
"click",
|
||||
() => {
|
||||
|
|
|
|||
|
|
@ -78,11 +78,11 @@ export async function updatePosition(): Promise<void> {
|
|||
? currentLetter.offsetLeft
|
||||
: currentLetter.offsetLeft + ($(currentLetter).width() ?? 0);
|
||||
const currentLetterPosTop = currentLetter.offsetTop;
|
||||
const letterHeight = $(currentLetter).height() as number;
|
||||
let newTop = 0;
|
||||
let newLeft = 0;
|
||||
|
||||
newTop = currentLetterPosTop - Math.round(letterHeight / 5);
|
||||
newTop =
|
||||
currentLetterPosTop - Config.fontSize * Misc.convertRemToPixels(1) * 0.1;
|
||||
|
||||
if (Config.tapeMode === "letter") {
|
||||
newLeft =
|
||||
|
|
|
|||
|
|
@ -184,7 +184,9 @@ export function update(expectedStepEnd: number): void {
|
|||
throw ``;
|
||||
}
|
||||
|
||||
newTop = currentLetter.offsetTop - currentLetterHeight / 5;
|
||||
newTop =
|
||||
currentLetter.offsetTop -
|
||||
Config.fontSize * Misc.convertRemToPixels(1) * 0.1;
|
||||
newLeft;
|
||||
if (settings.currentLetterIndex === -1) {
|
||||
newLeft = currentLetter.offsetLeft;
|
||||
|
|
|
|||
|
|
@ -1646,7 +1646,6 @@ async function saveResult(
|
|||
AccountButton.updateXpBar(
|
||||
snapxp,
|
||||
response.data.xp,
|
||||
response.data.dailyXpBonus,
|
||||
response.data.xpBreakdown
|
||||
);
|
||||
DB.addXp(response.data.xp);
|
||||
|
|
|
|||
|
|
@ -163,6 +163,14 @@ export function showWords(): void {
|
|||
|
||||
$("#words").html(wordsHTML);
|
||||
|
||||
if (Config.mode === "zen") {
|
||||
$(<Element>document.querySelector(".word")).remove();
|
||||
}
|
||||
|
||||
updateWordsHeight();
|
||||
}
|
||||
|
||||
export function updateWordsHeight(): void {
|
||||
$("#wordsWrapper").removeClass("hidden");
|
||||
const wordHeight = <number>(
|
||||
$(<Element>document.querySelector(".word")).outerHeight(true)
|
||||
|
|
@ -210,11 +218,6 @@ export function showWords(): void {
|
|||
$(".outOfFocusWarning").css("line-height", wordHeight * 3 + "px");
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.mode === "zen") {
|
||||
$(<Element>document.querySelector(".word")).remove();
|
||||
}
|
||||
|
||||
updateActiveElement();
|
||||
Caret.updatePosition();
|
||||
}
|
||||
|
|
|
|||
5
frontend/src/ts/types/types.d.ts
vendored
5
frontend/src/ts/types/types.d.ts
vendored
|
|
@ -38,8 +38,6 @@ declare namespace MonkeyTypes {
|
|||
|
||||
type QuoteLength = -3 | -2 | -1 | 0 | 1 | 2 | 3;
|
||||
|
||||
type FontSize = "1" | "125" | "15" | "2" | "3" | "4";
|
||||
|
||||
type CaretStyle =
|
||||
| "off"
|
||||
| "default"
|
||||
|
|
@ -149,6 +147,7 @@ declare namespace MonkeyTypes {
|
|||
timestamp: number;
|
||||
difficulty: string;
|
||||
raw: number;
|
||||
isPb: boolean;
|
||||
}
|
||||
|
||||
interface AccChartData {
|
||||
|
|
@ -320,7 +319,7 @@ declare namespace MonkeyTypes {
|
|||
mode: Mode;
|
||||
quoteLength: QuoteLength[];
|
||||
language: string;
|
||||
fontSize: FontSize;
|
||||
fontSize: number;
|
||||
freedomMode: boolean;
|
||||
resultFilters?: ResultFilters | null;
|
||||
difficulty: Difficulty;
|
||||
|
|
|
|||
|
|
@ -1442,24 +1442,10 @@
|
|||
<div class="section fontSize">
|
||||
<h1>font size</h1>
|
||||
<div class="text">Change the font size of the test words.</div>
|
||||
<div class="buttons">
|
||||
<div class="button" fontsize="1" tabindex="0" onclick="this.blur();">
|
||||
1
|
||||
</div>
|
||||
<div class="button" fontsize="125" tabindex="0" onclick="this.blur();">
|
||||
1.25
|
||||
</div>
|
||||
<div class="button" fontsize="15" tabindex="0" onclick="this.blur();">
|
||||
1.5
|
||||
</div>
|
||||
<div class="button" fontsize="2" tabindex="0" onclick="this.blur();">
|
||||
2
|
||||
</div>
|
||||
<div class="button" fontsize="3" tabindex="0" onclick="this.blur();">
|
||||
3
|
||||
</div>
|
||||
<div class="button" fontsize="4" tabindex="0" onclick="this.blur();">
|
||||
4
|
||||
<div class="inputAndButton">
|
||||
<input type="text" placeholder="font size" class="input" tabindex="0" />
|
||||
<div class="button save" tabindex="0" onclick="this.blur();">
|
||||
<i class="fas fa-save fa-fw"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@
|
|||
<div id="timerNumber" class="timerMain">
|
||||
<div>60</div>
|
||||
</div>
|
||||
<div id="miniTimerAndLiveWpm" class="timerMain size15">
|
||||
<div id="miniTimerAndLiveWpm" class="timerMain">
|
||||
<div class="time hidden">1:00</div>
|
||||
<div class="wpm hidden">60</div>
|
||||
<div class="acc hidden">100%</div>
|
||||
|
|
@ -142,9 +142,9 @@
|
|||
Click or press any key to focus
|
||||
</div>
|
||||
<div id="wordsWrapper" translate="no">
|
||||
<div id="paceCaret" class="default size15 hidden"></div>
|
||||
<div id="caret" class="default size15"></div>
|
||||
<div id="words" class="size15"></div>
|
||||
<div id="paceCaret" class="default hidden"></div>
|
||||
<div id="caret" class="default"></div>
|
||||
<div id="words"></div>
|
||||
</div>
|
||||
<div id="keymap" class="hidden"></div>
|
||||
<div id="largeLiveWpmAndAcc" class="timerMain">
|
||||
|
|
|
|||
|
|
@ -384,7 +384,8 @@
|
|||
"code_vimscript",
|
||||
"code_opencl",
|
||||
"code_visual_basic",
|
||||
"code_arduino"
|
||||
"code_arduino",
|
||||
"code_systemverilog"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -215,6 +215,7 @@
|
|||
,"code_opencl"
|
||||
,"code_visual_basic"
|
||||
,"code_arduino"
|
||||
,"code_systemverilog"
|
||||
,"hindi"
|
||||
,"hindi_1k"
|
||||
,"macedonian"
|
||||
|
|
|
|||
229
frontend/static/languages/code_systemverilog.json
Normal file
229
frontend/static/languages/code_systemverilog.json
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
{
|
||||
"name": "code_systemverilog",
|
||||
"leftToRight": true,
|
||||
"noLazyMode": true,
|
||||
"words": [
|
||||
"alias",
|
||||
"always",
|
||||
"always_comb",
|
||||
"always_ff",
|
||||
"always_latch",
|
||||
"and",
|
||||
"assert",
|
||||
"assign",
|
||||
"assume",
|
||||
"automatic",
|
||||
"before",
|
||||
"begin",
|
||||
"bind",
|
||||
"bins",
|
||||
"binsof",
|
||||
"bit",
|
||||
"break",
|
||||
"buf",
|
||||
"bufif0",
|
||||
"bufif1",
|
||||
"byte",
|
||||
"case",
|
||||
"casex",
|
||||
"casez",
|
||||
"cell",
|
||||
"chandle",
|
||||
"class",
|
||||
"clocking",
|
||||
"cmos",
|
||||
"config",
|
||||
"const",
|
||||
"constraint",
|
||||
"context",
|
||||
"continue",
|
||||
"cover",
|
||||
"covergroup",
|
||||
"coverpoint",
|
||||
"cross",
|
||||
"deassign",
|
||||
"default",
|
||||
"defparam",
|
||||
"design",
|
||||
"disable",
|
||||
"dist",
|
||||
"do",
|
||||
"edge",
|
||||
"else",
|
||||
"end",
|
||||
"endcase",
|
||||
"endclass",
|
||||
"endclocking",
|
||||
"endconfig",
|
||||
"endfunction",
|
||||
"endgenerate",
|
||||
"endgroup",
|
||||
"endinterface",
|
||||
"endmodule",
|
||||
"endpackage",
|
||||
"endprimitive",
|
||||
"endprogram",
|
||||
"endproperty",
|
||||
"endspecify",
|
||||
"endsequence",
|
||||
"endtable",
|
||||
"endtask",
|
||||
"enum",
|
||||
"event",
|
||||
"expect",
|
||||
"export",
|
||||
"extends",
|
||||
"extern",
|
||||
"final",
|
||||
"first_match",
|
||||
"for",
|
||||
"force",
|
||||
"foreach",
|
||||
"forever",
|
||||
"fork",
|
||||
"forkjoin",
|
||||
"function",
|
||||
"generate",
|
||||
"genvar",
|
||||
"highz0",
|
||||
"highz1",
|
||||
"if",
|
||||
"iff",
|
||||
"ifnone",
|
||||
"ignore_bins",
|
||||
"illegal_bins",
|
||||
"import",
|
||||
"incdir",
|
||||
"include",
|
||||
"initial",
|
||||
"inout",
|
||||
"input",
|
||||
"inside",
|
||||
"instance",
|
||||
"int",
|
||||
"integer",
|
||||
"interface",
|
||||
"intersect",
|
||||
"join",
|
||||
"join_any",
|
||||
"join_none",
|
||||
"large",
|
||||
"liblist",
|
||||
"library",
|
||||
"local",
|
||||
"localparam",
|
||||
"logic",
|
||||
"longint",
|
||||
"macromodule",
|
||||
"matches",
|
||||
"medium",
|
||||
"modport",
|
||||
"module",
|
||||
"nand",
|
||||
"negedge",
|
||||
"new",
|
||||
"nmos",
|
||||
"nor",
|
||||
"noshowcancelled",
|
||||
"not",
|
||||
"notif0",
|
||||
"notif1",
|
||||
"null",
|
||||
"or",
|
||||
"output",
|
||||
"package",
|
||||
"packed",
|
||||
"parameter",
|
||||
"pmos",
|
||||
"posedge",
|
||||
"primitive",
|
||||
"priority",
|
||||
"program",
|
||||
"property",
|
||||
"protected",
|
||||
"pull0",
|
||||
"pull1",
|
||||
"pulldown",
|
||||
"pullup",
|
||||
"pulsestyle_onevent",
|
||||
"pulsestyle_ondetect",
|
||||
"pure",
|
||||
"rand",
|
||||
"randc",
|
||||
"randcase",
|
||||
"randsequence",
|
||||
"rcmos",
|
||||
"real",
|
||||
"realtime",
|
||||
"ref",
|
||||
"reg",
|
||||
"release",
|
||||
"repeat",
|
||||
"return",
|
||||
"rnmos",
|
||||
"rpmos",
|
||||
"rtran",
|
||||
"rtranif0",
|
||||
"rtranif1",
|
||||
"scalared",
|
||||
"sequence",
|
||||
"shortint",
|
||||
"shortreal",
|
||||
"showcancelled",
|
||||
"signed",
|
||||
"small",
|
||||
"solve",
|
||||
"specify",
|
||||
"specparam",
|
||||
"static",
|
||||
"string",
|
||||
"strong0",
|
||||
"strong1",
|
||||
"struct",
|
||||
"super",
|
||||
"supply0",
|
||||
"supply1",
|
||||
"table",
|
||||
"tagged",
|
||||
"task",
|
||||
"this",
|
||||
"throughout",
|
||||
"time",
|
||||
"timeprecision",
|
||||
"timeunit",
|
||||
"tran",
|
||||
"tranif0",
|
||||
"tranif1",
|
||||
"tri",
|
||||
"tri0",
|
||||
"tri1",
|
||||
"triand",
|
||||
"trior",
|
||||
"trireg",
|
||||
"type",
|
||||
"typedef",
|
||||
"union",
|
||||
"unique",
|
||||
"unsigned",
|
||||
"use",
|
||||
"uwire",
|
||||
"var",
|
||||
"vectored",
|
||||
"virtual",
|
||||
"void",
|
||||
"wait",
|
||||
"wait_order",
|
||||
"wand",
|
||||
"weak0",
|
||||
"weak1",
|
||||
"while",
|
||||
"wildcard",
|
||||
"wire",
|
||||
"with",
|
||||
"within",
|
||||
"wor",
|
||||
"xnor",
|
||||
"xor",
|
||||
"<="
|
||||
]
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"name": "myanmar_burmese",
|
||||
"leftToRight": true,
|
||||
"ligatures": true,
|
||||
"noLazyMode": true,
|
||||
"bcp47": "my-MY",
|
||||
"bcp47": "my-MM",
|
||||
"words": [
|
||||
"အဆိုပါ",
|
||||
"ဖြစ်သည်",
|
||||
|
|
|
|||
77
frontend/static/quotes/code_systemverilog.json
Normal file
77
frontend/static/quotes/code_systemverilog.json
Normal file
File diff suppressed because one or more lines are too long
12
package-lock.json
generated
12
package-lock.json
generated
|
|
@ -1622,9 +1622,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
|
|
@ -3683,9 +3683,9 @@
|
|||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue