diff --git a/03_dom/agenda.md b/03_dom/agenda.md index 3f1d6a6..aa409dc 100644 --- a/03_dom/agenda.md +++ b/03_dom/agenda.md @@ -360,11 +360,11 @@ Projektarbeit **Übungen:** -Übung 09 - 13 +Übung 08 - 10 --- -#### Tag 25 +#### Tag 24 **Inhalt:** @@ -376,6 +376,6 @@ Projektarbeit **Übungen:** -Übung 14 +Übung 11 - 14 --- diff --git a/03_dom/uebungen/u08-09_newsboard/assets/js/main.js b/03_dom/uebungen/u08-09_newsboard/assets/js/main.js index d5f6676..f41b4da 100644 --- a/03_dom/uebungen/u08-09_newsboard/assets/js/main.js +++ b/03_dom/uebungen/u08-09_newsboard/assets/js/main.js @@ -18,38 +18,127 @@ // === INIT ============= const init = () => { // Funktionaufrufe zu beginn der Anwendung - showMessageByNumber(1); + + ////////////////// + // Start 9.2 & 9.3 + // ich musste hier die Reihenfolge ändern, damit meine Lösung funktioniert + // sonst wäre DOM.progressBar.value = 0 (wird erst in der initPro... auf 1 initialisiert) initProgressbar(); + updateMessageByNumber(1); + // Ende 9.2 & 9.3 + ///////////////// + + //////////////// + // Start 8.2 + setMessageNumber(1); + // Ende 8.2 + //////////////// // Eventlauscher zu beginn der Anwendung DOM.buttonNext.addEventListener('click', onClickNext); DOM.buttonPrev.addEventListener('click', onClickPrev); + /////////////////////// + // Start 8.1 + DOM.buttonFirst.addEventListener('click', onClickFirst); + DOM.buttonLast.addEventListener('click', onClickLast); + // Ende 8.1 + /////////////// window.addEventListener('keyup', onKeyUp); }; // === EVENTHANDLER ===== const onKeyUp = (e) => { // Übung 8.3 && 8.4 Tastatursteuerung + console.log(e); + if (e.key === 'ArrowLeft') { + if (!e.altKey) { + onClickPrev(e); + } else { + onClickFirst(e); + } + } else if (e.key === 'ArrowRight') { + if (!e.altKey) { + onClickNext(e); + } else { + onClickLast(e); + } + } }; const onClickNext = (e) => { - showMessageByNumber((DOM.progressBar.value += 1)); + updateMessageByNumber((DOM.progressBar.value += 1)); }; const onClickPrev = (e) => { - showMessageByNumber((DOM.progressBar.value -= 1)); + updateMessageByNumber((DOM.progressBar.value -= 1)); }; + + ////////////////// + // Start 8.1 + const onClickFirst = (e) => { + updateMessageByNumber((DOM.progressBar.value = 1)); + }; + const onClickLast = (e) => { + updateMessageByNumber((DOM.progressBar.value = MESSAGES.length)); + }; + // Ende 8.1 + ///////////////////////// + // === XHR/FETCH ======== // === FUNCTIONS ======== - const showMessageByNumber = (n) => { + const updateMessageByNumber = (n) => { DOM.newsboardContent.innerHTML = MESSAGES[n - 1]; + ////////////// + // Start 8.2 + setMessageNumber(n); + // Ende 8.2 + ////////////////// + + ////////////////// + // Start 9.2 + updateBtnState(); + // Ende 9.2 + /////////////////////// }; + ///////////////////////// + // Start 9.2 + const updateBtnState = () => { + const n = DOM.progressBar.value; + if (n === 1) { + // wir sind am Anfang, also die linken Buttons AUSschalten und + // die rechten EINschalten + DOM.buttonFirst.disabled = DOM.buttonPrev.disabled = true; + DOM.buttonLast.disabled = DOM.buttonNext.disabled = false; + } else if (n > 1 && n < MESSAGES.length) { + // wir sind mitten in der message liste - also alle Buttons aktivieren + DOM.buttonFirst.disabled = false; + DOM.buttonPrev.disabled = false; + DOM.buttonLast.disabled = false; + DOM.buttonNext.disabled = false; + } else if (n === MESSAGES.length) { + // wir sind am Ende, also die linken Buttons EINschalten und + // die rechten EINschalten + DOM.buttonLast.disabled = DOM.buttonNext.disabled = true; + DOM.buttonFirst.disabled = DOM.buttonPrev.disabled = false; + } + }; + // Ende 9.2 & 9.3 + ///////////////////// + const initProgressbar = () => { DOM.progressBar.max = MESSAGES.length; DOM.progressBar.value = 1; }; + ////////////// + // Start 8.2 + const setMessageNumber = (n) => { + DOM.messageNumber.textContent = `${n}/${MESSAGES.length}`; + }; + // Ende 8.2 + ///////////////////////////////// + init(); })(); diff --git a/03_dom/uebungen/u10_running-lights/assets/js/main-andreas.js b/03_dom/uebungen/u10_running-lights/assets/js/main-andreas.js new file mode 100644 index 0000000..54d1c7b --- /dev/null +++ b/03_dom/uebungen/u10_running-lights/assets/js/main-andreas.js @@ -0,0 +1,51 @@ +'use strict'; + +(() => { + // === DOM & VARS ======= + const module = document.querySelector('.light-bulbs'); + const DOM = { + lights: Array.from(module.querySelectorAll('img[alt="lightbulb"]')), + }; + + const LIGHT_PATH_ON = 'assets/img/light_on.png'; + const LIGHT_PATH_OFF = 'assets/img/light_off.png'; + + // + // === INIT ============= + const init = () => { + // Eventlistener für jede Lampe + DOM.lights.forEach((light) => { + light.addEventListener('mouseenter', enterMouseLight); + }); + + turnAllLightsOff(); + }; + + // === EVENTHANDLER ===== + const enterMouseLight = (e) => { + // idx des aktuellen lichtes holen + console.log(e.target); + const idx = DOM.lights.indexOf(e.target); + + if (idx === -1) return; + + // nu alle lichter aus + turnAllLightsOff(); + + // mit den index das nächste licht einschalten oder das erste, wenn das letzte an ist + if (idx === DOM.lights.length - 1) { + DOM.lights[0].src = LIGHT_PATH_ON; + } else { + DOM.lights[idx + 1].src = LIGHT_PATH_ON; + } + }; + // === XHR/FETCH ======== + + // === FUNCTIONS ======== + const turnAllLightsOff = () => { + DOM.lights.forEach((light) => { + light.src = LIGHT_PATH_OFF; + }); + }; + init(); +})(); diff --git a/03_dom/uebungen/u10_running-lights/assets/js/main-ersin.js b/03_dom/uebungen/u10_running-lights/assets/js/main-ersin.js new file mode 100644 index 0000000..bed4340 --- /dev/null +++ b/03_dom/uebungen/u10_running-lights/assets/js/main-ersin.js @@ -0,0 +1,68 @@ +'use strict'; + +(() => { + const $ = (qs) => document.querySelector(qs); + const $$ = (qs) => Array.from(document.querySelectorAll(qs)); + + // === DOM & VARS ======= + const DOM = { + // Alle Glühbirnen-Bilder auswählen + bulbs: $$('.light-bulbs img'), + }; + + const LIGHT_PATH_ON = 'assets/img/light_on.png'; + const LIGHT_PATH_OFF = 'assets/img/light_off.png'; + + // Zähler + let activeIndex = 0; + + // === INIT ============= + const init = () => { + if (DOM.bulbs.length === 0) return; + + // zustand reseten + updateLights(); // first bulb on + + DOM.bulbs.forEach((bulb, index) => { + bulb.addEventListener('mouseenter', (e) => onBulbHover(e, index)); + + bulb.addEventListener('click', onBulbClick); + }); + }; + + // === EVENTHANDLER ===== + + const onBulbHover = (e, hoveredIndex) => { + if (hoveredIndex === activeIndex) { + nextLight(); + } + }; + + const onBulbClick = () => { + nextLight(); + }; + + // === FUNCTIONS ======== + + const nextLight = () => { + activeIndex++; + + if (activeIndex >= DOM.bulbs.length) { + activeIndex = 0; + } + + updateLights(); + }; + + const updateLights = () => { + DOM.bulbs.forEach((bulb, index) => { + if (index === activeIndex) { + bulb.src = LIGHT_PATH_ON; + } else { + bulb.src = LIGHT_PATH_OFF; + } + }); + }; + + init(); +})(); diff --git a/03_dom/uebungen/u10_running-lights/assets/js/main.js b/03_dom/uebungen/u10_running-lights/assets/js/main.js index 7324828..6dfd415 100644 --- a/03_dom/uebungen/u10_running-lights/assets/js/main.js +++ b/03_dom/uebungen/u10_running-lights/assets/js/main.js @@ -1,20 +1,56 @@ -'use strict'; - -(() => { - // === DOM & VARS ======= - const DOM = {}; - - const LIGHT_PATH_ON = 'assets/img/light_on.png'; - const LIGHT_PATH_OFF = 'assets/img/light_off.png'; - - // === INIT ============= - const init = () => {}; - - // === EVENTHANDLER ===== - - // === XHR/FETCH ======== - - // === FUNCTIONS ======== - - init(); -})(); +'use strict'; + +(() => { + // === DOM & VARS ======= + const module = document.querySelector('.light-bulbs'); + const DOM = { + lightBulbs: Array.from(module.querySelectorAll('img[alt="lightbulb"]')), + }; + + const LIGHT_PATH_ON = 'assets/img/light_on.png'; + const LIGHT_PATH_OFF = 'assets/img/light_off.png'; + + // console.log(DOM); + // === INIT ============= + const init = () => { + setAllLightsOff(); + + DOM.lightBulbs.forEach((el, idx) => { + el.dataset.index = idx; // Index im HTMLImageElement ablegen (V1) + el.addEventListener('mouseenter', (e) => onMouseEnter(e, idx)); // Index als zweiten Parameter mitgeben (V2) + }); + }; + + // === EVENTHANDLER ===== + const onMouseEnter = (e, idx) => { + // const index = e.currentTarget.dataset.index; + const img = e.currentTarget; + const index = getIndexBy(img); // Index über Funktion ermitteln (V3) + + // if (e.currentTarget.src.includes(LIGHT_PATH_ON)) { + const nextIndex = getNextIndex(index); + + console.log(nextIndex); + setAllLightsOff(); + DOM.lightBulbs[nextIndex].src = LIGHT_PATH_ON; + // + }; + + // === XHR/FETCH ======== + + // === FUNCTIONS ======== + const getIndexBy = (img) => { + return DOM.lightBulbs.indexOf(img); + }; + const getNextIndex = (currentIndex) => { + return currentIndex === DOM.lightBulbs.length - 1 ? 0 : currentIndex + 1; + }; + + const setAllLightsOff = () => { + DOM.lightBulbs.forEach((el) => { + el.src = LIGHT_PATH_OFF; + }); + }; + + init(); +})(); diff --git a/03_dom/uebungen/u11_tasse-01001/assets/css/styles.css b/03_dom/uebungen/u11_tasse-01001/assets/css/styles.css new file mode 100644 index 0000000..6da8361 --- /dev/null +++ b/03_dom/uebungen/u11_tasse-01001/assets/css/styles.css @@ -0,0 +1,369 @@ +/* -------------------------------------------- Haupt CSS fuer alle Seiten -------------------------------------------- */ + +/* ---------------- CSS-Reset ------------------- */ +html, +body, +a, +div, +h1, +h2, +h3, +h4, +h5, +h6, +span, +p, +img, +strong, +ul, +li, +table, +th, +td, +tr { + margin: 0px; + padding: 0px; + border: 0px none; + font-weight: normal; + font-style: inherit; + font-family: inherit; + font-variant: inherit; + text-decoration: none; + table-layout: inherit; +} + +/* ---------------- Body / HTML ------------------- */ + +html { + font-size: 100%; + background-color: #fffef7; +} + +body { + font-family: Helvetica, Arial, sans-serif; + font-size: 1.2em; + font-weight: normal; + color: black; + margin: 0rem auto 2rem auto; +} + +/* ---------------- layout ------------------- */ + +header { + background: url(../img/js_header.png) left top no-repeat transparent; + background-size: cover; + height: 250px; + min-width: 850px; +} + +header:after { + content: ' '; + display: block; + height: 250px; + background: rgba(255, 254, 247, 0); + background: -moz-linear-gradient( + top, + rgba(255, 254, 247, 0) 0%, + rgba(255, 254, 247, 0.55) 22%, + rgba(255, 254, 247, 0.7) 42%, + rgba(255, 254, 247, 0.71) 43%, + rgba(255, 254, 247, 0.78) 61%, + rgba(255, 254, 247, 0.92) 75%, + rgba(255, 254, 247, 1) 87%, + rgba(255, 254, 247, 1) 100% + ); + background: -webkit-gradient( + left top, + left bottom, + color-stop(0%, rgba(255, 254, 247, 0)), + color-stop(22%, rgba(255, 254, 247, 0.55)), + color-stop(42%, rgba(255, 254, 247, 0.7)), + color-stop(43%, rgba(255, 254, 247, 0.71)), + color-stop(61%, rgba(255, 254, 247, 0.78)), + color-stop(75%, rgba(255, 254, 247, 0.92)), + color-stop(87%, rgba(255, 254, 247, 1)), + color-stop(100%, rgba(255, 254, 247, 1)) + ); + background: -webkit-linear-gradient( + top, + rgba(255, 254, 247, 0) 0%, + rgba(255, 254, 247, 0.55) 22%, + rgba(255, 254, 247, 0.7) 42%, + rgba(255, 254, 247, 0.71) 43%, + rgba(255, 254, 247, 0.78) 61%, + rgba(255, 254, 247, 0.92) 75%, + rgba(255, 254, 247, 1) 87%, + rgba(255, 254, 247, 1) 100% + ); + background: -o-linear-gradient( + top, + rgba(255, 254, 247, 0) 0%, + rgba(255, 254, 247, 0.55) 22%, + rgba(255, 254, 247, 0.7) 42%, + rgba(255, 254, 247, 0.71) 43%, + rgba(255, 254, 247, 0.78) 61%, + rgba(255, 254, 247, 0.92) 75%, + rgba(255, 254, 247, 1) 87%, + rgba(255, 254, 247, 1) 100% + ); + background: -ms-linear-gradient( + top, + rgba(255, 254, 247, 0) 0%, + rgba(255, 254, 247, 0.55) 22%, + rgba(255, 254, 247, 0.7) 42%, + rgba(255, 254, 247, 0.71) 43%, + rgba(255, 254, 247, 0.78) 61%, + rgba(255, 254, 247, 0.92) 75%, + rgba(255, 254, 247, 1) 87%, + rgba(255, 254, 247, 1) 100% + ); + background: linear-gradient( + to bottom, + rgba(255, 254, 247, 0) 0%, + rgba(255, 254, 247, 0.55) 22%, + rgba(255, 254, 247, 0.7) 42%, + rgba(255, 254, 247, 0.71) 43%, + rgba(255, 254, 247, 0.78) 61%, + rgba(255, 254, 247, 0.92) 75%, + rgba(255, 254, 247, 1) 87%, + rgba(255, 254, 247, 1) 100% + ); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fffef7', endColorstr='#fffef7', GradientType=0 ); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fffef7', endColorstr='#fffef7', GradientType=0 ); +} + +main, +footer { + width: 70%; + margin: 3rem auto; + min-width: 850px; + padding: 0 20px; + box-sizing: border-box; +} + +/* ---------------- Content ------------------- */ + +h1 { + color: #93412b; + font-size: 3em; + margin-bottom: 20px; + font-weight: bold; +} + +h2 { + color: #93412b; + font-size: 2.5em; + margin-bottom: 15px; +} + +h3 { + color: #93412b; + font-size: 2em; + margin-bottom: 10px; +} + +p { + line-height: 15px; + margin-bottom: 15px; + line-height: 1.7em; +} + +.cited { + font-style: italic; + font-size: 0.8em; +} + +.u { + text-decoration: underline; +} +.b { + font-weight: bold; +} +.i { + font-style: italic; +} +.align_right { + text-align: right; +} +.align_left { + text-align: left; + margin-right: 10px; +} +.align_center { + text-align: center; +} +.float_left { + float: left; +} +.float_right { + float: right; +} +.clear_both { + clear: both; +} +strong { + font-weight: bold; +} +.special { + color: #b7595b; + font-weight: bold; +} +.keyword { + color: #db6f50; + font-weight: bold; + font-style: italic; +} +.gray, +.grey { + color: gray; +} + +/* Links */ +main a:link, +main a:visited { + color: #eb690b; + font-weight: bold; +} + +main a:focus, +main a:hover, +main a:active { + color: #eb690b; +} + +ul { + list-style-position: outside; + margin-bottom: 20px; + padding-left: 22px; +} + +ol { + margin-bottom: 20px; + padding-left: 30px; +} + +li { + line-height: 1.4em; +} + +/* ------- Article ------- */ + +h1 { + color: #93412b; + font-size: 2.7em; + margin-bottom: 20px; +} + +#buy_form input[type='button'] { + display: inline-block; + padding: 1px 20px 3px 20px; + background-color: #93412b; + color: white; + border: 1px solid white; + font-size: 1em; + height: 32px; +} + +#buy_form input[type='button']:hover { + background-color: white; + color: #93412b; + border: 1px solid #93412b; +} + +#buy_form select { + display: inline-block; + font-size: 1em; + background-color: white; + color: #93412b; + border: 1px solid #93412b; + height: 32px; +} + +/* ------- Chat ------- */ + +#chat { + width: 100%; + background-color: white; + border: 1px solid #9c352f; + height: 20rem; + position: relative; +} + +#chat_window { + background-color: white; + width: 85%; + float: left; + height: 95%; +} + +#chat_history { + position: absolute; + bottom: 8%; + max-height: 92%; + padding: 0px 0px 5px 7px; +} + +#chat_history p { + font-size: 0.6em; + margin: 0; +} + +#chat_text { + height: 8%; + position: absolute; + bottom: 0; + width: 85%; +} + +#chat_text input { + width: 98%; + display: block; + margin: auto; +} + +#chat_members { + list-style-type: none; + height: 100%; + width: 15%; + margin-left: 85%; + border-left: 1px solid #9c352f; + text-align: right; + box-sizing: border-box; + min-width: 100px; + font-size: 0.8em; + padding-top: 5px; +} + +#chat_members li { + line-height: 1.2em; + padding: 5px 10px 2px 15px; +} + +#chat_members .highlighted { + background-color: #c14d45; + color: white; +} +.chat_member { + font-weight: bold; +} +.chat_member1 { + color: #3626c8; +} +.chat_member2 { + color: #e38d0b; +} + +#member_search { + position: absolute; + right: 0; + bottom: 0; + width: 15%; + height: 8%; +} + +#member_search input { + width: 88%; + display: block; + margin: auto; + text-align: right; +} diff --git a/03_dom/uebungen/u11_tasse-01001/assets/img/favicon.ico b/03_dom/uebungen/u11_tasse-01001/assets/img/favicon.ico new file mode 100644 index 0000000..bd2cd28 Binary files /dev/null and b/03_dom/uebungen/u11_tasse-01001/assets/img/favicon.ico differ diff --git a/03_dom/uebungen/u11_tasse-01001/assets/img/js_header.png b/03_dom/uebungen/u11_tasse-01001/assets/img/js_header.png new file mode 100644 index 0000000..4d14ceb Binary files /dev/null and b/03_dom/uebungen/u11_tasse-01001/assets/img/js_header.png differ diff --git a/03_dom/uebungen/u11_tasse-01001/assets/img/logo.png b/03_dom/uebungen/u11_tasse-01001/assets/img/logo.png new file mode 100644 index 0000000..bbd9fcc Binary files /dev/null and b/03_dom/uebungen/u11_tasse-01001/assets/img/logo.png differ diff --git a/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_empty.png b/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_empty.png new file mode 100644 index 0000000..d650b1b Binary files /dev/null and b/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_empty.png differ diff --git a/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_paperclip.png b/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_paperclip.png new file mode 100644 index 0000000..7f24721 Binary files /dev/null and b/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_paperclip.png differ diff --git a/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_sheets.png b/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_sheets.png new file mode 100644 index 0000000..14680cb Binary files /dev/null and b/03_dom/uebungen/u11_tasse-01001/assets/img/newsboard_sheets.png differ diff --git a/03_dom/uebungen/u11_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif b/03_dom/uebungen/u11_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif new file mode 100644 index 0000000..3a9c8ad Binary files /dev/null and b/03_dom/uebungen/u11_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif differ diff --git a/03_dom/uebungen/u11_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg b/03_dom/uebungen/u11_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg new file mode 100644 index 0000000..4399460 Binary files /dev/null and b/03_dom/uebungen/u11_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg differ diff --git a/03_dom/uebungen/u11_tasse-01001/index.html b/03_dom/uebungen/u11_tasse-01001/index.html new file mode 100644 index 0000000..868d5c8 --- /dev/null +++ b/03_dom/uebungen/u11_tasse-01001/index.html @@ -0,0 +1,107 @@ + + + + + + 010010000100111101010100 + + + + + + + +
+ +
+

+ Hot Binary Heat Changing Mug + "010010000100111101010100" +

+ + Hot Binary Heat Changing Mug + +

Description

+ +

+ Numbers make up + everything in our digital world. They flow around us, invisible like the Force or + the Matrix, controlling all our many computer-y devices. Two numbers, in particular: + 0 and 1. Off and On. Well, we can tell you this: when + there's no coffee in our cup, we're completely OFF our game. But when our mug is full of hot coffee, we're + totally ON. And now, with the Hot Binary Heat Changing Mug, there's a mug that + tells us which state our mug is in. In binary! +

+ +

+ See, the + Hot Binary Heat Changing Mug + looks like just a dark mug with binary numbers all over it. That's its OFF or cold state. Add hot coffee (or any + liquid) and a series of digits will turn white. Read them continuously from left to right, and you'll read: + 010010000100111101010100. That's in binary. Of course, + your + Hot Binary Heat Changing Mug + could just be paying you a compliment. Cheeky, mug. +

+ +

+ 010010000100111101010100 +

+ +

Product Specifications

+ + + +

You wanna buy it?

+ +

If you like to buy this brilliant mug, just do the following steps:

+ +
    +
  1. Select how many items do you want.
  2. +
  3. Press "buy".
  4. +
+ +
+ + +
+
+ + + + + + diff --git a/03_dom/uebungen/u12_button-bg-color/index.html b/03_dom/uebungen/u12_button-bg-color/index.html new file mode 100644 index 0000000..616d559 --- /dev/null +++ b/03_dom/uebungen/u12_button-bg-color/index.html @@ -0,0 +1,49 @@ + + + + + + Übung 12: Farbe Wechsel Dich + + + + + +
+
+

Übung 12: Farbe Wechsel Dich

+ +
+ + + +
+
+
+ + + diff --git a/03_dom/uebungen/u13_range-bg-color/index.html b/03_dom/uebungen/u13_range-bg-color/index.html new file mode 100644 index 0000000..83fb59d --- /dev/null +++ b/03_dom/uebungen/u13_range-bg-color/index.html @@ -0,0 +1,89 @@ + + + + + + Übung 13: Farbe Wechsel Dich — Teil 2 + + + + +
+
+

Übung 13: Farbe Wechsel Dich — Teil 2

+ +
+
+ + +
+
+ + +
+
+ + +
+
+ Aktuelle Farbe: + rgb(255, 255, 255) + #FFFFFF +
+
+
+
+ + + diff --git a/03_dom/uebungen/u14_awesome-tours/assets/css/awesome-tours.css b/03_dom/uebungen/u14_awesome-tours/assets/css/awesome-tours.css new file mode 100644 index 0000000..285a5a0 --- /dev/null +++ b/03_dom/uebungen/u14_awesome-tours/assets/css/awesome-tours.css @@ -0,0 +1,86 @@ +.main-wrapper { + margin: 5rem auto; + width: 650px; + padding: 1rem; + border: 1px solid black; +} + +.tours-grid { + display: grid; + width: 100%; + grid-template-columns: 1fr 1fr; + grid-template-rows: 200px 200px 0.5fr; + gap: 1rem; + grid-template-areas: + 'item1 item2' + 'item1 item3' + 'item4 item4'; +} + +#fr { + grid-area: item1; +} + +#uk { + grid-area: item2; +} + +#it { + grid-area: item3; +} + +#info { + grid-area: item4; + + border: 2px solid #000077; + padding: 0.5rem; + border-radius: 10px; +} + +img { + width: 100%; + height: 100%; + border-radius: 10px; +} + +.tours { + position: relative; +} + +.m-tours #info img { + width: 30px; +} + +.flag { + font-size: 1.5rem; +} + +.french-flag::before { + content: ''; + display: inline-block; + width: 50px; + height: 30px; + background: red url('../img/fr.png') no-repeat; + background-size: cover; + margin-right: 0.5rem; +} + +.union-jack::before { + content: ''; + display: inline-block; + width: 60px; + height: 30px; + background: red url('../img/uk.png') no-repeat; + background-size: cover; + margin-right: 0.5rem; +} + +.italian-flag::before { + content: ''; + display: inline-block; + width: 60px; + height: 30px; + background: red url('../img/it.png') no-repeat; + background-size: cover; + margin-right: 0.5rem; +} diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/colosseum.jpg b/03_dom/uebungen/u14_awesome-tours/assets/img/colosseum.jpg new file mode 100644 index 0000000..1ed563e Binary files /dev/null and b/03_dom/uebungen/u14_awesome-tours/assets/img/colosseum.jpg differ diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/eiffelturm.jpg b/03_dom/uebungen/u14_awesome-tours/assets/img/eiffelturm.jpg new file mode 100644 index 0000000..5a0f7a4 Binary files /dev/null and b/03_dom/uebungen/u14_awesome-tours/assets/img/eiffelturm.jpg differ diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/fr.png b/03_dom/uebungen/u14_awesome-tours/assets/img/fr.png new file mode 100644 index 0000000..01ecb01 Binary files /dev/null and b/03_dom/uebungen/u14_awesome-tours/assets/img/fr.png differ diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/fr.svg b/03_dom/uebungen/u14_awesome-tours/assets/img/fr.svg new file mode 100644 index 0000000..4110e59 --- /dev/null +++ b/03_dom/uebungen/u14_awesome-tours/assets/img/fr.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/it.png b/03_dom/uebungen/u14_awesome-tours/assets/img/it.png new file mode 100644 index 0000000..dfdd76a Binary files /dev/null and b/03_dom/uebungen/u14_awesome-tours/assets/img/it.png differ diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/it.svg b/03_dom/uebungen/u14_awesome-tours/assets/img/it.svg new file mode 100644 index 0000000..20a8bfd --- /dev/null +++ b/03_dom/uebungen/u14_awesome-tours/assets/img/it.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/tower_bridge.jpg b/03_dom/uebungen/u14_awesome-tours/assets/img/tower_bridge.jpg new file mode 100644 index 0000000..e81a030 Binary files /dev/null and b/03_dom/uebungen/u14_awesome-tours/assets/img/tower_bridge.jpg differ diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/uk.png b/03_dom/uebungen/u14_awesome-tours/assets/img/uk.png new file mode 100644 index 0000000..b4555e5 Binary files /dev/null and b/03_dom/uebungen/u14_awesome-tours/assets/img/uk.png differ diff --git a/03_dom/uebungen/u14_awesome-tours/assets/img/uk.svg b/03_dom/uebungen/u14_awesome-tours/assets/img/uk.svg new file mode 100644 index 0000000..7991383 --- /dev/null +++ b/03_dom/uebungen/u14_awesome-tours/assets/img/uk.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/03_dom/uebungen/u14_awesome-tours/assets/js/awesome-tours.js b/03_dom/uebungen/u14_awesome-tours/assets/js/awesome-tours.js new file mode 100644 index 0000000..a3c8216 --- /dev/null +++ b/03_dom/uebungen/u14_awesome-tours/assets/js/awesome-tours.js @@ -0,0 +1,17 @@ +'use strict'; + +(() => { + // === DOM & VARS ======= + const DOM = {}; + + // === INIT ============= + const init = () => {}; + + // === EVENTHANDLER ===== + + // === XHR/FETCH ======== + + // === FUNCTIONS ======== + + init(); +})(); diff --git a/03_dom/uebungen/u14_awesome-tours/index.html b/03_dom/uebungen/u14_awesome-tours/index.html new file mode 100644 index 0000000..6a3df1c --- /dev/null +++ b/03_dom/uebungen/u14_awesome-tours/index.html @@ -0,0 +1,50 @@ + + + + + + Übung 14: awesome tours + + + + + +
+
+

Übung 14: awesome tours

+ +
+
+ Eiffel Tower +
+ +
+ Tower Bride +
+ +
+ Colosseum +
+
+

Move your mouse pointer over the images to read the descriptions here!

+
+
+
+
+ + diff --git a/03_dom/uebungen/uebungen-11-14.zip b/03_dom/uebungen/uebungen-11-14.zip new file mode 100644 index 0000000..fe6f4c7 Binary files /dev/null and b/03_dom/uebungen/uebungen-11-14.zip differ diff --git a/03_dom/unterricht/tag23/01_chat-final/assets/js/main.js b/03_dom/unterricht/tag23/01_chat-final/assets/js/main.js index ce93bac..145b874 100644 --- a/03_dom/unterricht/tag23/01_chat-final/assets/js/main.js +++ b/03_dom/unterricht/tag23/01_chat-final/assets/js/main.js @@ -22,7 +22,8 @@ // === EVENTHANDLER ===== const onInputSearch = (e) => { - const value = e.target.value; // aktuelle Eingabe von input + const inputEl = e.target; + const value = inputEl.value; // aktuelle Eingabe von input highlightListItemBy(value); }; diff --git a/03_dom/unterricht/tag23/06_attribut-boolean/index.html b/03_dom/unterricht/tag23/06_attribut-boolean/index.html index 553f8cf..59b7e61 100644 --- a/03_dom/unterricht/tag23/06_attribut-boolean/index.html +++ b/03_dom/unterricht/tag23/06_attribut-boolean/index.html @@ -55,15 +55,16 @@ DOM.buttonCheckOnOff = $('.button-check-on-off'); // IDL mit boolscher Wertzuweisung (RECOMMENDED) - DOM.cbAgb.checked = true; + DOM.cbAgb.checked = true; // DOM.cbAgb.setAttribute('checked', '') <- Alternative NOT RECOMMENDED DOM.inputSearch.required = false; DOM.inputSearch.readOnly = false; + DOM.cbAgb.checked = false; DOM.btnSend.disabled = true; // Content Attribut Methoden DOM.btnSend.removeAttribute('disabled'); - DOM.btnSend.setAttribute('disabled', ''); + DOM.btnSend.setAttribute('disabled', ''); // (NOT RECOMMENDED) DOM.inputRange.addEventListener('input', (e) => { console.log('value: ', e.target.value); // aktueller Wert @@ -80,11 +81,37 @@ } else { DOM.btnSend.disabled = false; } - // DOM.btnSend.disabled = (!cbEl.checked) ? true : false // DOM.btnSend.disabled = !cbEl.checked; }); + + DOM.buttonCheckOn.addEventListener('click', (e) => { + e.preventDefault(); // => Standardverhalten unterbinden (Formulardaten versenden) + DOM.cbAgb.checked = true; + DOM.btnSend.disabled = false; + }); + + DOM.buttonCheckOff.addEventListener('click', (e) => { + e.preventDefault(); // => Standardverhalten unterbinden (Formulardaten versenden) + DOM.cbAgb.checked = false; + DOM.btnSend.disabled = true; + }); + + DOM.buttonCheckOnOff.addEventListener('click', (e) => { + e.preventDefault(); // => Standardverhalten unterbinden (Formulardaten versenden) + + // DOM.cbAgb.checked = !DOM.cbAgb.checked; // => !false -> true | !true -> false + // DOM.btnSend.disabled = !DOM.btnSend.disabled; + + if (DOM.cbAgb.checked) { + DOM.cbAgb.checked = false; + DOM.btnSend.disabled = true; + } else { + DOM.cbAgb.checked = true; + DOM.btnSend.disabled = false; + } + }); diff --git a/03_dom/unterricht/tag24/01_style-font-size/assets/js/main.js b/03_dom/unterricht/tag24/01_style-font-size/assets/js/main.js new file mode 100644 index 0000000..6911429 --- /dev/null +++ b/03_dom/unterricht/tag24/01_style-font-size/assets/js/main.js @@ -0,0 +1,105 @@ +'use strict'; + +(() => { + const $ = (qs) => document.querySelector(qs); + const $$ = (qs) => Array.from(document.querySelectorAll(qs)); + + // === DOM & VARS ======= + const SMALL = 14; + const NORMAL = 16; + const BIG = 24; + const VERY_LARGE = 36; + + const DOM = { + // btnVeryLarge: $('.button-very-large'), + // btnBig: $('.button-big'), + // btnNormal: $('.button-normal'), + // btnSmall: $('.button-small'), + // btnInc: $('.button-increase'), + // btnDec: $('.button-decrease'), + btns: $$('.button-controls button'), + + text: $('p'), + }; + + // === INIT ============= + const init = () => { + // einmalige Zuweisung der Schriftgröße aus Browser oder CSS-Definition + DOM.text.style.fontSize = window.getComputedStyle(DOM.text).fontSize; + + console.log(window.getComputedStyle(DOM.text)); + + console.log(DOM); + // DOM.text.style.color = 'tomato'; + // DOM.text.style.backgroundColor = '#222'; + // DOM.text.style.fontSize = '48px'; + + DOM.btns.forEach((el) => { + el.addEventListener('click', onClickFontSize); + }); + // DOM.btnVeryLarge.addEventListener('click', onClickVeryLarge); + // DOM.btnBig.addEventListener('click', onClickBig); + // DOM.btnNormal.addEventListener('click', onClickNormal); + // DOM.btnSmall.addEventListener('click', onClickSmall); + // DOM.btnInc.addEventListener('click', onClickInc); + // DOM.btnDec.addEventListener('click', onClickDec); + }; + + // === EVENTHANDLER ===== + + const onClickFontSize = (e) => { + const btn = e.currentTarget; + const label = btn.dataset.label; // btn.getAttribute('data-label') + const size = btn.dataset.size; // btn.getAttribute('data-size'); + + switch (label) { + case 'INCREASE': + setFontSizeTo(currentFontSize() + 5); + break; + case 'DECREASE': + setFontSizeTo(currentFontSize() - 5); + break; + default: + setFontSizeTo(size); + + // setFontSizeTo(eval(label)); // eval is evil -> 'VERY_LARGE' -> eval('VERY_LARGE') -> VERY_LARGE <- die Konfigurationsvariable + } + }; + // const onClickVeryLarge = (e) => { + // console.log('click'); + // setFontSizeTo(VERY_LARGE); + // }; + // const onClickBig = (e) => { + // console.log('click'); + // setFontSizeTo(BIG); + // }; + // const onClickNormal = (e) => { + // console.log('click'); + // setFontSizeTo(NORMAL); + // }; + // const onClickSmall = (e) => { + // console.log('click'); + // setFontSizeTo(SMALL); + // }; + + // const onClickInc = (e) => { + // setFontSizeTo(currentFontSize() + 5); + // }; + // const onClickDec = (e) => { + // setFontSizeTo(currentFontSize() - 5); + // }; + + // === XHR/FETCH ======== + + // === FUNCTIONS ======== + const setFontSizeTo = (size) => { + DOM.text.style.fontSize = `${size}px`; + }; + + const currentFontSize = () => { + // return parseInt(window.getComputedStyle(DOM.text).fontSize); // => '16px' -> 16 + return parseInt(DOM.text.style.fontSize); + }; + + init(); +})(); diff --git a/03_dom/unterricht/tag24/01_style-font-size/index.html b/03_dom/unterricht/tag24/01_style-font-size/index.html new file mode 100644 index 0000000..3c5ca09 --- /dev/null +++ b/03_dom/unterricht/tag24/01_style-font-size/index.html @@ -0,0 +1,58 @@ + + + + + + Style Font-Size (Beispiel) + + + + + +
+
+

Style Font-Size (Beispiel)

+
+ +
+

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Esse eveniet, voluptatem sint enim culpa dicta + accusamus maiores consequuntur quisquam nisi, itaque voluptas, corrupti velit. Adipisci quo suscipit, + repellendus, necessitatibus modi dolore inventore incidunt, tenetur odit numquam dolorum saepe doloribus + voluptatum eaque in quisquam neque. Nemo animi facere ipsam earum ipsa tempore porro, exercitationem debitis + perspiciatis quisquam ut ea eum. Ea quia delectus odit labore atque nesciunt esse voluptatibus reiciendis + saepe nam provident aspernatur sapiente cumque, incidunt quasi neque dignissimos impedit amet sequi aut + minus optio aliquam officiis. Deserunt dolorem quod, in voluptas sunt, praesentium tenetur ullam dolore + doloremque repudiandae reiciendis veniam debitis eaque nobis quisquam ex quibusdam fugit. Ullam nemo tenetur + perferendis iusto neque fugit excepturi, dolorum ab totam maiores ut aspernatur? Cumque dicta dolore + mollitia, porro sit hic tenetur error voluptate facere iste nisi natus? Libero quaerat ullam explicabo modi + beatae eveniet, aliquid debitis facere enim id rem illum nobis sequi hic quasi. In qui et illo officiis, + animi doloremque ipsa harum, natus voluptate quod, voluptatum architecto doloribus asperiores cupiditate. + Tenetur fuga tempore voluptatum illo velit, sed nemo commodi. Unde perspiciatis aspernatur est iusto + quisquam, magni quibusdam accusantium illo laborum nesciunt laboriosam. Quam reiciendis et ipsum sequi dolor + minus aspernatur commodi repellat, aut vero expedita libero quod consequatur! Explicabo temporibus dolore + nihil labore fugit nisi velit veniam dignissimos aperiam id eaque blanditiis, expedita voluptas inventore. + Quisquam minus consequuntur ipsum eos, pariatur fuga minima eaque, temporibus illo placeat dignissimos + laborum maiores incidunt. Dignissimos delectus eum nostrum fuga hic cum aut nesciunt eveniet, cumque ut + beatae officiis et minus vero soluta accusamus corporis aliquam eligendi. Ad, qui ipsum. Distinctio + temporibus ea sequi dignissimos voluptatum quidem! Consequuntur, veniam odit exercitationem sint a + blanditiis voluptatibus quae doloribus adipisci cupiditate, dignissimos placeat asperiores, vel at enim + impedit id debitis! Provident asperiores reprehenderit sit nesciunt? +

+
+
+
+ + diff --git a/03_dom/unterricht/tag24/02_tooltip/assets/css/tooltips.css b/03_dom/unterricht/tag24/02_tooltip/assets/css/tooltips.css new file mode 100644 index 0000000..e8da8f2 --- /dev/null +++ b/03_dom/unterricht/tag24/02_tooltip/assets/css/tooltips.css @@ -0,0 +1,45 @@ +p { + font-size: 1.5em; +} + +.keyword { + font-weight: bolder; + color: #225; +} + +#tooltip { + width: 250px; + border: 2px solid #339; + padding: 1rem; + background-color: rgba(238, 238, 255, 0.9); + + font-size: 1em; + text-align: justify; + + position: absolute; + display: flex; + justify-content: center; + align-items: center; +} + +.show { + display: block !important; + animation-name: fadeIn; + animation-duration: 0.4s; + animation-fill-mode: both; +} +.hide { + display: none !important; +} + +@keyframes fadeIn { + 0% { + opacity: 0; + transform: translate3d(0, 20%, 0); + } + 100% { + opacity: 1; + + transform: translate3d(0, 0, 0); + } +} diff --git a/03_dom/unterricht/tag24/02_tooltip/assets/js/tooltips.js b/03_dom/unterricht/tag24/02_tooltip/assets/js/tooltips.js new file mode 100644 index 0000000..936e985 --- /dev/null +++ b/03_dom/unterricht/tag24/02_tooltip/assets/js/tooltips.js @@ -0,0 +1,57 @@ +'use strict'; + +(() => { + const $ = (qs) => document.querySelector(qs); + const $$ = (qs) => Array.from(document.querySelectorAll(qs)); + + // === DOM & VARS ======= + const DOM = { + keywords: $$('.keyword'), + tooltip: $('#tooltip'), + }; + + const MOUSE_OFFSET_Y = 20; + const MOUSE_OFFSET_X = 10; + + // === INIT ============= + const init = () => { + DOM.keywords.forEach((el) => { + el.addEventListener('mousemove', onMouseMoveKeyword); + el.addEventListener('mouseleave', onMouseLeaveKeyword); + }); + }; + + // === EVENTHANDLER ===== + const onMouseMoveKeyword = (e) => { + const keywordEl = e.currentTarget; + + DOM.tooltip.style.top = `${e.clientY + MOUSE_OFFSET_Y}px`; + DOM.tooltip.style.left = `${e.clientX + MOUSE_OFFSET_X}px`; + + showTooltip(keywordEl); + }; + // === EVENTHANDLER ===== + const onMouseLeaveKeyword = (e) => { + hideTooltip(); + }; + + // === XHR/FETCH ======== + + // === FUNCTIONS ======== + const showTooltip = (el) => { + const text = el.dataset.tooltip; + + DOM.tooltip.textContent = text; + + // DOM.tooltip.style.display = 'block'; + DOM.tooltip.classList.add('show'); + DOM.tooltip.classList.remove('hide'); + }; + const hideTooltip = () => { + // DOM.tooltip.style.display = 'none'; + DOM.tooltip.classList.add('hide'); + DOM.tooltip.classList.remove('show'); + }; + + init(); +})(); diff --git a/03_dom/unterricht/tag24/02_tooltip/index.html b/03_dom/unterricht/tag24/02_tooltip/index.html new file mode 100644 index 0000000..a720f6a --- /dev/null +++ b/03_dom/unterricht/tag24/02_tooltip/index.html @@ -0,0 +1,48 @@ + + + + + Tooltips + + + + + +

Quantum Entanglement Mugs

+

DRINK IN SYNC.

+ +

+ In the realm of + quantum mechanics , particles can be + + entangled + + in such a way that the state of one instantly influences the state of another, no matter the distance. This + phenomenon fascinates physicists and challenges our understanding of reality. Imagine sipping your coffee from a + mug that celebrates this + + quantum + + wonder. Just like entangled particles, you and a friend can share a connection over any distance with these mugs. + Introducing the Quantum Entanglement Mugs. +

+ +

+ Each set of Quantum Entanglement Mugs includes two ceramic mugs designed to reflect + the concept of entanglement. Share one with a friend, and no matter how far apart you are, you'll feel connected. + Use them at your next physics meetup, and your colleagues will appreciate your thoughtful nod to quantum theory. + Enjoy your coffee! +

+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis voluptates, veniam facere laudantium. +
+ + diff --git a/03_dom/unterricht/tag24/03_auslesen-width-position/index.html b/03_dom/unterricht/tag24/03_auslesen-width-position/index.html new file mode 100644 index 0000000..273be07 --- /dev/null +++ b/03_dom/unterricht/tag24/03_auslesen-width-position/index.html @@ -0,0 +1,55 @@ + + + + + + Auslesen von Breite, Höhe und Postion + + + + + +
+
+

Auslesen von Breite, Höhe und Postion

+
+
+
+ + + diff --git a/03_dom/unterricht/tag24/04_data-attribute/index.html b/03_dom/unterricht/tag24/04_data-attribute/index.html new file mode 100644 index 0000000..cf8c764 --- /dev/null +++ b/03_dom/unterricht/tag24/04_data-attribute/index.html @@ -0,0 +1,96 @@ + + + + + + Eigene Attribute mit data-[ATTRIBUT_NAME] - DOMStringMap + + + +
+
+

Eigene Attribute mit data-[ATTRIBUT_NAME] - DOMStringMap

+

+ DOMStringMap + - Die DOMStringMap-Schnittstelle wird für das HTMLElement.dataset-Attribut verwendet, um Daten + für benutzerdefinierte Attribute darzustellen, die zu Elementen hinzugefügt werden. +

+
+ +

+ Lorem ipsum dolor sit + cerebral cortex + + amet consectetur adipisicing elit. Harum voluptatem iure earum suscipit nihil! Recusandae pariatur corporis + odit optio excepturi labore dolore non, expedita temporibus adipisci vero, modi magnam veritatis? +

+ +
+
+ + +