From 10bc36a32d95e81292e3112005b447191565c45c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 15:43:04 +0300 Subject: [PATCH 1/9] 1. uzd. --- 01-show-one-element/global.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/01-show-one-element/global.js b/01-show-one-element/global.js index a70fa8c..f494eb7 100644 --- a/01-show-one-element/global.js +++ b/01-show-one-element/global.js @@ -3,15 +3,15 @@ window.addEventListener("load", function(){ // Here is some pseudo-code to help you get started: // 1. Get the DOM element which will be clicked. - + var more_link = document.getElementById("more_text_link"); // 2. Add a listener for the 'click' event onto that element. - + more_link.addEventListener("click", function(){ // 3. The block for the listener should get the DOM // element containing the text to reveal. - + var more_text = document.getElementById("more_text_content"); // 4. Modify that DOM element's style to change it's 'display' // from a hidden value to a shown value. - + more_text.style.display = "inline"; // 5. Also modify the DOM to hide the "More info..." link. - + more_link.style.display = "none"; }); \ No newline at end of file From 298a4570b6b804556e54518ba9245108adaee6d9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 15:46:11 +0300 Subject: [PATCH 2/9] 1. uzd --- 01-show-one-element/global.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/01-show-one-element/global.js b/01-show-one-element/global.js index f494eb7..e69460b 100644 --- a/01-show-one-element/global.js +++ b/01-show-one-element/global.js @@ -1,17 +1,21 @@ window.addEventListener("load", function(){ - // Here is some pseudo-code to help you get started: - - // 1. Get the DOM element which will be clicked. + // Get the DOM element which will be clicked. var more_link = document.getElementById("more_text_link"); - // 2. Add a listener for the 'click' event onto that element. + + // Add a listener for the 'click' event onto that element. more_link.addEventListener("click", function(){ - // 3. The block for the listener should get the DOM - // element containing the text to reveal. - var more_text = document.getElementById("more_text_content"); - // 4. Modify that DOM element's style to change it's 'display' - // from a hidden value to a shown value. - more_text.style.display = "inline"; - // 5. Also modify the DOM to hide the "More info..." link. - more_link.style.display = "none"; + + // The block for the listener should get the DOM + // element containing the text to reveal. + var more_text = document.getElementById("more_text_content"); + + // Modify that DOM element's style to change it's 'display' + // from a hidden value to a shown value. + more_text.style.display = "inline"; + + // Also modify the DOM to hide the "More info..." link. + more_link.style.display = "none"; + }); + }); \ No newline at end of file From 0aa69b3192ef1a48e00978eee1178cb937f3c76b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 16:01:45 +0300 Subject: [PATCH 3/9] 1 uzd jautajumi --- 01-show-one-element/QUESTIONS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/01-show-one-element/QUESTIONS.md b/01-show-one-element/QUESTIONS.md index 658796e..e18b6ef 100644 --- a/01-show-one-element/QUESTIONS.md +++ b/01-show-one-element/QUESTIONS.md @@ -6,16 +6,16 @@ > If you click the link to reveal more text and then refresh the page, does the text remain revealed, or is it hidden again? Why? -Your reply here... +Teksts nepaliek atklāts, jo viņš nepaliek uzklikšķināts --- > Remove `window.addEventListener("load", function(){` (and the closing `})`) from **global.js**. Does the link still reveal the text? What is the purpose of this code that you've removed? -Your reply here... +Nē, tas gaida līdz lapa ielādējas, pirms pildīt funkciju. --- > Describe the the `addEventListener` method. (Remember that there is a specific, technical, methodical way to describe methods. Your reply should match that format.) -Your reply here... +Ar to pievieno klikšķināšanas notikumu pogai. From f08916c71e8c60316b20736895cbafd8fff146f0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 16:04:45 +0300 Subject: [PATCH 4/9] 1 uzd jaut 2 --- 01-show-one-element/QUESTIONS.md | 2 +- 02-hide-many-elements/global.js | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 02-hide-many-elements/global.js diff --git a/01-show-one-element/QUESTIONS.md b/01-show-one-element/QUESTIONS.md index e18b6ef..c5ddde7 100644 --- a/01-show-one-element/QUESTIONS.md +++ b/01-show-one-element/QUESTIONS.md @@ -12,7 +12,7 @@ Teksts nepaliek atklāts, jo viņš nepaliek uzklikšķināts > Remove `window.addEventListener("load", function(){` (and the closing `})`) from **global.js**. Does the link still reveal the text? What is the purpose of this code that you've removed? -Nē, tas gaida līdz lapa ielādējas, pirms pildīt funkciju. +Nē, jo nav pievienota klikšķināšanas notikums. --- diff --git a/02-hide-many-elements/global.js b/02-hide-many-elements/global.js new file mode 100644 index 0000000..e69de29 From fe450b374ca0df6f830e2a7470fde1924b33f814 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 16:06:12 +0300 Subject: [PATCH 5/9] 2 uzd --- 02-hide-many-elements/global.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/02-hide-many-elements/global.js b/02-hide-many-elements/global.js index e69de29..e836c80 100644 --- a/02-hide-many-elements/global.js +++ b/02-hide-many-elements/global.js @@ -0,0 +1,14 @@ +window.addEventListener("load", function(){ + + var button = document.getElementById('button'); + + button.addEventListener("click", function() { + + var divs_to_hide = document.getElementsByClassName('hide_me'); + + for (var i = 0; i < divs_to_hide.length; i++) { + divs_to_hide[i].style.display = "none"; + } + }); + + }); \ No newline at end of file From 023ae134c813b5d5b06c33c05005a6a25f0e2719 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 16:16:53 +0300 Subject: [PATCH 6/9] 2 uzd jaut --- 02-hide-many-elements/QUESTIONS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/02-hide-many-elements/QUESTIONS.md b/02-hide-many-elements/QUESTIONS.md index 2878485..7ff9162 100644 --- a/02-hide-many-elements/QUESTIONS.md +++ b/02-hide-many-elements/QUESTIONS.md @@ -6,10 +6,10 @@ > How did you go about selecting the DOM elements to hide? Describe the "contract" for that function. -Your reply here... +Paslēpšanas pogai liku paslēpt visu ar className 'hide_me' --- > Describe how you were able to hide each element. Were you able to do it as one operation, or did you use a loop of some kind? Describe the "contracts" that were utilized to accomplish your goal. -Your reply here... \ No newline at end of file +Izmantoju for loopu lai apslēptu visus divus ar className 'hide_me' \ No newline at end of file From 6ffb6eb020981c90397d820c7ef31a1b27f7d45c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 16:49:32 +0300 Subject: [PATCH 7/9] 3. uzd --- 03-show-many-elements/QUESTIONS.md | 2 +- 03-show-many-elements/global.js | 14 ++++++++++++++ 03-show-many-elements/index.html | 23 +++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 03-show-many-elements/global.js create mode 100644 03-show-many-elements/index.html diff --git a/03-show-many-elements/QUESTIONS.md b/03-show-many-elements/QUESTIONS.md index de6f46c..e17b230 100644 --- a/03-show-many-elements/QUESTIONS.md +++ b/03-show-many-elements/QUESTIONS.md @@ -6,4 +6,4 @@ > How did you go about hiding elements initially? -Your reply here... \ No newline at end of file +Paslēptajiem elementiem bija style="display: none" atribūts, kas tos atklājot pārmainījās uz style="display: block" \ No newline at end of file diff --git a/03-show-many-elements/global.js b/03-show-many-elements/global.js new file mode 100644 index 0000000..9b0abba --- /dev/null +++ b/03-show-many-elements/global.js @@ -0,0 +1,14 @@ +window.addEventListener("load", function(){ + + var button = document.getElementById('button'); + + button.addEventListener("click", function() { + + var divs_to_show = document.getElementsByClassName('show_me'); + + for (var i = 0; i < divs_to_show.length; i++) { + divs_to_show[i].style.display = "block"; + } + }); + + }); \ No newline at end of file diff --git a/03-show-many-elements/index.html b/03-show-many-elements/index.html new file mode 100644 index 0000000..4c2ddb6 --- /dev/null +++ b/03-show-many-elements/index.html @@ -0,0 +1,23 @@ + + + + 3. uzdevums + + + + + + + + + + + + + \ No newline at end of file From e86f77b819f5957cb3244c9a3dcc8a606542dc52 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 16:51:10 +0300 Subject: [PATCH 8/9] 3. uzd jautajumi. --- 03-show-many-elements/QUESTIONS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03-show-many-elements/QUESTIONS.md b/03-show-many-elements/QUESTIONS.md index e17b230..f4f9986 100644 --- a/03-show-many-elements/QUESTIONS.md +++ b/03-show-many-elements/QUESTIONS.md @@ -6,4 +6,4 @@ > How did you go about hiding elements initially? -Paslēptajiem elementiem bija style="display: none" atribūts, kas tos atklājot pārmainījās uz style="display: block" \ No newline at end of file +Paslēptajiem elementiem bija style="display: none" atribūts, kas tos atklājot pārmainījās uz style="display: block. " \ No newline at end of file From a103e6c5c4b1f3155daad84fc52ba9db3fd2e74a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2021 19:32:07 +0300 Subject: [PATCH 9/9] Viss parejais --- 02-hide-many-elements/index.html | 9 +++---- 03-show-many-elements/index.html | 4 --- 04-toggle-many-elements/global.js | 21 +++++++++++++++- 05-toggle-elements-of-dom-path/QUESTIONS.md | 2 +- 05-toggle-elements-of-dom-path/global.js | 22 ++++++++++++++++- 06-detecting-typed-input/global.js | 15 +++++++++++- 07-automatic-tabbing-fields/QUESTIONS.md | 1 - 07-automatic-tabbing-fields/global.js | 27 ++++++++++++++++++++- 8 files changed, 85 insertions(+), 16 deletions(-) diff --git a/02-hide-many-elements/index.html b/02-hide-many-elements/index.html index b1889dd..bf2c6bf 100644 --- a/02-hide-many-elements/index.html +++ b/02-hide-many-elements/index.html @@ -7,17 +7,14 @@
- I have the class "show_me", and will stick around even after you click the button at the bottom. + Šim div ir class="show_me", tas nepazudīs
- I have the class "hide_me"; I should disappear when you click the button at the bottom. -
- -
- I'm also part of the "hide_me" class, and should also disappear. + Šim div ir class="hide_me", tas pazudīs
+ \ No newline at end of file diff --git a/03-show-many-elements/index.html b/03-show-many-elements/index.html index 4c2ddb6..aab0cbb 100644 --- a/03-show-many-elements/index.html +++ b/03-show-many-elements/index.html @@ -10,10 +10,6 @@ Šim div ir class="show_me", tas parādās kad uzspiež pogu - - diff --git a/04-toggle-many-elements/global.js b/04-toggle-many-elements/global.js index 1df9d74..bf1c7e2 100644 --- a/04-toggle-many-elements/global.js +++ b/04-toggle-many-elements/global.js @@ -1 +1,20 @@ -// Your JavaScript goes here. \ No newline at end of file +// Your JavaScript goes here. +window.addEventListener("load", function(){ + + var button = document.getElementById('button'); + + button.addEventListener("click", function() { + + var divs_to_toggle = document.getElementsByClassName('toggle_me'); + + for (var i = 0; i < divs_to_toggle.length; i++) { + if (divs_to_toggle[i].style.display === "none") { + divs_to_toggle[i].style.display = "block"; + } + else { + divs_to_toggle[i].style.display = "none"; + } + } + }); + + }); \ No newline at end of file diff --git a/05-toggle-elements-of-dom-path/QUESTIONS.md b/05-toggle-elements-of-dom-path/QUESTIONS.md index 2964861..deb19c5 100644 --- a/05-toggle-elements-of-dom-path/QUESTIONS.md +++ b/05-toggle-elements-of-dom-path/QUESTIONS.md @@ -6,4 +6,4 @@ > Describe the contract you used for finding the movies to toggle in the DOM. How is this function different from other functions that find elements in the DOM? -Your reply here... \ No newline at end of file +Tā komanda paņem no abiem sarakstiem vajadzīgo sarakstu, bet iepriekšējās komandas paņem no visa, to kas atzīmēts ar kādu klasi. \ No newline at end of file diff --git a/05-toggle-elements-of-dom-path/global.js b/05-toggle-elements-of-dom-path/global.js index 1df9d74..c4ea024 100644 --- a/05-toggle-elements-of-dom-path/global.js +++ b/05-toggle-elements-of-dom-path/global.js @@ -1 +1,21 @@ -// Your JavaScript goes here. \ No newline at end of file +// Your JavaScript goes here. +window.addEventListener("load", function(){ + + var button = document.getElementById('toggle_button'); + + button.addEventListener("click", function() { + + var movieList = document.querySelectorAll("ul.second_five li"); + + for (var i = 0; i < movieList.length; i++) { + if (movieList[i].style.display === "list-item") { + movieList[i].style.display = "none"; + } + else { + movieList[i].style.display = "list-item"; + } + } + + }); + + }); \ No newline at end of file diff --git a/06-detecting-typed-input/global.js b/06-detecting-typed-input/global.js index 1df9d74..5ec9373 100644 --- a/06-detecting-typed-input/global.js +++ b/06-detecting-typed-input/global.js @@ -1 +1,14 @@ -// Your JavaScript goes here. \ No newline at end of file +// Your JavaScript goes here. +window.addEventListener("load", function(){ + + var name_field = document.getElementById("full_name"); + + name_field.addEventListener("keyup", function() { + + var greeting_div = document.getElementById("greeting"); + + greeting_div.innerHTML = ("Hello there, " + name_field.value + "!"); + + }); + + }); \ No newline at end of file diff --git a/07-automatic-tabbing-fields/QUESTIONS.md b/07-automatic-tabbing-fields/QUESTIONS.md index 4e920ca..782abaf 100644 --- a/07-automatic-tabbing-fields/QUESTIONS.md +++ b/07-automatic-tabbing-fields/QUESTIONS.md @@ -6,4 +6,3 @@ > What are some refactoring techniques you might apply to the provided solution? -Your reply here... \ No newline at end of file diff --git a/07-automatic-tabbing-fields/global.js b/07-automatic-tabbing-fields/global.js index 1df9d74..2261342 100644 --- a/07-automatic-tabbing-fields/global.js +++ b/07-automatic-tabbing-fields/global.js @@ -1 +1,26 @@ -// Your JavaScript goes here. \ No newline at end of file +// Your JavaScript goes here. +window.addEventListener("load", function(){ + + var area_code = document.getElementById('first'); + var middle_numbers = document.getElementById('second'); + var end_numbers = document.getElementById('third'); + + area_code.addEventListener("keyup", function() { + typed_characters = area_code.value.length; + max_characters = parseInt(area_code.getAttribute("maxlength")); + + if (typed_characters === max_characters) { + middle_numbers.focus(); + } + }); + + middle_numbers.addEventListener("keyup", function() { + typed_characters = middle_numbers.value.length; + max_characters = parseInt(middle_numbers.getAttribute("maxlength")); + + if (typed_characters === max_characters) { + end_numbers.focus(); + } + }); + + }); \ No newline at end of file