mirror of
https://github.com/hexahigh/games.git
synced 2025-12-11 20:15:38 +01:00
test
This commit is contained in:
parent
4daeebf094
commit
f0b01f1e58
20
tools/encoder/index.html
Normal file
20
tools/encoder/index.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<script src="index.js"></script>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<label>Input data</label><br>
|
||||
<textarea style="width: 90%;" value="" rows="6" cols="80" id="input" required></textarea><br>
|
||||
<button class="button" id="encodebutton" type="button" onclick="doencode();">Encode</button>
|
||||
<button type="button" id="decodebutton" class="button" onclick="dodecode();">Decode</button><br>
|
||||
<label>Output</label><br>
|
||||
<textarea style="width: 90%;" id="output" rows="6" cols="80" readonly></textarea><br>
|
||||
<button class="button" type="button" id="copy" onclick="docopy();">Copy</button>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
25
tools/encoder/index.js
Normal file
25
tools/encoder/index.js
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
|
||||
//Copies the text from the output
|
||||
function docopy() {
|
||||
document.getElementById("output").select();
|
||||
document.execCommand('copy');
|
||||
}
|
||||
|
||||
function doencode() {
|
||||
var inputData = document.getElementById("input").value;
|
||||
var outputdata = rot13(inputData);
|
||||
document.getElementById("output").value = outputdata;
|
||||
}
|
||||
|
||||
function dodecode() {
|
||||
var inputData = document.getElementById("input").value;
|
||||
var outputdata = rot13(inputData);
|
||||
document.getElementById("output").value = outputdata;
|
||||
}
|
||||
|
||||
//Rot13 cipher
|
||||
function rot13(message) {
|
||||
return message.replace(/[a-z]/gi, letter => String.fromCharCode(letter.charCodeAt(0) + (letter.toLowerCase() <= 'm' ? 13 : -13)));
|
||||
}
|
||||
0
tools/encoder/style.css
Normal file
0
tools/encoder/style.css
Normal file
Loading…
x
Reference in New Issue
Block a user