diff --git a/.gitea/workflows/deploy_site.yml b/.gitea/workflows/deploy_site.yml index ce61aeb..cebc8a6 100644 --- a/.gitea/workflows/deploy_site.yml +++ b/.gitea/workflows/deploy_site.yml @@ -14,5 +14,5 @@ jobs: - run: wget https://dl.min.io/client/mc/release/linux-arm64/mc -O /tmp/mc - run: chmod +x /tmp/mc - run: /tmp/mc alias set minio http://minio-service.minio.svc.cluster.local:9000 ${{ secrets.MINIO_ACCESS_KEY }} ${{ secrets.MINIO_SECRET_KEY }} - - run: /tmp/mc mirror $PWD/ minio/ptools-chlrkdtkatjd --exclude '.git/*' --exclude '.gitea/*' --overwrite + - run: /tmp/mc mirror $PWD/ minio/ptools --exclude '.git/*' --exclude '.gitea/*' --overwrite diff --git a/app.html b/app.html new file mode 100644 index 0000000..6a3f62b --- /dev/null +++ b/app.html @@ -0,0 +1,205 @@ + + + + + + + + THE PTOOLS - this is not a cheat bro + + +
+
+
+

by Minhyeok Park ©

+

regexp

+

base64d

+

base64e

+

urid (cmp: )

+

urie (cmp: )

+

jsonbtf (sp: )

+

jsonsmp

+

json2yml

+

yml2json

+

escape

+

unescape

+

gzipd

+
+
+ + + + + + + diff --git a/index.html b/index.html index b46f7b0..22f1885 100644 --- a/index.html +++ b/index.html @@ -3,27 +3,23 @@ - - THE PTOOLS - Better than your MOM + THE PTOOLS - this is not a cheat bro

by Minhyeok Park ©

-

regexp

-

base64d

-

base64e

-

urid (cmp: )

-

urie (cmp: )

-

jsonbtf (sp: )

-

jsonsmp

-

json2yml

-

yml2json

-

escape

-

unescape

-

gzipd

+

regexp

+

base64d

+

base64e

+

urid

+

urie

+

jsonbtf

+

jsonsmp

+

json2yml

+

yml2json

@@ -47,7 +43,7 @@ display: flex; color: #fafafa; background-color: #212121; - font-family: 'JetBrains Mono Variable', monospace; + font-family: Arial, Helvetica, sans-serif; } #container > * { @@ -112,19 +108,6 @@ #r button:hover { background-color: #da1c9b; } - - #r input { - background-color: transparent; - color: #fafafa; - border: none; - border-bottom: 1px solid #fafafa; - text-align: center; - accent-color: #ff1696; - } - - #r input:focus { - outline: none; - } @@ -143,57 +126,28 @@ fontSize: 16, theme: "vs-dark", scrollBeyondLastLine: false, - fontFamily: 'JetBrains Mono Variable', + fontFamily: 'Arial', fontLigatures: true, wordWrap: true }); - async function DecompressBlob(blob2) { - const byteCharacters = atob(blob2); - const byteNumbers = new Array(byteCharacters.length); - for (let i = 0; i < byteCharacters.length; i++) { - byteNumbers[i] = byteCharacters.charCodeAt(i); - } - const byteArray = new Uint8Array(byteNumbers); - const blob = new Blob([byteArray]); - - const ds = new DecompressionStream("gzip"); - const decompressedStream = blob.stream().pipeThrough(ds); - return await new Response(decompressedStream).blob(); - } - render() function render () { const value = editor.getValue() - try { document.getElementById('regexp').value = value.split('\r\n\r\n').slice(0, 2).join('\n\n') + '\n\n' + ((value.split('\r\n\r\n')[1] || '').split('\r\n').map(v => JSON.stringify(new RegExp(value.split('\r\n\r\n')[0]).exec(v)?.groups)).join('\n')) } catch (err) { document.getElementById('regexp').value = err ?? '(err)' } - try { document.getElementById('base64d').value = atob(value) } catch (err) { document.getElementById('base64d').value = err ?? '(err)' } - try { document.getElementById('base64e').value = btoa(value) } catch (err) { document.getElementById('base64e').value = err ?? '(err)' } - try { document.getElementById('urid').value = document.getElementById('uridcmp').checked ? decodeURIComponent(value) : decodeURI(value) } catch (err) { document.getElementById('urid').value = err ?? '(err)' } - try { document.getElementById('urie').value = document.getElementById('uriecmp').checked ? encodeURIComponent(value) : encodeURI(value) } catch (err) { document.getElementById('urie').value = err ?? '(err)' } - try { document.getElementById('jsonbtf').value = value.split('\n').map((v) => JSON.stringify(JSON5.parse(v), null, parseInt(document.getElementById('jsonbtfsp').value))).join('\n') } catch (err) { document.getElementById('jsonbtf').value = err ?? '(err)' } - try { document.getElementById('jsonsmp').value = JSON.stringify(JSON5.parse(value)) } catch (err) { document.getElementById('jsonsmp').value = err ?? '(err)' } - try { document.getElementById('json2yml').value = YAML.stringify(JSON5.parse(value)) } catch (err) { document.getElementById('json2yml').value = err ?? '(err)' } - try { document.getElementById('yml2json').value = JSON.stringify(YAML.parse(value)) } catch (err) { document.getElementById('yml2json').value = err ?? '(err)' } - try { document.getElementById('escape').value = JSON.stringify(value) } catch (err) { document.getElementById('escape').value = err ?? '(err)' } - try { document.getElementById('unescape').value = JSON5.parse(value) } catch (err) { document.getElementById('unescape').value = err ?? '(err)' } - try { DecompressBlob(value).then((v) => v.text()).then((v) => document.getElementById('gzipd').value = v).catch((err) => document.getElementById('gzipd').value = err ?? '(err)') } catch (err) { document.getElementById('gzipd').value = err ?? '(err)' } + setTimeout(() => { + try { document.getElementById('regexp').value = value.split('\r\n\r\n').slice(0, 2).join('\n\n') + '\n\n' + ((value.split('\r\n\r\n')[1] || '').split('\r\n').map(v => JSON.stringify(new RegExp(value.split('\r\n\r\n')[0]).exec(v)?.groups)).join('\n')) } catch (err) { document.getElementById('regexp').value = err ?? '(err)' } + try { document.getElementById('base64d').value = atob(value) } catch (err) { document.getElementById('base64d').value = err ?? '(err)' } + try { document.getElementById('base64e').value = btoa(value) } catch (err) { document.getElementById('base64e').value = err ?? '(err)' } + try { document.getElementById('urid').value = document.getElementById('uridcmp').checked ? decodeURIComponent(value) : decodeURI(value) } catch (err) { document.getElementById('urid').value = err ?? '(err)' } + try { document.getElementById('urie').value = document.getElementById('uriecmp').checked ? encodeURIComponent(value) : encodeURI(value) } catch (err) { document.getElementById('urie').value = err ?? '(err)' } + try { document.getElementById('jsonbtf').value = value.split('\n').map((v) => JSON.stringify(JSON5.parse(v), null, parseInt(document.getElementById('jsonbtfsp').value))).join('\n') } catch (err) { document.getElementById('jsonbtf').value = err ?? '(err)' } + try { document.getElementById('jsonsmp').value = JSON.stringify(JSON5.parse(value)) } catch (err) { document.getElementById('jsonsmp').value = err ?? '(err)' } + try { document.getElementById('json2yml').value = YAML.stringify(JSON5.parse(value)) } catch (err) { document.getElementById('json2yml').value = err ?? '(err)' } + try { document.getElementById('yml2json').value = JSON.stringify(YAML.parse(value)) } catch (err) { document.getElementById('yml2json').value = err ?? '(err)' } + }, 1000) } - window.btn = (id) => { - const text = document.getElementById(id).value - - editor.executeEdits('ptools', [{ identifier: 'delete', range: new monaco.Range(1, 1, 1000000000, 1), text: '', forceMoveMarkers: true }]); - editor.executeEdits('ptools', [{ identifier: 'insert', range: new monaco.Range(1, 1, 1, 1), text, forceMoveMarkers: true }]); - editor.pushUndoStop() - } - - try { - document.getElementById('uridcmp').onchange = () => render() - document.getElementById('uriecmp').onchange = () => render() - document.getElementById('jsonbtfsp').oninput = () => render() - } catch{} - editor.getModel().onDidChangeContent((event) => { render() });