From 7c6eded1733f83965961b26f47a555d083e81fa5 Mon Sep 17 00:00:00 2001 From: Arie Septian Date: Sun, 10 Feb 2019 17:17:09 +0700 Subject: [PATCH] checked and validated --- index.html | 32 ++++++++++++++ script/main.js | 0 script/textconverter.js | 95 +++++++++++++++++++++++++++++++++++++++++ script/tsconfig.json | 16 +++++++ style/main.css | 49 +++++++++++++++++++++ textconverter.html | 54 +++++++++++++++++++++++ 6 files changed, 246 insertions(+) create mode 100644 index.html create mode 100644 script/main.js create mode 100644 script/textconverter.js create mode 100644 script/tsconfig.json create mode 100644 style/main.css create mode 100644 textconverter.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..8d32096 --- /dev/null +++ b/index.html @@ -0,0 +1,32 @@ + + + + + + Arie Septian + + + + + + + +
+

Arie Septian

+

A Nice Guy

+
+ random image +
+ A young, handsome, and passionate man with a lot of talent and loved by everyone in the entire world. +
+ + + + + + + + + + + diff --git a/script/main.js b/script/main.js new file mode 100644 index 0000000..e69de29 diff --git a/script/textconverter.js b/script/textconverter.js new file mode 100644 index 0000000..6d8a581 --- /dev/null +++ b/script/textconverter.js @@ -0,0 +1,95 @@ +function convertText() { + let inputText = document.getElementById('inputText').value + let text = inputText + '' + + if (document.getElementById('radioToUpperCase').checked) { + text = text.toUpperCase() + } else if (document.getElementById('radioToLowerCase').checked) { + text = text.toLowerCase() + } else if (document.getElementById('radioSwapCase').checked) { + text = swapCase(text) + } + + if (document.getElementById('checkboxReplace').checked) { + let find = document.getElementById('textReplaceFrom').value + let replace = document.getElementById('textReplaceTo').value + text = replaceText(text, find, replace) + } + + if (document.getElementById('checkboxReverse').checked) { + text = reverseText(text) + } + + if (document.getElementById('checkboxShuffle').checked) { + text = shuffleText(text) + } + + if (document.getElementById('checkboxRepeat').checked) { + let repeat = parseInt(document.getElementById('numberRepeat').value) + if (isNaN(repeat)) { + repeat = 1 + } + text = repeatText(text, repeat) + } + document.getElementById('outputText').value = text +} + +function deleteText() { + document.getElementById('inputText').value = '' + document.getElementById('outputText').value = '' +} + +function swapCase(text) { + let output = '' + for (let s of text) { + if (s === s.toLowerCase()) { + output += s.toUpperCase() + } else if (s === s.toUpperCase()) { + output += s.toLowerCase() + } + } + return output +} + +function replaceText(text, find, replace) { + let output = text + '' + if (find === '') { + return text + } + while (output.indexOf(find) > -1) { + output = output.replace(find, replace) + } + return output +} + +function reverseText(text) { + let output = '' + for (let s of text) { + output = s + output + } + return output +} + +function shuffleText(text) { + let output = '' + for (let s of text) { + let n = Math.round(Math.random()) + if (n) { + output += s + } else { + output = s + output + } + } + return output +} + +function repeatText(text, repeat) { + let output = '' + if (repeat < 1) { + repeat = 1 + } + for (let i = 0; i < repeat; i++) { + output += text + '\n' + } + return output +} diff --git a/script/tsconfig.json b/script/tsconfig.json new file mode 100644 index 0000000..721a989 --- /dev/null +++ b/script/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "es2018", + "sourceMap": true, + //"strict": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + } +} \ No newline at end of file diff --git a/style/main.css b/style/main.css new file mode 100644 index 0000000..1e84f3d --- /dev/null +++ b/style/main.css @@ -0,0 +1,49 @@ +@import url('https://fonts.googleapis.com/css?family=Quicksand'); +body{ + text-align:center; + background-color: #000000; + background-image: url("https://www.transparenttextures.com/patterns/black-linen-2.png"); + font-family: 'Quicksand', sans-serif; +} +header, .description{ + color: #c0c0c0; + background-color: #20202080; + margin: 1em; + padding: 1em; + border-width: 1em; + border-color: #303030; + border-style: solid; + border-radius: 1em; +} +.picture{ + border-width: 1em; + border-color: #303030; + border-style: solid; + border-radius: 1em; +} +.fa { + border-radius: 50%; + padding: 1em; + font-size: 1em; + width: 1em; + text-align: center; + text-decoration: none; + margin: 1em; + color: #c0c0c0; + background-color: #303030; +} +.fa:hover { + opacity: 0.5; +} +footer{ + color: #a0a0a0; +} +textarea, input, button{ + border-radius: 1em; + font-size: 1em; + color: #c0c0c0; + background-color: #303030; +} +textarea{ + width: 100%; +} diff --git a/textconverter.html b/textconverter.html new file mode 100644 index 0000000..9514e0b --- /dev/null +++ b/textconverter.html @@ -0,0 +1,54 @@ + + + + + + + Arie Septian + + + + + + + + + +
+

Arie Septian

+

A Nice Guy

+
+
+ Text Converter
+
+ +
+
+
+
+
+ + with
+
+
+ + times
+ +
+ + + + + + + + + + + + +