From 8fe3c2d403b8db9355408fd4183035a02034dbd1 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Sat, 25 May 2024 11:14:57 +0900 Subject: [PATCH] Add ccv3 cbs --- src/styles.css | 4 ++++ src/ts/parser.ts | 25 +++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/styles.css b/src/styles.css index fc9650f7..bdc4183b 100644 --- a/src/styles.css +++ b/src/styles.css @@ -186,4 +186,8 @@ html, body{ border-left: 0.4rem solid var(--risu-theme-borderc); /* transition colors */ transition: border-color 0.5s; +} + +.x-risu-risu-comment{ + @apply border border-darkborderc bg-darkbg text-textcolor rounded-md shadow-sm focus:outline-none transition-colors duration-200 px-4 py-2 min-w-0 } \ No newline at end of file diff --git a/src/ts/parser.ts b/src/ts/parser.ts index d33409e3..27f25d9c 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -970,12 +970,12 @@ const matcher = (p1:string,matcherArg:matcherArg) => { return arra[randomIndex] } else{ - const arr = p1.split(/\:|\,/g) + const arr = p1.replace(/\\,/g, '§X').split(/\:|\,/g) const randomIndex = Math.floor(Math.random() * (arr.length - 1)) + 1 if(matcherArg.tokenizeAccurate){ return arra[0] } - return arr[randomIndex] + return arr[randomIndex]?.replace(/§X/g, ',') ?? '' } } if(p1.startsWith('pick')){ @@ -989,12 +989,12 @@ const matcher = (p1:string,matcherArg:matcherArg) => { return arra[randomIndex] } else{ - const arr = p1.split(/\:|\,/g) + const arr = p1.replace(/\\,/g, '§X').split(/\:|\,/g) const randomIndex = Math.floor(rand() * (arr.length - 1)) + 1 if(matcherArg.tokenizeAccurate){ return arra[0] } - return arr[randomIndex] + return arr[randomIndex]?.replace(/§X/g, ',') ?? '' } } if(p1.startsWith('roll')){ @@ -1020,6 +1020,23 @@ const matcher = (p1:string,matcherArg:matcherArg) => { return calcString(substring).toString() } + if(p1.startsWith('//')){ + return '' + } + if(p1.startsWith('hidden_key:')){ + return '' + } + if(p1.startsWith('reverse:')){ + return p1.substring( + p1[8] === ':' ? 9 : 8 + ).split('').reverse().join('') + } + if(p1.startsWith('comment:')){ + if(!matcherArg.displaying){ + return '' + } + return `
${p1.substring(8)}
` + } return null } catch (error) { return null