diff --git a/week-7/dom-playground-master/.gitignore b/week-7/dom-playground-master/.gitignore new file mode 100644 index 0000000..330c75b --- /dev/null +++ b/week-7/dom-playground-master/.gitignore @@ -0,0 +1,2 @@ +/.vscode +.DS_Store \ No newline at end of file diff --git a/week-7/dom-playground-master/README.md b/week-7/dom-playground-master/README.md new file mode 100644 index 0000000..42dc69c --- /dev/null +++ b/week-7/dom-playground-master/README.md @@ -0,0 +1,25 @@ +# DOM Playground + +## Instructions +Modify `js/fix-the-page.js` to fix the page design and layout. When complete, your page should look like the original, "[Wicked Grove](http://www.csszengarden.com/006/)" design. + +## Rules +1) You may not modify the HTML file. +2) You may not modify the CSS file. + +You can use the original HTML and CSS files for reference. + +## What You Need to Know +This assignment is designed to test your knowledge of the following JavaScript features: + +* `document.querySelector()` +* `document.createElement()` +* `element.appendChild()` +* `element.innerHTML` +* `element.style` +* `element.attribute` +* `Array.forEach()` +* The DOM +* Object Literals `{}` +* and more ...! + diff --git a/week-7/dom-playground-master/css/style.css b/week-7/dom-playground-master/css/style.css new file mode 100644 index 0000000..e2f1014 --- /dev/null +++ b/week-7/dom-playground-master/css/style.css @@ -0,0 +1,211 @@ +/* Check the original CSS file for the correct body styles */ +/* It looks like they've been deleted from here. */ +/* Remember, you cannot edit this file. Add the properties using JavaScript. */ +body {} + +p { + font: 10pt/16pt "Trebuchet MS", sans-serif; + margin-top: 0px; + text-align: justify; +} + +h3 { + font: bold normal 12pt "Trebuchet MS", sans-serif; + letter-spacing: 3px; + margin-bottom: 2px; + color: #333333; + text-align: left; +} + +a:link { + font-weight: bold; + text-decoration: none; + color: #FF6600; +} + +a:visited { + font-weight: bold; + text-decoration: none; + color: #CC0000; +} + +a:hover, +a:active { + text-decoration: underline; + color: #FF6600; +} + + +/* Here's a class that you'll need to add to the HTML */ +.page-wrapper { + background: #9cf url(../images/trees.jpg) no-repeat left top; + padding: 200px 0px 0px 0px; + margin: 0px auto; + width: 800px; + border-left: 2px dashed #fff; + border-right: 2px dashed #fff; +} + +header { + margin-bottom: 10px; +} + +/* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ +header h1 { + background: transparent; + margin-top: -180px; + width: 500px; + height: 87px; + float: left; + color: #fff; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} + +header h2 { + background: transparent url(../images/tag.gif) no-repeat top left; + width: 300px; + margin-top: -60px; + margin-left: -190px; + height: 100px; + float: right; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} + + +/* Add this class to the proper element */ +.summary { + width: 130px; + float: left; + padding: 5px; + margin-right: 15px; + background: #0099FF; + +} + +.summary p { + font: bold 8pt/12pt verdana, sans-serif; + text-align: right; + color: #fff; +} + +.summary a:link { + font-weight: bold; + text-decoration: none; + color: #003; +} + +.summary a:visited { + font-weight: bold; + text-decoration: none; + color: #006; +} + +.summary a:hover, +.summary a:active { + text-decoration: underline; + color: #FF6600; +} + +.preamble, +#supporting text, +.explanation, +.participation, +.benefits, +.requirements { + padding: 0px 170px 0px 30px; +} + +footer { + text-align: center; +} + +footer a:link, +footer a:visited { + margin-right: 20px; +} + +/* This class is also missing from the HTML file. Add it! */ +.sidebar { + background: transparent url(../images/menu.gif) top left no-repeat; + position: absolute; + top: 0px; + padding: 15px; + margin-top: 200px; + margin-left: 650px; + width: 130px; +} + +.sidebar .wrapper { + font: 10px verdana, sans-serif; + padding-top: 35px; +} + +.sidebar h3.select { + background: transparent url(../images/select.gif) top left no-repeat; + width: 130px; + height: 25px; + margin-left: -8px; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} + +.sidebar h3.archives { + background: transparent url(../images/archives.gif) top left no-repeat; + width: 130px; + height: 25px; + margin-left: -8px; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} + +.sidebar h3.resources { + background: transparent url(../images/resources.gif) top left no-repeat; + width: 130px; + height: 25px; + margin-left: -8px; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; +} + +.sidebar ul { + margin: 0px; + padding: 0px; +} + +.sidebar li { + line-height: 2.5ex; + background: transparent; + display: block; + padding-top: 5px; + margin-bottom: 5px; + list-style-type: none; +} + +.sidebar li a:link { + color: #FF3300; +} + +.sidebar li a:visited { + color: #FF0000; +} + +.extra1 { + background: transparent; + position: absolute; + top: 40px; + right: 0px; + width: 148px; + height: 110px; +} \ No newline at end of file diff --git a/week-7/dom-playground-master/css/style.orig.css b/week-7/dom-playground-master/css/style.orig.css new file mode 100644 index 0000000..e52af6e --- /dev/null +++ b/week-7/dom-playground-master/css/style.orig.css @@ -0,0 +1,198 @@ +/* css Zen Garden submission 006 - 'Wicked Grove' by D. Keith Robinson, http://www.7nights.com/asterisk/ */ +/* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ +/* All associated graphics copyright 2003, D. Keith Robinson */ + + +/* IMPORTANT */ +/* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ +/* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ +/* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ + + +/* basic elements */ +body { + font: 10pt/14pt "Trebuchet MS", sans-serif; + color: #000033; + background: #69f; + margin: 0px; + } +p { + font: 10pt/16pt "Trebuchet MS", sans-serif; + margin-top: 0px; + text-align: justify; + } +h3 { + font: bold normal 12pt "Trebuchet MS", sans-serif; + letter-spacing: 3px; + margin-bottom: 2px; + color: #333333; + text-align: left; + } +a:link { + font-weight: bold; + text-decoration: none; + color: #FF6600; + } +a:visited { + font-weight: bold; + text-decoration: none; + color: #CC0000; + } +a:hover, a:active { + text-decoration: underline; + color: #FF6600; + } + + +/* specific divs */ +.page-wrapper { + background: #9cf url(../images/trees.jpg) no-repeat left top; + padding: 200px 0px 0px 0px; + margin: 0px auto; + width:800px; + border-left: 2px dashed #fff; + border-right: 2px dashed #fff; + } + +header { + margin-bottom: 10px; + } + +/* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ +header h1 { + background: transparent; + margin-top: -180px; + width: 500px; + height: 87px; + float: left; + color:#fff; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + } +header h2 { + background: transparent url(tag.gif) no-repeat top left; + width: 300px; + margin-top:-60px; + margin-left:-190px; + height: 100px; + float: right; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + } + +.summary { + width: 130px; + float: left; + padding:5px; + margin-right:15px; + background:#0099FF; + + } +.summary p { + font: bold 8pt/12pt verdana, sans-serif; + text-align:right; + color:#fff; + } + +.summary a:link { + font-weight: bold; + text-decoration: none; + color: #003; + } +.summary a:visited { + font-weight: bold; + text-decoration: none; + color: #006; + } +.summary a:hover, .summary a:active { + text-decoration: underline; + color: #FF6600; + } + +.preamble, #supporting text, .explanation, .participation, .benefits, .requirements { + padding: 0px 170px 0px 30px; +} + +footer { + text-align: center; + } +footer a:link, footer a:visited { + margin-right: 20px; + } + +.sidebar { + background: transparent url(menu.gif) top left no-repeat; + position: absolute; + top: 0px; + padding: 15px; + margin-top: 200px; + margin-left: 650px; + width: 130px; + } + +.sidebar .wrapper { + font: 10px verdana, sans-serif; + padding-top:35px; + } +.sidebar h3.select { + background: transparent url(select.gif) top left no-repeat; + width: 130px; + height: 25px; + margin-left:-8px; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + } +.sidebar h3.archives { + background: transparent url(archives.gif) top left no-repeat; + width: 130px; + height: 25px; + margin-left:-8px; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + } +.sidebar h3.resources { + background: transparent url(resources.gif) top left no-repeat; + width: 130px; + height: 25px; + margin-left:-8px; + + text-indent: 100%; + white-space: nowrap; + overflow: hidden; + } + +.sidebar ul { + margin: 0px; + padding: 0px; + } +.sidebar li { + line-height: 2.5ex; + background: transparent; + display: block; + padding-top: 5px; + margin-bottom: 5px; + list-style-type: none; + } +.sidebar li a:link { + color: #FF3300; + } +.sidebar li a:visited { + color: #FF0000; + } + +.extra1 { + background: transparent; + position: absolute; + top: 40px; + right: 0px; + width: 148px; + height: 110px; + } \ No newline at end of file diff --git a/week-7/dom-playground-master/images/archives.gif b/week-7/dom-playground-master/images/archives.gif new file mode 100644 index 0000000..f8b3abe Binary files /dev/null and b/week-7/dom-playground-master/images/archives.gif differ diff --git a/week-7/dom-playground-master/images/menu.gif b/week-7/dom-playground-master/images/menu.gif new file mode 100644 index 0000000..cfba7ef Binary files /dev/null and b/week-7/dom-playground-master/images/menu.gif differ diff --git a/week-7/dom-playground-master/images/resources.gif b/week-7/dom-playground-master/images/resources.gif new file mode 100644 index 0000000..3170140 Binary files /dev/null and b/week-7/dom-playground-master/images/resources.gif differ diff --git a/week-7/dom-playground-master/images/select.gif b/week-7/dom-playground-master/images/select.gif new file mode 100644 index 0000000..089cc9d Binary files /dev/null and b/week-7/dom-playground-master/images/select.gif differ diff --git a/week-7/dom-playground-master/images/tag.gif b/week-7/dom-playground-master/images/tag.gif new file mode 100644 index 0000000..145c9f5 Binary files /dev/null and b/week-7/dom-playground-master/images/tag.gif differ diff --git a/week-7/dom-playground-master/images/trees.jpg b/week-7/dom-playground-master/images/trees.jpg new file mode 100644 index 0000000..126ac08 Binary files /dev/null and b/week-7/dom-playground-master/images/trees.jpg differ diff --git a/week-7/dom-playground-master/index.html b/week-7/dom-playground-master/index.html new file mode 100644 index 0000000..1900ca6 --- /dev/null +++ b/week-7/dom-playground-master/index.html @@ -0,0 +1,271 @@ + + + + + + CSS Zen Garden: The Beauty of CSS Design + + + + + + + + + + + + + + + + +
+ +
+
+

CSS Zen Garden

+

The Beauty of CSS Design

+
+ +
+

A demonstration of what can be accomplished through CSS-based design. Select any style sheet from the list to + load it into this page.

+

Download the example html file and css file +

+
+ +
+

The Road to Enlightenment

+

Littering a dark and dreary road lay the past relics of browser-specific tags, incompatible DOMs, broken CSS support, and abandoned browsers.

+

We must clear the mind of the past. Web enlightenment has been achieved thanks to the tireless + efforts of folk like the W3C, WaSP, and the major browser creators.

+

The CSS Zen Garden invites you to relax and meditate on the important lessons of the masters. Begin + to see with clarity. Learn to use the time-honored techniques in new and invigorating fashion. + Become one with the web.

+
+
+ +
+
+

So What is This About?

+

There is a continuing need to show the power of CSS. The + Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing + designs in the list. Clicking on any one will load the style sheet into this very page. The HTML remains the same, the only thing that has changed + is the external CSS file. Yes, really.

+

CSS allows complete and total control over the style of a + hypertext document. The only way this can be illustrated in a way that gets people excited is by + demonstrating what it can truly be, once the reins are placed in the hands of those able to create + beauty from structure. Designers and coders alike have contributed to the beauty of the web; we can + always push it further.

+
+ +
+

Participation

+

Strong visual design has always been our focus. You are modifying this page, so strong CSS skills are necessary too, but the example files are + commented well enough that even CSS novices can use them + as starting points. Please see the CSS + Resource Guide for advanced tutorials and tips on working with CSS.

+

You may modify the style sheet in any way you wish, but not the HTML. This may seem daunting at first if you’ve + never worked this way before, but follow the listed links to learn more, and use the sample files as + a guide.

+

Download the sample HTML and CSS to + work on a copy locally. Once you have completed your masterpiece (and please, don’t submit + half-finished work) upload your CSS file to a web server + under your control. Send us a link to an archive of that + file and all associated assets, and if we choose to use it we will download it and place it on our + server.

+
+ +
+

Benefits

+

Why participate? For recognition, inspiration, and a resource we can all refer to showing people how + amazing CSS really can be. This site serves as equal + parts inspiration for those working on the web today, learning tool for those who will be tomorrow, + and gallery of future techniques we can all look forward to.

+
+ +
+

Requirements

+

Where possible, we would like to see mostly CSS + 1 & 2 usage. CSS 3 & + 4 should be limited to widely-supported elements only, or strong fallbacks should be + provided. The CSS Zen Garden is about functional, practical CSS and not the latest bleeding-edge tricks viewable by 2% + of the browsing public. The only real requirement we have is that your CSS validates.

+

Luckily, designing this way shows how well various browsers have implemented CSS by now. When sticking to the guidelines you should see + fairly consistent results across most modern browsers. Due to the sheer number of user agents on the + web these days — especially when you factor in mobile — pixel-perfect layouts may not be + possible across every platform. That’s okay, but do test in as many as you can. Your design + should work in at least IE9+ and the latest Chrome, Firefox, iOS and Android browsers (run by over + 90% of the population).

+

We ask that you submit original artwork. Please respect copyright laws. Please keep objectionable + material to a minimum, and try to incorporate unique and interesting visual themes to your work. + We’re well past the point of needing another garden-related design.

+

This is a learning exercise as well as a demonstration. You retain full copyright on your graphics + (with limited exceptions, see submission guidelines), but we + ask you release your CSS under a Creative Commons + license identical to the one on this site so that others may learn + from your work.

+

By Dave Shea. Bandwidth graciously donated + by mediatemple. Now available: Zen Garden, the book. +

+
+ + + +
+ + + + + +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/week-7/dom-playground-master/index.orig.html b/week-7/dom-playground-master/index.orig.html new file mode 100644 index 0000000..c1ab25e --- /dev/null +++ b/week-7/dom-playground-master/index.orig.html @@ -0,0 +1,293 @@ + + + + + + CSS Zen Garden: The Beauty of CSS Design + + + + + + + + + + + + + + + + + +
+ +
+
+

CSS Zen Garden

+

The Beauty of CSS Design

+
+ +
+

A demonstration of what can be accomplished through CSS-based design. Select any style sheet from the list to + load it into this page.

+

Download the example html file and css file +

+
+ +
+

The Road to Enlightenment

+

Littering a dark and dreary road lay the past relics of browser-specific tags, incompatible DOMs, broken CSS support, and abandoned browsers.

+

We must clear the mind of the past. Web enlightenment has been achieved thanks to the tireless + efforts of folk like the W3C, WaSP, and the major browser creators.

+

The CSS Zen Garden invites you to relax and meditate on the important lessons of the masters. Begin + to see with clarity. Learn to use the time-honored techniques in new and invigorating fashion. + Become one with the web.

+
+
+ +
+
+

So What is This About?

+

There is a continuing need to show the power of CSS. The + Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing + designs in the list. Clicking on any one will load the style sheet into this very page. The HTML remains the same, the only thing that has changed + is the external CSS file. Yes, really.

+

CSS allows complete and total control over the style of a + hypertext document. The only way this can be illustrated in a way that gets people excited is by + demonstrating what it can truly be, once the reins are placed in the hands of those able to create + beauty from structure. Designers and coders alike have contributed to the beauty of the web; we can + always push it further.

+
+ +
+

Participation

+

Strong visual design has always been our focus. You are modifying this page, so strong CSS skills are necessary too, but the example files are + commented well enough that even CSS novices can use them + as starting points. Please see the CSS + Resource Guide for advanced tutorials and tips on working with CSS.

+

You may modify the style sheet in any way you wish, but not the HTML. This may seem daunting at first if you’ve + never worked this way before, but follow the listed links to learn more, and use the sample files as + a guide.

+

Download the sample HTML and CSS to + work on a copy locally. Once you have completed your masterpiece (and please, don’t submit + half-finished work) upload your CSS file to a web server + under your control. Send us a link to an archive of that + file and all associated assets, and if we choose to use it we will download it and place it on our + server.

+
+ +
+

Benefits

+

Why participate? For recognition, inspiration, and a resource we can all refer to showing people how + amazing CSS really can be. This site serves as equal + parts inspiration for those working on the web today, learning tool for those who will be tomorrow, + and gallery of future techniques we can all look forward to.

+
+ +
+

Requirements

+

Where possible, we would like to see mostly CSS + 1 & 2 usage. CSS 3 & + 4 should be limited to widely-supported elements only, or strong fallbacks should be + provided. The CSS Zen Garden is about functional, practical CSS and not the latest bleeding-edge tricks viewable by 2% + of the browsing public. The only real requirement we have is that your CSS validates.

+

Luckily, designing this way shows how well various browsers have implemented CSS by now. When sticking to the guidelines you should see + fairly consistent results across most modern browsers. Due to the sheer number of user agents on the + web these days — especially when you factor in mobile — pixel-perfect layouts may not be + possible across every platform. That’s okay, but do test in as many as you can. Your design + should work in at least IE9+ and the latest Chrome, Firefox, iOS and Android browsers (run by over + 90% of the population).

+

We ask that you submit original artwork. Please respect copyright laws. Please keep objectionable + material to a minimum, and try to incorporate unique and interesting visual themes to your work. + We’re well past the point of needing another garden-related design.

+

This is a learning exercise as well as a demonstration. You retain full copyright on your graphics + (with limited exceptions, see submission guidelines), but we + ask you release your CSS under a Creative Commons + license identical to the one on this site so that others may learn + from your work.

+

By Dave Shea. Bandwidth graciously donated + by mediatemple. Now available: Zen Garden, the book. +

+
+ + + +
+ + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/week-7/dom-playground-master/js/fix-the-page.js b/week-7/dom-playground-master/js/fix-the-page.js new file mode 100644 index 0000000..15d072a --- /dev/null +++ b/week-7/dom-playground-master/js/fix-the-page.js @@ -0,0 +1,91 @@ +/** + * Use this javascript file to fix the page design and layout. + * + * Rules: + * 1) You may not modify the HTML file. + * 2) You may not modify the CSS file. + * + * You can begin by adding the classes mentioned in style.css to + * their appropriate elements in the HTML file. + */ + + + +document.body.style.backgroundColor = "#69f"; + +let div = document.querySelector('div'); +div.classList.add("page-wrapper"); + +document.getElementById("zen-summary").classList.add("summary"); + +let aside = document.querySelector('aside'); +aside.classList.add("sidebar"); + +let ul = document.getElementById("resourceList"); +let li = document.createElement("li"); + + + +resources.forEach((li) => { + +li.classList.add("view-css") +li.innerHTML = ("title"); +ul.appendChild(li); + +document.getElementById("resourceList").appendChild("li"); + +}); + //li.classList.add("view-css"); + // ul.appendChild(li); + +//li.classList.add("view-css"); + +//ul.appendChild(li); + +//foreach loop li +//append a tag to li +//append li to resource tag + + + + + + + + +/** + * Here's the bad news: The resource links are missing from our HTML file. + * The good news: They're here in our JS file as an array of objects. + * + * 1) Use this array of objects to create new tags and append them to a new
  • . + * 2) Then take your new
  • and append it to ul#resourceList + */ +let resources = [ + { + title: "View the source CSS file of the currently-viewed design.", + href: "css/style.css", + innerHTML: "View This Design’s CSS" + }, + { + title: "Links to great sites with information on using CSS.", + href: "http://www.mezzoblue.com/zengarden/resources/", + innerHTML: "CSS Resources " + }, + { + title: "A list of Frequently Asked Questions about the Zen Garden.", + href: "http://www.mezzoblue.com/zengarden/faq/", + innerHTML: "FAQ " + }, + { + title: "Send in your own CSS file.", + href: "http://www.mezzoblue.com/zengarden/submit/", + innerHTML: "Submit a Design" + }, + { + title: "View translated versions of this page.", + href: "http://www.mezzoblue.com/zengarden/translations/", + innerHTML: "Translations" + }, +]; + +