[feat] global scripts
This commit is contained in:
30
src/lib/Setting/Pages/GlobalRegex.svelte
Normal file
30
src/lib/Setting/Pages/GlobalRegex.svelte
Normal file
@@ -0,0 +1,30 @@
|
||||
<script lang="ts">
|
||||
import { PlusIcon } from "lucide-svelte";
|
||||
import { language } from "src/lang";
|
||||
import Help from "src/lib/Others/Help.svelte";
|
||||
import RegexData from "src/lib/SideBars/RegexData.svelte";
|
||||
import { DataBase } from "src/ts/database";
|
||||
</script>
|
||||
<h2 class="mb-2 text-2xl font-bold mt-2">{language.globalRegexScript} <Help key="regexScript" /></h2>
|
||||
<table class="contain w-full max-w-full tabler mt-4 flex flex-col p-2 gap-2 border-selected border-1">
|
||||
{#if $DataBase.globalscript.length === 0}
|
||||
<div class="text-gray-500">No Scripts</div>
|
||||
{/if}
|
||||
{#each $DataBase.globalscript as customscript, i}
|
||||
<RegexData bind:value={$DataBase.globalscript[i]} onRemove={() => {
|
||||
let customscript = $DataBase.globalscript
|
||||
customscript.splice(i, 1)
|
||||
$DataBase.globalscript = customscript
|
||||
}}/>
|
||||
{/each}
|
||||
</table>
|
||||
<button class="font-medium cursor-pointer hover:text-green-500 mb-2" on:click={() => {
|
||||
let script = $DataBase.globalscript
|
||||
script.push({
|
||||
comment: "",
|
||||
in: "",
|
||||
out: "",
|
||||
type: "editinput"
|
||||
})
|
||||
$DataBase.globalscript = script
|
||||
}}><PlusIcon /></button>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { ActivityIcon, BookIcon, BotIcon, BoxIcon, CodeIcon, DiamondIcon, FolderIcon, MonitorIcon, Sailboat, UserIcon, XCircleIcon } from "lucide-svelte";
|
||||
import { ActivityIcon, AlignLeft, BookIcon, BotIcon, BoxIcon, CodeIcon, DiamondIcon, FolderIcon, MonitorIcon, Sailboat, UserIcon, XCircleIcon } from "lucide-svelte";
|
||||
import { language } from "src/lang";
|
||||
import DisplaySettings from "./Pages/DisplaySettings.svelte";
|
||||
import UserSettings from "./Pages/UserSettings.svelte";
|
||||
@@ -13,6 +13,7 @@
|
||||
import Communities from "./Pages/Communities.svelte";
|
||||
import GlobalLoreBookSettings from "./Pages/GlobalLoreBookSettings.svelte";
|
||||
import Lorepreset from "./lorepreset.svelte";
|
||||
import GlobalRegex from "./Pages/GlobalRegex.svelte";
|
||||
let selected = -1
|
||||
let openPresetList = false
|
||||
let openLoreList = false
|
||||
@@ -56,6 +57,12 @@
|
||||
<BookIcon />
|
||||
<span>{language.globalLoreBook}</span>
|
||||
</button>
|
||||
<button class="text-gray-400 flex gap-2 items-center hover:text-gray-200" class:text-white={selected === 9} on:click={() => {
|
||||
selected = 9
|
||||
}}>
|
||||
<AlignLeft />
|
||||
<span>{language.globalRegexScript}</span>
|
||||
</button>
|
||||
<button class="text-gray-400 flex gap-2 items-center hover:text-gray-200" class:text-white={selected === 4} on:click={() => {
|
||||
selected = 4
|
||||
}}>
|
||||
@@ -107,6 +114,8 @@
|
||||
<Communities />
|
||||
{:else if selected === 8}
|
||||
<GlobalLoreBookSettings bind:openLoreList />
|
||||
{:else if selected === 9}
|
||||
<GlobalRegex/>
|
||||
{/if}
|
||||
<button class="absolute top-2 right-2 hover:text-green-500" on:click={() => {
|
||||
if(window.innerWidth >= 700){
|
||||
|
||||
Reference in New Issue
Block a user