mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-17 02:56:16 +08:00
updated funbox structure
added frontend properties and functions updated type
This commit is contained in:
parent
2e7179df8e
commit
6ff95b0e83
5 changed files with 326 additions and 137 deletions
312
backend/src/constants/funbox-list.ts
Normal file
312
backend/src/constants/funbox-list.ts
Normal file
|
@ -0,0 +1,312 @@
|
|||
const FunboxList: MonkeyTypes.FunboxMetadata[] = [
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["ignoresLanguage", "ignoresLayout", "noLetters"],
|
||||
frontendForcedConfig: {
|
||||
numbers: [false],
|
||||
},
|
||||
frontendFunctions: [
|
||||
"getWord",
|
||||
"punctuateWord",
|
||||
"rememberSettings",
|
||||
"handleChar",
|
||||
],
|
||||
name: "58008",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 2,
|
||||
frontendFunctions: ["applyCSS"],
|
||||
name: "nausea",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
frontendFunctions: ["applyCSS"],
|
||||
name: "round_round_baby",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
properties: ["changesWordsVisibility", "usesLayout"],
|
||||
frontendForcedConfig: {
|
||||
highlightMode: ["letter", "off"],
|
||||
},
|
||||
frontendFunctions: ["applyCSS", "applyConfig", "rememberSettings"],
|
||||
name: "simon_says",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
frontendFunctions: ["applyCSS"],
|
||||
name: "mirror",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
frontendFunctions: ["applyCSS"],
|
||||
name: "upside_down",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
properties: ["changesWordsVisibility", "speaks"],
|
||||
frontendForcedConfig: {
|
||||
highlightMode: ["letter", "off"],
|
||||
},
|
||||
frontendFunctions: [
|
||||
"applyCSS",
|
||||
"applyConfig",
|
||||
"rememberSettings",
|
||||
"toggleScript",
|
||||
],
|
||||
name: "tts",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 2,
|
||||
properties: ["noLigatures", "conflictsWithSymmetricChars"],
|
||||
frontendFunctions: ["applyCSS"],
|
||||
name: "choo_choo",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: [
|
||||
"ignoresLanguage",
|
||||
"ignoresLayout",
|
||||
"nospace",
|
||||
"noLetters",
|
||||
"symmetricChars",
|
||||
],
|
||||
frontendForcedConfig: {
|
||||
punctuation: [false],
|
||||
numbers: [false],
|
||||
highlightMode: ["letter", "off"],
|
||||
},
|
||||
frontendFunctions: [
|
||||
"getWord",
|
||||
"applyConfig",
|
||||
"rememberSettings",
|
||||
"handleChar",
|
||||
"isCharCorrect",
|
||||
"preventDefaultEvent",
|
||||
"getWordHtml",
|
||||
],
|
||||
name: "arrows",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 2,
|
||||
properties: ["changesCapitalisation"],
|
||||
frontendFunctions: ["alterText"],
|
||||
name: "rAnDoMcAsE",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["changesCapitalisation"],
|
||||
frontendFunctions: ["alterText"],
|
||||
name: "capitals",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
properties: ["changesLayout", "noInfiniteDuration"],
|
||||
frontendFunctions: [
|
||||
"applyConfig",
|
||||
"rememberSettings",
|
||||
"handleSpace",
|
||||
"getResultContent",
|
||||
"restart",
|
||||
],
|
||||
name: "layoutfluid",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
properties: ["noLigatures"],
|
||||
frontendFunctions: ["applyCSS"],
|
||||
name: "earthquake",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 0,
|
||||
frontendFunctions: ["applyCSS"],
|
||||
name: "space_balls",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["ignoresLanguage", "unspeakable"],
|
||||
frontendFunctions: ["getWord"],
|
||||
name: "gibberish",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["ignoresLanguage", "noLetters", "unspeakable"],
|
||||
frontendForcedConfig: {
|
||||
punctuation: [false],
|
||||
numbers: [false],
|
||||
},
|
||||
frontendFunctions: ["getWord"],
|
||||
name: "ascii",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["ignoresLanguage", "noLetters", "unspeakable"],
|
||||
frontendForcedConfig: {
|
||||
punctuation: [false],
|
||||
numbers: [false],
|
||||
},
|
||||
frontendFunctions: ["getWord"],
|
||||
name: "specials",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 0,
|
||||
properties: ["changesWordsVisibility", "toPush:2", "noInfiniteDuration"],
|
||||
name: "plus_one",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 0,
|
||||
properties: ["changesWordsVisibility", "toPush:3", "noInfiniteDuration"],
|
||||
name: "plus_two",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 0,
|
||||
properties: ["changesWordsVisibility", "toPush:4", "noInfiniteDuration"],
|
||||
name: "plus_three",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
properties: ["changesWordsVisibility"],
|
||||
frontendForcedConfig: {
|
||||
highlightMode: ["letter", "off"],
|
||||
},
|
||||
frontendFunctions: ["applyCSS", "rememberSettings"],
|
||||
name: "read_ahead_easy",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 2,
|
||||
properties: ["changesWordsVisibility"],
|
||||
frontendForcedConfig: {
|
||||
highlightMode: ["letter", "off"],
|
||||
},
|
||||
frontendFunctions: ["applyCSS", "rememberSettings"],
|
||||
name: "read_ahead",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
properties: ["changesWordsVisibility"],
|
||||
frontendForcedConfig: {
|
||||
highlightMode: ["letter", "off"],
|
||||
},
|
||||
frontendFunctions: ["applyCSS", "rememberSettings"],
|
||||
name: "read_ahead_hard",
|
||||
},
|
||||
{
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
properties: ["changesWordsVisibility", "noInfiniteDuration"],
|
||||
frontendForcedConfig: {
|
||||
mode: ["words", "quote", "custom"],
|
||||
},
|
||||
frontendFunctions: ["applyConfig", "rememberSettings", "start", "restart"],
|
||||
name: "memory",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
properties: ["nospace"],
|
||||
frontendForcedConfig: {
|
||||
highlightMode: ["letter", "off"],
|
||||
},
|
||||
frontendFunctions: ["applyConfig", "rememberSettings"],
|
||||
name: "nospace",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
properties: ["noInfiniteDuration", "ignoresLanguage"],
|
||||
frontendForcedConfig: {
|
||||
punctuation: [false],
|
||||
numbers: [false],
|
||||
},
|
||||
frontendFunctions: ["pullSection"],
|
||||
name: "poetry",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
properties: ["noInfiniteDuration", "ignoresLanguage"],
|
||||
frontendForcedConfig: {
|
||||
punctuation: [false],
|
||||
numbers: [false],
|
||||
},
|
||||
frontendFunctions: ["pullSection"],
|
||||
name: "wikipedia",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
properties: ["changesWordsFrequency"],
|
||||
frontendFunctions: ["getWord"],
|
||||
name: "weakspot",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
properties: ["unspeakable", "ignoresLanguage"],
|
||||
frontendFunctions: ["withWords"],
|
||||
name: "pseudolang",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["ignoresLanguage", "ignoresLayout", "noLetters"],
|
||||
frontendForcedConfig: {
|
||||
numbers: [false],
|
||||
},
|
||||
frontendFunctions: ["getWord", "punctuateWord", "rememberSettings"],
|
||||
name: "IPv4",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["ignoresLanguage", "ignoresLayout", "noLetters"],
|
||||
frontendForcedConfig: {
|
||||
numbers: [false],
|
||||
},
|
||||
frontendFunctions: ["getWord", "punctuateWord", "rememberSettings"],
|
||||
name: "IPv6",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["ignoresLanguage", "ignoresLayout", "noLetters"],
|
||||
frontendForcedConfig: {
|
||||
numbers: [false],
|
||||
punctuation: [false],
|
||||
},
|
||||
frontendFunctions: ["getWord"],
|
||||
name: "binary",
|
||||
},
|
||||
{
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
properties: ["changesWordsFrequency"],
|
||||
frontendFunctions: ["getWordsFrequencyMode"],
|
||||
name: "zipf",
|
||||
},
|
||||
];
|
||||
|
||||
export default FunboxList;
|
|
@ -1,136 +0,0 @@
|
|||
const Funboxes: Record<string, MonkeyTypes.FunboxMetadata> = {
|
||||
nausea: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 2,
|
||||
},
|
||||
round_round_baby: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
},
|
||||
simon_says: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
mirror: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
},
|
||||
upside_down: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
},
|
||||
tts: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
choo_choo: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 2,
|
||||
},
|
||||
arrows: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
rAnDoMcAsE: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 2,
|
||||
},
|
||||
capitals: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
layoutfluid: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
earthquake: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
space_balls: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
gibberish: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
"58008": {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
ascii: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
specials: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
plus_one: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
plus_two: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
plus_three: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
read_ahead_easy: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
read_ahead: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 2,
|
||||
},
|
||||
read_ahead_hard: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
},
|
||||
memory: {
|
||||
canGetPb: true,
|
||||
difficultyLevel: 3,
|
||||
},
|
||||
nospace: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
poetry: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
wikipedia: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
weakspot: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
pseudolang: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 0,
|
||||
},
|
||||
IPv4: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
IPv6: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
binary: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
zipf: {
|
||||
canGetPb: false,
|
||||
difficultyLevel: 1,
|
||||
},
|
||||
};
|
||||
|
||||
export default Funboxes;
|
4
backend/src/types/types.d.ts
vendored
4
backend/src/types/types.d.ts
vendored
|
@ -475,7 +475,11 @@ declare namespace MonkeyTypes {
|
|||
}
|
||||
|
||||
interface FunboxMetadata {
|
||||
name: string;
|
||||
canGetPb: boolean;
|
||||
difficultyLevel: number;
|
||||
properties?: string[];
|
||||
frontendForcedConfig?: Record<string, string[] | boolean[]>;
|
||||
frontendFunctions?: string[];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,3 +270,12 @@ export function formatSeconds(
|
|||
|
||||
return `${normalized} ${unit}${normalized > 1 ? "s" : ""}`;
|
||||
}
|
||||
|
||||
export function intersect<T>(a: T[], b: T[], removeDuplicates = false): T[] {
|
||||
let t;
|
||||
if (b.length > a.length) (t = b), (b = a), (a = t); // indexOf to loop over shorter
|
||||
const filtered = a.filter(function (e) {
|
||||
return b.indexOf(e) > -1;
|
||||
});
|
||||
return removeDuplicates ? [...new Set(filtered)] : filtered;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import _ from "lodash";
|
||||
import FunboxesMetadata from "../constants/funbox";
|
||||
import FunboxesMetadata from "../constants/funbox-list";
|
||||
|
||||
interface CheckAndUpdatePbResult {
|
||||
isPb: boolean;
|
||||
|
|
Loading…
Add table
Reference in a new issue