ed
This commit is contained in:
parent
f57a27b8df
commit
4b4bb3b0ab
76 changed files with 6389 additions and 0 deletions
19
resources/[carscripts]/jg-textui/web/main.js
Normal file
19
resources/[carscripts]/jg-textui/web/main.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
(function () {
|
||||
const textUI = document.querySelector(".text-ui");
|
||||
|
||||
window.addEventListener("message", (evt) => {
|
||||
const { data } = evt;
|
||||
|
||||
if (!data) return false;
|
||||
|
||||
if (data.type === "show") {
|
||||
// If the string contains a key in square brackets (like [E]), then style it differently!
|
||||
let str = data.text.replaceAll(/\[(.*?)\]/g, "<kbd>$1</kbd>");
|
||||
|
||||
textUI.style.left = "20px";
|
||||
textUI.innerHTML = str;
|
||||
} else if (data.type === "hide") {
|
||||
textUI.style.left = "-100%";
|
||||
}
|
||||
});
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue