2024-10-15 06:31:17 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" href="/node_modules/@fontsource-variable/jetbrains-mono/index.css">
|
2024-10-15 07:38:18 +00:00
|
|
|
<link rel="stylesheet" href="/node_modules/normalize.css/normalize.css">
|
2024-10-15 07:15:44 +00:00
|
|
|
<title>THE PTOOLS - Better than your MOM</title>
|
2024-10-15 06:31:17 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="container">
|
|
|
|
<div id="main"></div>
|
|
|
|
<div id="q">
|
2024-10-15 07:15:44 +00:00
|
|
|
<div id="r"><p><button onclick="btn('base64d')"><<<</button> base64d</p><textarea id="base64d"></textarea></div>
|
|
|
|
<div id="r"><p><button onclick="btn('base64e')"><<<</button> base64e</p><textarea id="base64e"></textarea></div>
|
|
|
|
<div id="r"><p><button onclick="btn('urid')"><<<</button> urid (cmp: <input id="uridcmp" style="width: 20px;" type="checkbox">)</p><textarea id="urid"></textarea></div>
|
|
|
|
<div id="r"><p><button onclick="btn('urie')"><<<</button> urie (cmp: <input id="uriecmp" style="width: 20px;" type="checkbox">)</p><textarea id="urie"></textarea></div>
|
|
|
|
<div id="r"><p><button onclick="btn('jsonbtf')"><<<</button> jsonbtf (sp: <input id="jsonbtfsp" style="width: 20px;" value="4">)</p><textarea id="jsonbtf"></textarea></div>
|
|
|
|
<div id="r"><p><button onclick="btn('jsonsmp')"><<<</button> jsonsmp</p><textarea id="jsonsmp"></textarea></div>
|
2024-10-15 06:31:17 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2024-10-15 07:55:07 +00:00
|
|
|
:root {
|
|
|
|
background-color: #212121;
|
|
|
|
}
|
|
|
|
|
2024-10-15 06:31:17 +00:00
|
|
|
* {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
html, body, #container {
|
|
|
|
width: 100%;
|
2024-10-15 07:55:07 +00:00
|
|
|
height: 100%;
|
|
|
|
user-select: none;
|
2024-10-15 06:31:17 +00:00
|
|
|
}
|
2024-10-15 07:38:18 +00:00
|
|
|
|
2024-10-15 06:31:17 +00:00
|
|
|
#container {
|
|
|
|
display: flex;
|
|
|
|
color: #fafafa;
|
2024-10-15 07:38:18 +00:00
|
|
|
background-color: #212121;
|
|
|
|
font-family: 'JetBrains Mono Variable', monospace;
|
2024-10-15 06:31:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#container > * {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
|
2024-10-15 07:55:07 +00:00
|
|
|
#main {
|
|
|
|
background-color: #1e1e1e;
|
|
|
|
}
|
|
|
|
|
2024-10-15 06:31:17 +00:00
|
|
|
#q {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
gap: 10px;
|
|
|
|
padding: 10px;
|
2024-10-15 07:38:18 +00:00
|
|
|
max-height: 100%;
|
|
|
|
overflow-x: scroll;
|
2024-10-15 06:31:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#q > * {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#r {
|
|
|
|
display: flex;
|
2024-10-15 07:38:18 +00:00
|
|
|
min-height: 200px;
|
2024-10-15 06:31:17 +00:00
|
|
|
flex-direction: column;
|
|
|
|
background-color: #1e1e1e;
|
|
|
|
border-radius: 4px;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
#r > textarea {
|
|
|
|
flex: 1;
|
|
|
|
border: none;
|
|
|
|
resize: none;
|
|
|
|
background-color: transparent;
|
|
|
|
color: #fafafa;
|
2024-10-15 07:38:18 +00:00
|
|
|
padding: 10px;
|
2024-10-15 06:31:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#r > textarea:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
2024-10-15 07:38:18 +00:00
|
|
|
|
|
|
|
#r > p {
|
|
|
|
padding: 10px;
|
|
|
|
background-color: #323232;
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
#r button {
|
|
|
|
border: none;
|
|
|
|
padding: 6px 10px;
|
|
|
|
border-radius: 4px;
|
|
|
|
cursor: pointer;
|
2024-10-15 07:55:07 +00:00
|
|
|
background-color: #ff1696;
|
2024-10-15 07:38:18 +00:00
|
|
|
color: white;
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
#r button:hover {
|
2024-10-15 07:55:07 +00:00
|
|
|
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;
|
2024-10-15 07:38:18 +00:00
|
|
|
}
|
2024-10-15 06:31:17 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script src="/node_modules/monaco-editor/min/vs/loader.js"></script>
|
|
|
|
<script>
|
|
|
|
require.config({ paths: { vs: '/node_modules/monaco-editor/min/vs' } });
|
|
|
|
|
|
|
|
require(['vs/editor/editor.main'], function () {
|
|
|
|
var editor = monaco.editor.create(document.getElementById('main'), {
|
2024-10-15 07:55:07 +00:00
|
|
|
value: 'Type Something Here',
|
2024-10-15 07:38:18 +00:00
|
|
|
language: 'json',
|
2024-10-15 06:31:17 +00:00
|
|
|
automaticLayout: true,
|
|
|
|
minimap: { enabled: false },
|
|
|
|
fontSize: 16,
|
|
|
|
theme: "vs-dark",
|
|
|
|
scrollBeyondLastLine: false,
|
|
|
|
fontFamily: 'JetBrains Mono Variable',
|
2024-10-15 07:38:18 +00:00
|
|
|
fontLigatures: true,
|
|
|
|
wordWrap: true
|
2024-10-15 06:31:17 +00:00
|
|
|
});
|
|
|
|
|
2024-10-15 07:55:07 +00:00
|
|
|
render()
|
2024-10-15 06:31:17 +00:00
|
|
|
function render () {
|
|
|
|
const value = editor.getValue()
|
|
|
|
try { document.getElementById('base64d').value = atob(value) } catch { document.getElementById('base64d').value ='(err)' }
|
|
|
|
try { document.getElementById('base64e').value = btoa(value) } catch { document.getElementById('base64e').value ='(err)' }
|
|
|
|
try { document.getElementById('urid').value = document.getElementById('uridcmp').checked ? decodeURIComponent(value) : decodeURI(value) } catch { document.getElementById('urid').value = '(err)' }
|
|
|
|
try { document.getElementById('urie').value = document.getElementById('uriecmp').checked ? encodeURIComponent(value) : encodeURI(value) } catch { document.getElementById('urie').value = '(err)' }
|
2024-10-15 08:31:00 +00:00
|
|
|
try { document.getElementById('jsonbtf').value = value.split('\n').map((v) => JSON.stringify(JSON.parse(v), null, parseInt(document.getElementById('jsonbtfsp').value))).join('\n') } catch { document.getElementById('jsonbtf').value ='(err)' }
|
2024-10-15 06:31:17 +00:00
|
|
|
try { document.getElementById('jsonsmp').value = JSON.stringify(JSON.parse(value)) } catch { document.getElementById('jsonsmp').value ='(err)' }
|
|
|
|
}
|
|
|
|
|
2024-10-15 08:31:00 +00:00
|
|
|
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 }]);
|
|
|
|
}
|
2024-10-15 07:15:44 +00:00
|
|
|
|
2024-10-15 06:31:17 +00:00
|
|
|
try {
|
|
|
|
document.getElementById('uridcmp').onchange = () => render()
|
|
|
|
document.getElementById('uriecmp').onchange = () => render()
|
|
|
|
document.getElementById('jsonbtfsp').oninput = () => render()
|
|
|
|
} catch{}
|
|
|
|
|
|
|
|
editor.getModel().onDidChangeContent((event) => {
|
|
|
|
render()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|