Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 27a5ea2

Browse files
day10 90% ready
1 parent cf49815 commit 27a5ea2

File tree

6 files changed

+64
-163
lines changed

6 files changed

+64
-163
lines changed

‎day10/STARTER-FILES/app.js

Whitespace-only changes.

‎day10/STARTER-FILES/index.html

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>11 - 4 Digit Code || Advent of JavaScript</title>
8+
<link rel="stylesheet" href="./styles.css" />
9+
</head>
310

4-
<head>
5-
<meta charset="UTF-8">
6-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8-
<title>11 - 4 Digit Code || Advent of JavaScript</title>
9-
<link rel="stylesheet" href="./styles.css" />
10-
</head>
11-
12-
<body>
13-
14-
<div class="wrapper">
15-
<h1>Authorization Code</h1>
16-
<p>Please enter the code that we sent to (***) *** - 2819.</p>
17-
<form action="">
18-
<div class="fields">
19-
<input type="text" maxlength="1" value="1" name="verification_1" />
20-
<input type="text" maxlength="1" value="" name="verification_2" />
21-
<input type="text" maxlength="1" value="" name="verification_3" />
22-
<input type="text" maxlength="1" value="" name="verification_4" />
23-
</div>
24-
<button>Verify</button>
25-
</form>
26-
</div>
27-
<script src="app.js"></script>
28-
</body>
29-
30-
</html>
11+
<body>
12+
<div class="wrapper">
13+
<h1>Authorization Code</h1>
14+
<p>Please enter the code that we sent to (***) *** - 2819.</p>
15+
<form action="">
16+
<div class="fields">
17+
<input type="text" maxlength="1" value="1" name="verification_1" />
18+
<input type="text" maxlength="1" value="" name="verification_2" />
19+
<input type="text" maxlength="1" value="" name="verification_3" />
20+
<input type="text" maxlength="1" value="" name="verification_4" />
21+
</div>
22+
<button>Verify</button>
23+
</form>
24+
</div>
25+
<script src="/day10/app.js"></script>
26+
</body>
27+
</html>

‎day10/app.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const passwordFields = document.querySelectorAll("input");
2+
const verifyButton = document.querySelector("button");
3+
const fields = document.querySelector(".fields");
4+
5+
let userPass = [];
6+
7+
for (let i = 0; i < passwordFields.length; i++) {
8+
passwordFields[i].onkeypress = function getKey(event) {
9+
userPass[i] = event.key;
10+
console.log(userPass);
11+
passwordFields[i].value = "*";
12+
if (i === passwordFields.length - 1) {
13+
verifyButton.focus();
14+
} else passwordFields[i + 1].focus();
15+
};
16+
}
17+
18+
verifyButton.onclick = function passwordVerify() {
19+
if (userPass.join("") === "2819") alert("Welcome");
20+
else alert("Incorrect password!");
21+
};

‎day17/index.html

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,6 @@
88
<title>Document</title>
99
</head>
1010
<body>
11-
<div class="main">
12-
<input class="first" placeholder="type a number" />
13-
<input class="second" placeholder="type a number" />
14-
<div class="operator">
15-
<input type="radio" name="symbol" value="+" id="plus" />
16-
<label for="plus"> + plus</label>
17-
</div>
18-
<div class="operator">
19-
<input type="radio" name="symbol" value="-" id="minus" checked />
20-
<label for="minus"> - minus</label>
21-
</div>
22-
<div class="operator">
23-
<input type="radio" name="symbol" value="/" id="delete" />
24-
<label for="delete"> / delete</label>
25-
</div>
26-
<div class="operator">
27-
<input type="radio" name="symbol" value="*" id="multiply" />
28-
<label for="multiply"> * multiply</label>
29-
</div>
30-
<button class="submit">Calculate</button>
31-
<div class="total">Result: <span class="out">_____</span></div>
32-
</div>
3311
<script src="js.js"></script>
3412
</body>
3513
</html>

‎day17/js.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
const argumentOne = document.querySelector(".first");
2-
const argumentTwo = document.querySelector(".second");
3-
const submitButton = document.querySelector(".submit");
4-
const symbolsRadio = document.querySelectorAll("input[type=radio]");
5-
const divOut = document.querySelector(".out");
6-
7-
submitButton.addEventListener("click", () => {
8-
for (key of symbolsRadio) {
9-
if (key.checked)
10-
divOut.innerHTML = Math.round(
11-
eval(argumentOne.value + key.value + argumentTwo.value)
12-
);
13-
}
14-
});
1+
const chooseOptimalDistance = (t, k, ls) => {
2+
ls = [51, 56, 58, 59, 61];
3+
t = 174;
4+
k = 3;
5+
6+
let summ = 0;
7+
// const a = [];
8+
9+
// твій код
10+
// return null;
11+
};
12+
13+
chooseOptimalDistance();
14+
15+
// chooseOptimalDistance(174, 3, [51, 56, 58, 59, 61]); //173
16+
// chooseOptimalDistance(163, 3, [50]); // null
17+
18+
// Завдання до виконання мовою JavaScript
19+
// Ділан і Кейт хочуть подорожувати між кількома містами А, В, С.... Кейт має на аркуші паперу список відстаней між цими містами. ls = [51, 56, 58, 59, 61]. Ділан втомився їздити, і він каже Кейт, що не хоче їхати більше t = 174 милі, і він відвідає лише 3 міста. Які відстані, а отже, які міста вони оберуть, щоб сума відстаней була якомога більшою, щоб догодити Кейт та Ділану?

‎day17/styles.css

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +0,0 @@
1-
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@700;800&family=Roboto+Mono:wght@700&display=swap");
2-
3-
body,
4-
input,
5-
button {
6-
font-size: 24px;
7-
font-family: "Roboto Mono", monospace;
8-
}
9-
10-
.main {
11-
display: flex;
12-
flex-direction: column;
13-
width: 500px;
14-
margin: 100px auto;
15-
background: #ffffff;
16-
box-shadow: 0px 0px 44px rgba(148, 146, 120, 0.23);
17-
border-radius: 20px;
18-
padding-top: 55px;
19-
padding-bottom: 20px;
20-
}
21-
22-
button {
23-
background: #ed7861;
24-
box-shadow: 0px 1px 8px rgba(0, 0, 0, 0.05);
25-
border-radius: 16px;
26-
display: flex;
27-
justify-content: center;
28-
align-items: center;
29-
color: white;
30-
border: none;
31-
padding: 20px 100px;
32-
cursor: pointer;
33-
width: fit-content;
34-
margin: 30px auto;
35-
}
36-
37-
button:hover {
38-
background: #254441;
39-
}
40-
41-
label {
42-
background: #ffffff;
43-
box-shadow: 0px 1px 8px rgba(0, 0, 0, 0.05);
44-
border-radius: 16px;
45-
display: flex;
46-
justify-content: baseline;
47-
align-items: center;
48-
color: #60c1b6;
49-
font-family: "Roboto Mono", monospace;
50-
width: 35%;
51-
height: 68px;
52-
font-size: 1.5rem;
53-
cursor: pointer;
54-
padding: 0 10px;
55-
}
56-
57-
input[type="radio"] {
58-
display: none;
59-
}
60-
61-
input[type="radio"]:checked + label {
62-
background: #60c1b6;
63-
color: white;
64-
}
65-
66-
input::placeholder {
67-
font-size: 20px;
68-
}
69-
70-
.first,
71-
.second,
72-
.total {
73-
text-align: center;
74-
font-size: 3.875rem;
75-
border: none;
76-
background: none;
77-
outline: none;
78-
margin-right: 10px;
79-
width: 60%;
80-
border-bottom: 3px dotted #b3b3b3;
81-
margin: 10px auto;
82-
}
83-
84-
.second {
85-
margin-bottom: 30px;
86-
}
87-
88-
.total {
89-
font-size: 2rem;
90-
margin-bottom: 40px;
91-
}
92-
93-
.total span {
94-
font-size: 3rem;
95-
}
96-
97-
.operator {
98-
display: flex;
99-
justify-content: center;
100-
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /