diff --git a/03_js-dom/uebungen/u10_running-lights-stefan/assets/js/libs/helpers.js b/03_js-dom/uebungen/u10_running-lights-stefan/assets/js/libs/helpers.js
index 097d2c2..6e572a9 100644
--- a/03_js-dom/uebungen/u10_running-lights-stefan/assets/js/libs/helpers.js
+++ b/03_js-dom/uebungen/u10_running-lights-stefan/assets/js/libs/helpers.js
@@ -2,7 +2,7 @@
const $ = (qs) => document.querySelector(qs);
const $$ = (qs) => Array.from(document.querySelectorAll(qs));
-Node.prototype.on = function(name, fn) {
+Node.prototype.on = function (name, fn) {
this.addEventListener(name, fn);
return this;
};
@@ -12,11 +12,13 @@ Node.prototype.on = function(name, fn) {
// // wird zu:
// document.querySelector('button').on('click', (event) => { });
-Array.prototype.on = Array.prototype.addEventListener = function(name, fn) {
+Array.prototype.on = Array.prototype.addEventListener = function (name, fn) {
this.forEach((elem) => elem.on(name, fn));
return this;
};
+NodeList.prototype.__proto__ = Array.prototype;
+
// anstatt
// Array.from(document.querySelectorAll('.menu-main li a')).forEach((elem) =>
// elem.addEventListener('click', (event) => {
@@ -31,12 +33,9 @@ Array.prototype.on = Array.prototype.addEventListener = function(name, fn) {
// }
// );
-
-
// helper
const $on = (el, ev, fn) => {
- Array.isArray(el) ? el.forEach(ae => $on(ae, ev, fn)) :
- el.addEventListener(ev, fn);
+ Array.isArray(el) ? el.forEach((ae) => $on(ae, ev, fn)) : el.addEventListener(ev, fn);
return el;
};
@@ -80,8 +79,7 @@ function rangeFromStartToEnd(start, end, step = 1) {
result[index++] = value;
}
return result;
-};
-
+}
function range(startOrEnd, end, step) {
if (end) {
@@ -89,4 +87,4 @@ function range(startOrEnd, end, step) {
} else {
return rangeFromStartToEnd(0, startOrEnd);
}
-};
+}
diff --git a/03_js-dom/uebungen/u15_tasse-01001/assets/css/styles.css b/03_js-dom/uebungen/u15_tasse-01001/assets/css/styles.css
new file mode 100644
index 0000000..6da8361
--- /dev/null
+++ b/03_js-dom/uebungen/u15_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_js-dom/uebungen/u15_tasse-01001/assets/img/favicon.ico b/03_js-dom/uebungen/u15_tasse-01001/assets/img/favicon.ico
new file mode 100644
index 0000000..bd2cd28
Binary files /dev/null and b/03_js-dom/uebungen/u15_tasse-01001/assets/img/favicon.ico differ
diff --git a/03_js-dom/uebungen/u15_tasse-01001/assets/img/js_header.png b/03_js-dom/uebungen/u15_tasse-01001/assets/img/js_header.png
new file mode 100644
index 0000000..4d14ceb
Binary files /dev/null and b/03_js-dom/uebungen/u15_tasse-01001/assets/img/js_header.png differ
diff --git a/03_js-dom/uebungen/u15_tasse-01001/assets/img/logo.png b/03_js-dom/uebungen/u15_tasse-01001/assets/img/logo.png
new file mode 100644
index 0000000..bbd9fcc
Binary files /dev/null and b/03_js-dom/uebungen/u15_tasse-01001/assets/img/logo.png differ
diff --git a/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_empty.png b/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_empty.png
new file mode 100644
index 0000000..d650b1b
Binary files /dev/null and b/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_empty.png differ
diff --git a/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_paperclip.png b/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_paperclip.png
new file mode 100644
index 0000000..7f24721
Binary files /dev/null and b/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_paperclip.png differ
diff --git a/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_sheets.png b/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_sheets.png
new file mode 100644
index 0000000..14680cb
Binary files /dev/null and b/03_js-dom/uebungen/u15_tasse-01001/assets/img/newsboard_sheets.png differ
diff --git a/03_js-dom/uebungen/u15_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif b/03_js-dom/uebungen/u15_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_js-dom/uebungen/u15_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif differ
diff --git a/03_js-dom/uebungen/u15_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg b/03_js-dom/uebungen/u15_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_js-dom/uebungen/u15_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg differ
diff --git a/03_js-dom/uebungen/u15_tasse-01001/index.html b/03_js-dom/uebungen/u15_tasse-01001/index.html
new file mode 100644
index 0000000..78bb0f8
--- /dev/null
+++ b/03_js-dom/uebungen/u15_tasse-01001/index.html
@@ -0,0 +1,110 @@
+
+
+
+
+
+ 010010000100111101010100
+
+
+
+
+
+
+
+
+
+
+
+ Hot Binary Heat Changing Mug
+ "010010000100111101010100"
+
+
+
+
+ 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.
+
+
+
+
+
+
+ Product Specifications
+
+
+ Hot Binary Heat Changing Mug
+
+ As you add hot liquids, the binary for "HOT" appears (read from left to right in one line, not two:
+ 010010000100111101010100)
+
+ A ThinkGeek creation and exclusive!
+
+ Care Instructions:
+ Hand wash only. Not microwave or dishwasher safe.
+
+ Materials: Ceramic
+ Dimensions: approx. 3.15" diameter x 3.75" tall
+
+
+ You wanna buy it?
+
+ If you like to buy this brilliant mug, just do the following steps:
+
+
+ Select how many items do you want.
+ Press "buy".
+
+
+
+
+
+ (C) by ThinkGeek – Produkttext mit freundlicher Genehmigung von ThinkGeek Inc.
+
+
+
+
diff --git a/03_js-dom/uebungen/u16_tasse-01001/assets/css/styles.css b/03_js-dom/uebungen/u16_tasse-01001/assets/css/styles.css
new file mode 100644
index 0000000..6da8361
--- /dev/null
+++ b/03_js-dom/uebungen/u16_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_js-dom/uebungen/u16_tasse-01001/assets/img/favicon.ico b/03_js-dom/uebungen/u16_tasse-01001/assets/img/favicon.ico
new file mode 100644
index 0000000..bd2cd28
Binary files /dev/null and b/03_js-dom/uebungen/u16_tasse-01001/assets/img/favicon.ico differ
diff --git a/03_js-dom/uebungen/u16_tasse-01001/assets/img/js_header.png b/03_js-dom/uebungen/u16_tasse-01001/assets/img/js_header.png
new file mode 100644
index 0000000..4d14ceb
Binary files /dev/null and b/03_js-dom/uebungen/u16_tasse-01001/assets/img/js_header.png differ
diff --git a/03_js-dom/uebungen/u16_tasse-01001/assets/img/logo.png b/03_js-dom/uebungen/u16_tasse-01001/assets/img/logo.png
new file mode 100644
index 0000000..bbd9fcc
Binary files /dev/null and b/03_js-dom/uebungen/u16_tasse-01001/assets/img/logo.png differ
diff --git a/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_empty.png b/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_empty.png
new file mode 100644
index 0000000..d650b1b
Binary files /dev/null and b/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_empty.png differ
diff --git a/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_paperclip.png b/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_paperclip.png
new file mode 100644
index 0000000..7f24721
Binary files /dev/null and b/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_paperclip.png differ
diff --git a/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_sheets.png b/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_sheets.png
new file mode 100644
index 0000000..14680cb
Binary files /dev/null and b/03_js-dom/uebungen/u16_tasse-01001/assets/img/newsboard_sheets.png differ
diff --git a/03_js-dom/uebungen/u16_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif b/03_js-dom/uebungen/u16_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_js-dom/uebungen/u16_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif differ
diff --git a/03_js-dom/uebungen/u16_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg b/03_js-dom/uebungen/u16_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_js-dom/uebungen/u16_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg differ
diff --git a/03_js-dom/uebungen/u16_tasse-01001/index.html b/03_js-dom/uebungen/u16_tasse-01001/index.html
new file mode 100644
index 0000000..58d8753
--- /dev/null
+++ b/03_js-dom/uebungen/u16_tasse-01001/index.html
@@ -0,0 +1,109 @@
+
+
+
+
+
+ 010010000100111101010100
+
+
+
+
+
+
+
+
+
+
+
+ Hot Binary Heat Changing Mug
+ "010010000100111101010100"
+
+
+
+
+ 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.
+
+
+
+
+
+
+ Product Specifications
+
+
+ Hot Binary Heat Changing Mug
+
+ As you add hot liquids, the binary for "HOT" appears (read from left to right in one line, not two:
+ 010010000100111101010100)
+
+ A ThinkGeek creation and exclusive!
+
+ Care Instructions:
+ Hand wash only. Not microwave or dishwasher safe.
+
+ Materials: Ceramic
+ Dimensions: approx. 3.15" diameter x 3.75" tall
+
+
+ You wanna buy it?
+
+ If you like to buy this brilliant mug, just do the following steps:
+
+
+ Select how many items do you want.
+ Press "buy".
+
+
+
+
+
+ (C) by ThinkGeek – Produkttext mit freundlicher Genehmigung von ThinkGeek Inc.
+
+
+
+
diff --git a/03_js-dom/uebungen/u17_tasse-01001/assets/css/styles.css b/03_js-dom/uebungen/u17_tasse-01001/assets/css/styles.css
new file mode 100644
index 0000000..6da8361
--- /dev/null
+++ b/03_js-dom/uebungen/u17_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_js-dom/uebungen/u17_tasse-01001/assets/img/favicon.ico b/03_js-dom/uebungen/u17_tasse-01001/assets/img/favicon.ico
new file mode 100644
index 0000000..bd2cd28
Binary files /dev/null and b/03_js-dom/uebungen/u17_tasse-01001/assets/img/favicon.ico differ
diff --git a/03_js-dom/uebungen/u17_tasse-01001/assets/img/js_header.png b/03_js-dom/uebungen/u17_tasse-01001/assets/img/js_header.png
new file mode 100644
index 0000000..4d14ceb
Binary files /dev/null and b/03_js-dom/uebungen/u17_tasse-01001/assets/img/js_header.png differ
diff --git a/03_js-dom/uebungen/u17_tasse-01001/assets/img/logo.png b/03_js-dom/uebungen/u17_tasse-01001/assets/img/logo.png
new file mode 100644
index 0000000..bbd9fcc
Binary files /dev/null and b/03_js-dom/uebungen/u17_tasse-01001/assets/img/logo.png differ
diff --git a/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_empty.png b/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_empty.png
new file mode 100644
index 0000000..d650b1b
Binary files /dev/null and b/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_empty.png differ
diff --git a/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_paperclip.png b/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_paperclip.png
new file mode 100644
index 0000000..7f24721
Binary files /dev/null and b/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_paperclip.png differ
diff --git a/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_sheets.png b/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_sheets.png
new file mode 100644
index 0000000..14680cb
Binary files /dev/null and b/03_js-dom/uebungen/u17_tasse-01001/assets/img/newsboard_sheets.png differ
diff --git a/03_js-dom/uebungen/u17_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif b/03_js-dom/uebungen/u17_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_js-dom/uebungen/u17_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug.gif differ
diff --git a/03_js-dom/uebungen/u17_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg b/03_js-dom/uebungen/u17_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_js-dom/uebungen/u17_tasse-01001/assets/img/thinkgeek_2024_hot_binary_heat_change_mug_grid_embed.jpg differ
diff --git a/03_js-dom/uebungen/u17_tasse-01001/index.html b/03_js-dom/uebungen/u17_tasse-01001/index.html
new file mode 100644
index 0000000..5b9ded8
--- /dev/null
+++ b/03_js-dom/uebungen/u17_tasse-01001/index.html
@@ -0,0 +1,111 @@
+
+
+
+
+
+ 010010000100111101010100
+
+
+
+
+
+
+
+
+
+
+
+ Hot Binary Heat Changing Mug
+ "010010000100111101010100"
+
+
+
+
+ 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.
+
+
+
+
+
+
+ Product Specifications
+
+
+ Hot Binary Heat Changing Mug
+
+ As you add hot liquids, the binary for "HOT" appears (read from left to right in one line, not two:
+ 010010000100111101010100)
+
+ A ThinkGeek creation and exclusive!
+
+ Care Instructions:
+ Hand wash only. Not microwave or dishwasher safe.
+
+ Materials: Ceramic
+ Dimensions: approx. 3.15" diameter x 3.75" tall
+
+
+ You wanna buy it?
+
+ If you like to buy this brilliant mug, just do the following steps:
+
+
+ Select how many items do you want.
+ Press "buy".
+
+
+
+
+
+ (C) by ThinkGeek – Produkttext mit freundlicher Genehmigung von ThinkGeek Inc.
+
+
+
+
diff --git a/03_js-dom/uebungen/uebungen-15-17.zip b/03_js-dom/uebungen/uebungen-15-17.zip
new file mode 100644
index 0000000..ce3d980
Binary files /dev/null and b/03_js-dom/uebungen/uebungen-15-17.zip differ
diff --git a/03_js-dom/unterricht/tag23/03_product-manager/assets/css/main.css b/03_js-dom/unterricht/tag23/03_product-manager/assets/css/main.css
index 553ae7f..fa0045a 100644
--- a/03_js-dom/unterricht/tag23/03_product-manager/assets/css/main.css
+++ b/03_js-dom/unterricht/tag23/03_product-manager/assets/css/main.css
@@ -20,3 +20,15 @@ body {
margin-bottom: 0;
}
}
+
+.product-manager table td {
+ vertical-align: middle;
+}
+
+.product-manager table td button {
+ margin: 0 3px;
+}
+
+.product-manager table .th-actions {
+ width: 180px;
+}
diff --git a/03_js-dom/unterricht/tag23/03_product-manager/assets/js/main.js b/03_js-dom/unterricht/tag23/03_product-manager/assets/js/main.js
index a57eeb0..f5923b5 100644
--- a/03_js-dom/unterricht/tag23/03_product-manager/assets/js/main.js
+++ b/03_js-dom/unterricht/tag23/03_product-manager/assets/js/main.js
@@ -34,7 +34,32 @@
};
addProduct(product);
+ disableNonFunctionalButtons();
};
+
+ const onClickRemove = (e) => {
+ const btn = e.currentTarget;
+ const currentRow = parents(btn, 'tr')[0]; // btn.closest('tr'); // btn.parentNode.parentNode;
+
+ currentRow.remove();
+ // currentRow.parentNode.removeChild(currentRow); // IE11 support
+ disableNonFunctionalButtons();
+ };
+
+ const onClickMoveUp = (e) => {
+ const btn = e.currentTarget;
+ const currentRow = parents(btn, 'tr')[0];
+ DOM.tbody.insertBefore(currentRow, currentRow.previousElementSibling);
+ disableNonFunctionalButtons();
+ };
+
+ const onClickMoveDown = (e) => {
+ const btn = e.currentTarget;
+ const currentRow = parents(btn, 'tr')[0];
+ DOM.tbody.insertBefore(currentRow, currentRow.nextElementSibling.nextElementSibling);
+ disableNonFunctionalButtons();
+ };
+
// === XHR/FETCH ========
// === FUNCTIONS ========
@@ -43,6 +68,7 @@
// addProduct(product);
// });
PRODUCTS.forEach(addProduct);
+ disableNonFunctionalButtons();
};
const addProduct = (product) => {
@@ -60,21 +86,108 @@
const td = document.createElement('td');
td.classList.add('td-actions');
- const btnRemove = document.createElement('button');
+ const btnRemove = createBtn({
+ classNames: ['btn-danger', 'button-product-remove'],
+ iconName: 'trash-can',
+ label: 'Remove product',
+ clickHandler: onClickRemove,
+ });
+ const btnMoveUp = createBtn({
+ classNames: ['btn-secondary', 'button-product-move-up'],
+ iconName: 'chevron-up',
+ label: 'Move up',
+ clickHandler: onClickMoveUp,
+ });
+ const btnMoveDown = createBtn({
+ classNames: ['btn-secondary', 'button-product-move-down'],
+ iconName: 'chevron-down',
+ label: 'Move down',
+ clickHandler: onClickMoveDown,
+ });
+
+ td.append(btnRemove, btnMoveUp, btnMoveDown);
+
+ return td;
+ };
+
+ // const createBtnRemove = () => {
+ // const btn = document.createElement('button');
+ // const icon = document.createElement('i');
+ // const span = document.createElement('span');
+
+ // btn.classList.add('btn', 'btn-danger', 'button-product-remove');
+ // icon.classList.add('fas', 'fa-trash-can');
+ // span.classList.add('visually-hidden');
+ // span.textContent = 'Remove Product';
+
+ // btn.addEventListener('click', onClickRemove);
+
+ // btn.appendChild(icon);
+ // btn.appendChild(span);
+
+ // return btn;
+ // };
+
+ // const createBtnMoveUp = () => {
+ // const btn = document.createElement('button');
+ // const icon = document.createElement('i');
+ // const span = document.createElement('span');
+
+ // btn.classList.add('btn', 'btn-secondary', 'button-product-move-up');
+ // icon.classList.add('fas', 'fa-chevron-up');
+ // span.classList.add('visually-hidden');
+ // span.textContent = 'Move up';
+
+ // btn.addEventListener('click', onClickMoveUp);
+
+ // btn.appendChild(icon);
+ // btn.appendChild(span);
+
+ // return btn;
+ // };
+
+ // const createBtnMoveDown = () => {
+ // const btn = document.createElement('button');
+ // const icon = document.createElement('i');
+ // const span = document.createElement('span');
+
+ // btn.classList.add('btn', 'btn-secondary', 'button-product-move-down');
+ // icon.classList.add('fas', 'fa-chevron-down');
+ // span.classList.add('visually-hidden');
+ // span.textContent = 'Move down';
+
+ // btn.addEventListener('click', onClickMoveDown);
+
+ // btn.appendChild(icon);
+ // btn.appendChild(span);
+
+ // return btn;
+ // };
+
+ const createBtn = (options = {}) => {
+ const {
+ classNames = [],
+ iconName = 'circle',
+ label,
+ clickHandler = (e) => {
+ console.log('no click action');
+ },
+ } = options;
+ const btn = document.createElement('button');
const icon = document.createElement('i');
const span = document.createElement('span');
- btnRemove.classList.add('btn', 'btn-danger', 'button-product-remove');
- icon.classList.add('fas', 'fa-trash-can');
+ btn.classList.add('btn', ...classNames);
+ icon.classList.add('fas', `fa-${iconName}`);
span.classList.add('visually-hidden');
- span.textContent = 'Remove Product';
+ span.textContent = label;
- btnRemove.appendChild(icon);
- btnRemove.appendChild(span);
+ btn.addEventListener('click', clickHandler);
- td.appendChild(btnRemove);
+ btn.appendChild(icon);
+ btn.appendChild(span);
- return td;
+ return btn;
};
const createTd = (text, ...classNames) => {
@@ -95,5 +208,21 @@
return tr;
};
+ const disableNonFunctionalButtons = () => {
+ DOM.tbody.querySelectorAll('tr').forEach((tr) => {
+ tr.querySelector('.button-product-move-up').disabled = !tr.previousElementSibling;
+ tr.querySelector('.button-product-move-down').disabled = !tr.nextElementSibling;
+ });
+ };
+
+ // Helper
+ function parents(el, selector) {
+ const parents = [];
+ while ((el = el.parentNode) && el !== document) {
+ if (!selector || el.matches(selector)) parents.push(el);
+ }
+ return parents;
+ }
+
init();
})();
diff --git a/03_js-dom/unterricht/tag23/03_product-manager/index.html b/03_js-dom/unterricht/tag23/03_product-manager/index.html
index e5a50ae..72ee235 100644
--- a/03_js-dom/unterricht/tag23/03_product-manager/index.html
+++ b/03_js-dom/unterricht/tag23/03_product-manager/index.html
@@ -34,6 +34,14 @@
Remove Product
+
+
+ Move up
+
+
+
+ Move down
+
-->