Skip to content

Commit

Permalink
Merge branch 'monkeytypegame:master' into impr(quotes)-add-English-qu…
Browse files Browse the repository at this point in the history
…otes
  • Loading branch information
donotdisturbdnd authored Dec 13, 2024
2 parents d8bcb83 + 5454414 commit eb52cfb
Show file tree
Hide file tree
Showing 11 changed files with 1,271 additions and 5 deletions.
7 changes: 7 additions & 0 deletions frontend/src/styles/test.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,13 @@ body.fb-nospace {
}
}

/* funbox underscore_spaces */
body.fb-underscore-spaces {
#words .word {
margin: 0.5em 0;
}
}

/* funbox arrows */
body.fb-arrows {
#words .word {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/ts/pages/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,9 @@ async function fillSettingsPage(): Promise<void> {
/_/g,
" "
)}</div>`;
} else if (funbox.name === "underscore_spaces") {
// Display as "underscore_spaces". Does not replace underscores with spaces.
funboxElHTML += `<div class="funbox button" data-config-value='${funbox.name}' aria-label="${funbox.description}" data-balloon-pos="up" data-balloon-length="fit">${funbox.name}</div>`;
} else {
funboxElHTML += `<div class="funbox button" data-config-value='${
funbox.name
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/ts/test/funbox/funbox-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type FunboxFunctions = {
getWord?: (wordset?: Wordset, wordIndex?: number) => string;
punctuateWord?: (word: string) => string;
withWords?: (words?: string[]) => Promise<Wordset>;
alterText?: (word: string) => string;
alterText?: (word: string, wordIndex: number, wordsBound: number) => string;
applyConfig?: () => void;
applyGlobalCSS?: () => void;
clearGlobal?: () => void;
Expand Down Expand Up @@ -584,6 +584,12 @@ const list: Partial<Record<FunboxName, FunboxFunctions>> = {
return GetText.getMorse(word);
},
},
underscore_spaces: {
alterText(word: string, wordIndex: number, limit: number): string {
if (wordIndex === limit - 1) return word; // don't add underscore to the last word
return word + "_";
},
},
crt: {
applyGlobalCSS(): void {
const isSafari = /^((?!chrome|android).)*safari/i.test(
Expand Down Expand Up @@ -620,6 +626,11 @@ const list: Partial<Record<FunboxName, FunboxFunctions>> = {
$("#globalFunBoxTheme").attr("href", ``);
},
},
ALL_CAPS: {
alterText(word: string): string {
return word.toUpperCase();
},
},
};

export function getFunboxFunctions(): Record<FunboxName, FunboxFunctions> {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/ts/test/test-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export function getStats(): unknown {
lastResult,
start,
end,
start3,
end3,
afkHistory: TestInput.afkHistory,
errorHistory: TestInput.errorHistory,
wpmHistory: TestInput.wpmHistory,
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/ts/test/words-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,14 @@ function getFunboxWord(
return word;
}

function applyFunboxesToWord(word: string): string {
function applyFunboxesToWord(
word: string,
wordIndex: number,
wordsBound: number
): string {
for (const fb of getActiveFunboxes()) {
if (fb.functions?.alterText) {
word = fb.functions.alterText(word);
word = fb.functions.alterText(word, wordIndex, wordsBound);
}
}
return word;
Expand Down Expand Up @@ -911,7 +915,7 @@ export async function getNextWord(
}
}

randomWord = applyFunboxesToWord(randomWord);
randomWord = applyFunboxesToWord(randomWord, wordIndex, wordsBound);

console.debug("Word:", randomWord);

Expand Down
5 changes: 5 additions & 0 deletions frontend/static/languages/_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"name": "portuguese",
"languages": [
"portuguese",
"portuguese_1k",
"portuguese_3k",
"portuguese_5k",
"portuguese_320k",
Expand Down Expand Up @@ -180,6 +181,10 @@
"name": "irish",
"languages": ["irish"]
},
{
"name": "galician",
"languages": ["galician"]
},
{
"name": "thai",
"languages": ["thai"]
Expand Down
2 changes: 2 additions & 0 deletions frontend/static/languages/_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
,"ukrainian_latynka_endings"
,"portuguese"
,"portuguese_acentos_e_cedilha"
,"portuguese_1k"
,"portuguese_3k"
,"portuguese_5k"
,"portuguese_320k"
Expand Down Expand Up @@ -110,6 +111,7 @@
,"italian_280k"
,"friulian"
,"latin"
,"galician"
,"thai"
,"polish"
,"polish_2k"
Expand Down
207 changes: 207 additions & 0 deletions frontend/static/languages/galician.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"name": "galician",
"bcp47": "gl-ES",
"orderedByFrequency": "true",
"words": [
"que",
"e",
"a",
"de",
"o",
"se",
"non",
"do",
"da",
"os",
"na",
"no",
"un",
"ó",
"en",
"por",
"máis",
"lle",
"dos",
"para",
"unha",
"as",
"é",
"á",
"súa",
"pero",
"el",
"con",
"xa",
"das",
"ou",
"coma",
"seu",
"era",
"visitador",
"sen",
"tan",
"cando",
"pola",
"nos",
"logo",
"como",
"hai",
"",
"ser",
"polo",
"alí",
"así",
"mentres",
"ben",
"todo",
"nas",
"quen",
"tamén",
"tempo",
"coa",
"ata",
"estaba",
"ela",
"agora",
"ten",
"ós",
"aínda",
"nin",
"son",
"co",
"mesmo",
"aquel",
"aquela",
"seus",
"vai",
"acaso",
"sabe",
"nada",
"tal",
"cousa",
"algo",
"ás",
"profesor",
"foi",
"xente",
"mar",
"está",
"noite",
"había",
"dende",
"tiña",
"cara",
"pouco",
"home",
"tanto",
"onde",
"auga",
"dun",
"senón",
"moito",
"porque",
"certo",
"eu",
"luz",
"vez",
"facer",
"si",
"fose",
"moi",
"outra",
"día",
"camiño",
"menos",
"xeito",
"fora",
"nun",
"dous",
"vida",
"dunha",
"sempre",
"casa",
"anos",
"mañá",
"eles",
"ninguén",
"entre",
"silencio",
"iso",
"toda",
"me",
"terra",
"antes",
"del",
"pode",
"ver",
"lles",
"calquera",
"país",
"podería",
"mundo",
"polos",
"días",
"libros",
"veces",
"señor",
"vento",
"corpo",
"vello",
"mireille",
"deus",
"fin",
"historia",
"nunha",
"ollos",
"cousas",
"man",
"ollada",
"outros",
"segundo",
"ía",
"esta",
"propia",
"porta",
"deán",
"simona",
"outro",
"axiña",
"dicir",
"mais",
"caso",
"súas",
"chegar",
"dar",
"eran",
"pois",
"pedreira",
"mellor",
"san",
"Galicia",
"tempos",
"cada",
"aquí",
"todos",
"xentes",
"cos",
"hora",
"saír",
"claire",
"deles",
"dixo",
"medo",
"aquilo",
"este",
"ir",
"polas",
"falar",
"coengo",
"sol",
"tampouco",
"ter",
"aix",
"vén",
"escritor",
"medio"
]
}
Loading

0 comments on commit eb52cfb

Please sign in to comment.