Add ccv3 cbs

This commit is contained in:
kwaroran
2024-05-25 11:14:57 +09:00
parent 7cdf1918e5
commit 8fe3c2d403
2 changed files with 25 additions and 4 deletions

View File

@@ -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
}

View File

@@ -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 `<div class="risu-comment">${p1.substring(8)}</div>`
}
return null
} catch (error) {
return null