Clothing and clipboard update

QBClothing and ESKSkin working. Need others (WIP)

Copy to clipboard now a utility function. Will json encode if ~= string
This commit is contained in:
gononono64 committed 2025-05-24 18:03:31 -05:00
1 parent b9f5a3ed64
commit d4908042be
16 files changed
+1306 -44

No files matched your search

+45
View File
@@ -10,4 +10,49 @@
<body>
<div id="root"></div>
</body>
<script>
// dont judge me
function isTableJSON(jsonString) {
try {
const parsed = JSON.parse(jsonString);
if (!Array.isArray(parsed)) {
return false;
}
if (parsed.length > 0) {
const firstKeys = Object.keys(parsed[0]);
for (let i = 0; i < parsed.length; i++) {
if (typeof parsed[i] !== 'object' || parsed[i] === null || Array.isArray(parsed[i])) {
return false;
}
if (Object.keys(parsed[i]).length !== firstKeys.length || !Object.keys(parsed[i]).every(key => firstKeys.includes(key))) {
return false
}
}
}
return true;
} catch (e) {
return false;
}
}
const copyToClipboard = (str) => {
const el = document.createElement("textarea");
el.value = str;
document.body.appendChild(el);
el.select();
document.execCommand("copy");
document.body.removeChild(el);
};
window.addEventListener("message", (event) => {
if (event?.data?.type === "copytoclipboard") {
var str = event.data.text;
// if (isTableJSON(str)) {
// str = JSON.stringify(JSON.parse(str), null, 2);
// }
copyToClipboard(str);
}
});
</script>
</html>
+19
View File
@@ -9,4 +9,23 @@
<div id="root"></div>
<script type="module" src="./src/main.jsx"></script>
</body>
<script>
// dont judge me
const copyToClipboard = (str) => {
const el = document.createElement("textarea");
el.value = str;
document.body.appendChild(el);
el.select();
document.execCommand("copy");
document.body.removeChild(el);
};
window.addEventListener("message", (event) => {
if (event?.data?.type === "copytoclipboard") {
var str = event.data.text;
copyToClipboard(str);
}
});
</script>
</html>