summaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-04-08 22:26:29 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-04-08 22:26:29 +0800
commitd7295c8f71ec67b88f81934fd1561eeaad1107f1 (patch)
treec47e41556dcf414c968e7aa39d93b7f4d6f0d72b /main.js
parent189c4e4e559380d676e902bb18c3fa9edc9acef0 (diff)
finished index.html & main.js
Diffstat (limited to 'main.js')
-rw-r--r--main.js123
1 files changed, 123 insertions, 0 deletions
diff --git a/main.js b/main.js
index e69de29..a227ac9 100644
--- a/main.js
+++ b/main.js
@@ -0,0 +1,123 @@
+const map = {
+ '`': '`',
+ '~': '`',
+ '1': '¡',
+ '!': '⁄',
+ '2': '™',
+ '@': '€',
+ '3': '£',
+ '#': '‹',
+ '4': '¢',
+ '$': '›',
+ '5': '∞',
+ '%': 'fi',
+ '6': '§',
+ '^': 'fl',
+ '7': '¶',
+ '&': '‡',
+ '8': '•',
+ '*': '°',
+ '9': 'ª',
+ '(': '·',
+ '0': 'º',
+ ')': '‚',
+ '-': '−',
+ '_': '—',
+ '=': '≠',
+ '+': '±',
+ 'q': 'œ',
+ 'Q': 'Œ',
+ 'w': '∑',
+ 'W': '„',
+ 'e': '´',
+ 'E': '´',
+ 'r': '®',
+ 'R': '‰',
+ 't': '†',
+ 'T': 'ˇ',
+ 'y': '¥',
+ 'Y': 'Á',
+ 'u': '¨',
+ 'U': '¨',
+ 'i': 'ˆ',
+ 'I': 'ˆ',
+ 'o': 'ø',
+ 'O': 'Ø',
+ 'p': 'π',
+ 'P': '∏',
+ '[': '“',
+ '{': '”',
+ ']': '‘',
+ '}': '’',
+ '\\': '«',
+ '|': '»',
+ 'a': 'å',
+ 'A': 'Å',
+ 's': 'ß',
+ 'S': 'Í',
+ 'd': '∂',
+ 'D': 'Î',
+ 'f': 'ƒ',
+ 'F': 'Ï',
+ 'g': '©',
+ 'G': '˝',
+ 'h': '˙',
+ 'H': '',
+ 'j': '∆',
+ 'J': 'Ô',
+ 'k': '˚',
+ 'K': '',
+ 'l': '…',
+ 'L': 'Ò',
+ ';': '…',
+ ':': 'Ú',
+ 'z': 'Ω',
+ 'Z': '¸',
+ 'x': '≈',
+ 'X': '˛',
+ 'c': 'ç',
+ 'C': 'Ç',
+ 'v': '√',
+ 'V': '◊',
+ 'b': '∫',
+ 'B': 'ı',
+ 'n': '˜',
+ 'N': '˜',
+ 'm': 'µ',
+ 'M': 'Â',
+ ',': '≤',
+ '<': '≤',
+ '.': '≥',
+ '>': '˘',
+ '/': '÷',
+ '?': '¿'
+};
+
+const inputArea = document.getElementById('input');
+const outputDiv = document.getElementById('output');
+const convertButton = document.getElementById('convert');
+const modeSelect = document.getElementById('mode');
+
+convertButton.addEventListener('click', () => {
+ const mode = modeSelect.value;
+ const inputText = inputArea.value;
+ let outputText = '';
+
+ if (mode === 'normal') {
+ outputText = convertNormal(inputText, map);
+ } else if (mode === 'reverse') {
+ outputText = convertReverse(inputText, map);
+ }
+
+ outputDiv.textContent = outputText;
+});
+
+function convertNormal(data, map) {
+ return data.split('').map(char => {
+ return Object.keys(map).find(key => map[key] === char) || char;
+ }).join('');
+}
+
+function convertReverse(data, map) {
+ return data.split('').map(char => map[char] || char).join('');
+} \ No newline at end of file