Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions 03week/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Pig Latin</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
<link href="https://fonts.googleapis.com/css?family=Fredoka+One|Gochi+Hand|Luckiest+Guy" rel="stylesheet">
</head>
<body>
<h1>Learn a New Language Fast!</h1>
<div id="bar"></div>
<button type="submit" id="button" onclick="pigLatin()">Translate</button>
<input type="text" id="input">
<div id="translator">&nbsp;</div>
<script src="pigLatin-GUI.js"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions 03week/pigLatin-GUI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';
// const assert = require('assert');
// const readline = require('readline');
// const rl = readline.createInterface({
// input: process.stdin,
// output: process.stdout
// });

function pigLatin() {
//remove whitespace and change to lower case
let word = document.getElementById("input").value;
word = word.trim().toLowerCase();
let newWord = word.split("");
let final;

const vowel = ['a','e','i','o','u'];
if (vowel.includes(word.charAt(0))) {
final = word + 'way';
document.getElementById("translator").innerHTML = final;
} else {
for (let i=0; i < newWord.length; i++){
if (!vowel.includes(word[i])) {
newWord.push(newWord.shift());
} else if (vowel.includes(word[i])){
newWord.push('ay');
final = newWord.join('');
document.getElementById("translator").innerHTML = final;
return final;
}
}
}
// document.getElementById("translator").innerHTML = final;
}

function returnWord() {
document.getElementById("translator").innerHTML = pigLatin();
}
65 changes: 65 additions & 0 deletions 03week/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
* {
box-sizing: border-box;
}

body {
background-color: #a86ebe;
}

h1 {
color: white;
font-size: 4em;
line-height: .7em;
padding-top: 30px;
padding-bottom: 20px;
margin: 0 auto;
text-align: center;
font-family: 'Gochi Hand', cursive;
}

#bar {
background-color: white;
height: 4px;
width: auto;
border-radius: 5px;
margin-bottom: 10px;
}
#translator {
color: white;
background-color: #82439b;
display: flex;
flex-direction: column;
justify-content: center;
width: 300px;
height: 3em;
text-align: center;
font-family: 'Gochi Hand', cursive;
font-size: 3em;
margin: 60px auto 20px auto;
border-radius: 10px;
}

input {
display: block;
margin: 0 auto;
text-align: center;
font-family: 'Fredoka One', cursive;
height: 2em;
font-size: 1.5em;
margin-bottom: 20px;
width: 300px;
}

button {
display: block;
margin: 0 auto 10px auto;
height: 50px;
width: 200px;
font-size: 2em;
font-family: 'Fredoka One', cursive;
color: white;
background-color: #535166;
padding: 5px;
border: none;
border-radius: 10px;
}