diff --git a/browser-extension/c4gt_testing_code/week3/checkbox.js b/browser-extension/c4gt_testing_code/week3/checkbox.js new file mode 100644 index 00000000..9912d987 --- /dev/null +++ b/browser-extension/c4gt_testing_code/week3/checkbox.js @@ -0,0 +1,54 @@ +console.log("here") +let crazyCheckbox = document.getElementById('flexCheckCrazy'); +let stupidCheckbox = document.getElementById('flexCheckStupid'); + +crazyCheckbox.addEventListener('change', function () { + if (crazyCheckbox.checked) { + funRemoveCrazy(); + } else { + funAddCrazy(); + } +}); + +stupidCheckbox.addEventListener('change', function () { + if (stupidCheckbox.checked) { + funRemoveStupid(); + } else { + funAddStupid(); + } +}); + +function funRemoveCrazy() { + let className = "icon-container-crazy"; + let allCrazy = Array.from(document.querySelectorAll(`.${className}`)) + allCrazy.forEach(element => { + element.style.display = 'none'; + }); +} + +function funAddCrazy(){ + let className = "icon-container-crazy"; + let allCrazy = Array.from(document.querySelectorAll(`.${className}`)) + console.log(allCrazy) ; + allCrazy.forEach(element => { + element.style.display = 'inline'; + }); + +} + +function funRemoveStupid() { + let className = "icon-container-stupid"; + let allStupid = Array.from(document.querySelectorAll(`.${className}`)) + allStupid.forEach(element => { + element.style.display = 'none'; + }); +} + +function funAddStupid(){ + let className = "icon-container-stupid"; + let allStupid = Array.from(document.querySelectorAll(`.${className}`)) + allStupid.forEach(element => { + element.style.display = 'inline'; + }); + +} \ No newline at end of file diff --git a/browser-extension/c4gt_testing_code/week3/index.html b/browser-extension/c4gt_testing_code/week3/index.html index 5505b67a..10f263cb 100644 --- a/browser-extension/c4gt_testing_code/week3/index.html +++ b/browser-extension/c4gt_testing_code/week3/index.html @@ -10,33 +10,24 @@ - + -
@@ -70,9 +61,9 @@