-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
325 additions
and
27 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<div class="flex items-center text-white"> | ||
Channel Id: <input class="flex flex-grow h-auto bg-primary focus:outline-none py-1 px-2 border border-transparent"/> | ||
Force: <input type="checkbox"/> | ||
</div> | ||
<script> | ||
{ | ||
let input = document.currentScript.previousElementSibling.firstElementChild | ||
let checkbox = input.nextElementSibling; | ||
function handleConfigUpdate(config){ | ||
const regex = /^gps\("package-discord", "select-channel", "*(.*?)"*, (.*?)\)$/; | ||
|
||
const match = config.script.match(regex); | ||
|
||
if (match) { | ||
const channelId = match[1]; | ||
const force = match[2]; | ||
if (channelId){ | ||
input.value = channelId; | ||
} else { | ||
input.value = "null" | ||
} | ||
checkbox.value = force; | ||
} | ||
} | ||
|
||
function updateActionCode(){ | ||
var channelId = input.value | ||
if (channelId !== "null"){ | ||
channelId = `"${channelId}"` | ||
} | ||
var force = checkbox.value; | ||
var code = `gps("package-discord", "select-channel", ${channelId}, ${force})`; | ||
const event = new CustomEvent("updateCode", {bubbles: true, detail: {script: String(code)}}) | ||
input.dispatchEvent(event); | ||
} | ||
|
||
checkbox.addEventListener("change", updateActionCode, false) | ||
input.addEventListener("change", updateActionCode, false) | ||
|
||
const event = new CustomEvent("updateConfigHandler", {bubbles: true, detail: {handler: handleConfigUpdate}}) | ||
input.dispatchEvent(event) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<div class="flex items-center text-white"> | ||
<select class="flex flex-grow h-auto bg-primary focus:outline-none py-1 px-2 border border-transparent"> | ||
<option value='mute-set'>Mute</option> | ||
<option value='deafen-set'>Deafen</option> | ||
</select> | ||
<input class="flex flex-grow h-auto bg-primary focus:outline-none py-1 px-2 border border-transparent"/> | ||
</div> | ||
<script> | ||
{ | ||
let select = document.currentScript.previousElementSibling.firstElementChild | ||
let input = select.nextElementSibling; | ||
function handleConfigUpdate(config){ | ||
const regex = /^gps\("package-discord", "(mute-set|deafen-set)", (.*?)\)$/; | ||
|
||
const match = config.script.match(regex); | ||
|
||
if (match) { | ||
const targetType = match[1]; | ||
const inputValue = match[2]; | ||
select.value = targetType; | ||
input.value = inputValue; | ||
} | ||
} | ||
|
||
function updateActionCode(){ | ||
var targetType = select.value | ||
var inputValue = input.value; | ||
var code = `gps("package-discord", "${targetType}", ${inputValue})`; | ||
const event = new CustomEvent("updateCode", {bubbles: true, detail: {script: String(code)}}) | ||
select.dispatchEvent(event); | ||
} | ||
|
||
select.addEventListener("change", updateActionCode, false) | ||
input.addEventListener("change", updateActionCode, false) | ||
|
||
const event = new CustomEvent("updateConfigHandler", {bubbles: true, detail: {handler: handleConfigUpdate}}) | ||
select.dispatchEvent(event) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<div class="flex items-center text-white"> | ||
<select class="h-auto bg-primary focus:outline-none py-1 px-2 border border-transparent"> | ||
<option value='mute-toggle'>Mute</option> | ||
<option value='deafen-toggle'>Deafen</option> | ||
</select> | ||
</div> | ||
<script> | ||
{ | ||
let select = document.currentScript.previousElementSibling.firstElementChild | ||
function handleConfigUpdate(config){ | ||
const regex = /^gps\("package-discord", "(mute-toggle|deafen-toggle)"\)$/; | ||
|
||
const match = config.script.match(regex); | ||
|
||
if (match) { | ||
const targetType = match[1]; | ||
select.value = targetType; | ||
} | ||
} | ||
|
||
function updateActionCode(){ | ||
var targetType = select.value | ||
var code = `gps("package-discord", "${targetType}")`; | ||
const event = new CustomEvent("updateCode", {bubbles: true, detail: {script: String(code)}}) | ||
select.dispatchEvent(event); | ||
} | ||
|
||
select.addEventListener("change", updateActionCode, false) | ||
|
||
const event = new CustomEvent("updateConfigHandler", {bubbles: true, detail: {handler: handleConfigUpdate}}) | ||
select.dispatchEvent(event) | ||
} | ||
</script> |
Oops, something went wrong.