From dcbd4693f1fc89ab0dacf78159853f29267feb17 Mon Sep 17 00:00:00 2001 From: Christian Fehmer Date: Thu, 5 Sep 2024 11:24:35 +0300 Subject: [PATCH 1/2] feat: add instant messaging funbox (@fehmer) --- backend/src/constants/funbox-list.ts | 7 +++++++ frontend/src/ts/test/funbox/funbox-list.ts | 5 +++++ frontend/src/ts/test/funbox/funbox.ts | 9 +++++++++ frontend/static/funbox/_list.json | 5 +++++ 4 files changed, 26 insertions(+) diff --git a/backend/src/constants/funbox-list.ts b/backend/src/constants/funbox-list.ts index e02c2a2f787a..07b003b5a16a 100644 --- a/backend/src/constants/funbox-list.ts +++ b/backend/src/constants/funbox-list.ts @@ -354,6 +354,13 @@ const FunboxList: MonkeyTypes.FunboxMetadata[] = [ frontendFunctions: ["alterText"], name: "ddoouubblleedd", }, + { + canGetPb: false, + difficultyLevel: 1, + properties: ["changesCapitalisation"], + frontendFunctions: ["alterText"], + name: "instant_messaging", + }, ]; export default FunboxList; diff --git a/frontend/src/ts/test/funbox/funbox-list.ts b/frontend/src/ts/test/funbox/funbox-list.ts index a1d0ea63c545..ede52df88b1d 100644 --- a/frontend/src/ts/test/funbox/funbox-list.ts +++ b/frontend/src/ts/test/funbox/funbox-list.ts @@ -273,6 +273,11 @@ const list: MonkeyTypes.FunboxMetadata[] = [ info: "TTyyppee eevveerryytthhiinngg ttwwiiccee..", properties: ["noLigatures"], }, + { + name: "instant_messaging", + info: "Who needs shift anyway?", + properties: ["changesCapitalisation"], + }, ]; export function getAll(): MonkeyTypes.FunboxMetadata[] { diff --git a/frontend/src/ts/test/funbox/funbox.ts b/frontend/src/ts/test/funbox/funbox.ts index 2dd631a97ac7..bbe905a5f519 100644 --- a/frontend/src/ts/test/funbox/funbox.ts +++ b/frontend/src/ts/test/funbox/funbox.ts @@ -523,6 +523,15 @@ FunboxList.setFunboxFunctions("ddoouubblleedd", { }, }); +FunboxList.setFunboxFunctions("instant_messaging", { + alterText(word: string): string { + return word + .toLocaleLowerCase() + .replace(/\./g, "\n") //replace . with enter + .replace(/\n+/g, "\n"); //make sure there is only one enter + }, +}); + export function toggleScript(...params: string[]): void { FunboxList.get(Config.funbox).forEach((funbox) => { if (funbox.functions?.toggleScript) funbox.functions.toggleScript(params); diff --git a/frontend/static/funbox/_list.json b/frontend/static/funbox/_list.json index e20f1e6c2eba..bbebd6527858 100644 --- a/frontend/static/funbox/_list.json +++ b/frontend/static/funbox/_list.json @@ -195,5 +195,10 @@ "name": "ddoouubblleedd", "info": "TTyyppee eevveerryytthhiinngg ttwwiiccee..", "canGetPb": true + }, + { + "name": "instant_messaging", + "info": "Who needs shift anyway?", + "canGetPb": false } ] From 5730e24a97b5ae290d948031034026fd1eb03004 Mon Sep 17 00:00:00 2001 From: Christian Fehmer Date: Thu, 5 Sep 2024 13:13:14 +0300 Subject: [PATCH 2/2] fix --- frontend/src/ts/test/funbox/funbox.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/ts/test/funbox/funbox.ts b/frontend/src/ts/test/funbox/funbox.ts index bbe905a5f519..795930673779 100644 --- a/frontend/src/ts/test/funbox/funbox.ts +++ b/frontend/src/ts/test/funbox/funbox.ts @@ -526,8 +526,9 @@ FunboxList.setFunboxFunctions("ddoouubblleedd", { FunboxList.setFunboxFunctions("instant_messaging", { alterText(word: string): string { return word - .toLocaleLowerCase() - .replace(/\./g, "\n") //replace . with enter + .toLowerCase() + .replace(/[.!?]$/g, "\n") //replace .?! with enter + .replace(/[().'"]/g, "") //remove special characters .replace(/\n+/g, "\n"); //make sure there is only one enter }, });