Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
41d42b4
added DOM-I
jackgipson Feb 13, 2019
813fbcc
aligned navigation bar
jackgipson Feb 13, 2019
1505c2b
added 'features' in the main-content
jackgipson Feb 13, 2019
f7370e8
started main-content
jackgipson Feb 14, 2019
65ce107
finished main-content, contact and footer
jackgipson Feb 14, 2019
cfe069a
tried changing nav bar using for loop and for each
jackgipson Feb 14, 2019
536f503
finished v1
jackgipson Feb 14, 2019
b5d486b
v2
jackgipson Feb 16, 2019
73f448f
v3 lastest version 3
jackgipson Feb 16, 2019
f8f001a
Merge pull request #697 from jackgipson/jack-gipson
shawnantonucci Mar 20, 2019
206d06e
Revert "Merge pull request #697 from jackgipson/jack-gipson"
BigKnell Apr 8, 2019
3289039
add more things to .gitignore
Ladrillo Mar 31, 2020
82de78d
clean up html, change script attr from async to defer
Ladrillo Mar 31, 2020
ec5c1f9
clean up original.html
Ladrillo Mar 31, 2020
d55cce2
fix formatting and typos
Ladrillo May 1, 2020
19a3a65
format README
Ladrillo May 26, 2020
d3728bf
readme work
Ladrillo Jun 17, 2020
08e2bf2
Added Exit Ticket and updated readme formatting
zoelud Jul 6, 2020
5837e6e
typo
zoelud Jul 6, 2020
a0d8404
clarification
Ladrillo Jul 8, 2020
82f8d98
Update README.md
zoelud Sep 26, 2020
f550550
get rid of the program manager language
Ladrillo Sep 28, 2020
2ab107b
first commit of the day
Aug 2, 2021
aef1d78
nav header complete
Aug 2, 2021
ef98e67
header and title complete
Aug 2, 2021
5ee6cbd
both images added
Aug 2, 2021
87df6b0
almost complete, layout functional
Aug 3, 2021
302a18b
almost complete
Aug 3, 2021
72f5a96
all nav items now green
Aug 3, 2021
62fbcfd
all items complete except for 2nd add to nav bar
Aug 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 116 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,116 @@
.DS_Store
.DS_Store
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.pnp.*
51 changes: 31 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
# DOM I - JavaScript Content Management System

## Project Description
You are going to be emulating a content managment system by controlling the content in the JavaScript file instead of the HTML file. This project is an excercise pointed at selecting elements and then updating them without touching the HTML file using the DOM.

You are going to be emulating a content management system by controlling the content in the JavaScript file instead of the HTML file. This project is an exercise pointed at selecting elements and then updating them without touching the HTML file using the DOM.

Compare `index.html` against `original.html` and notice how `index.html` is lacking text content and other things. The goal is to make the page look the same as `original.html` using JavaScript.

You have been provided a [JSON object](js/index.js) with all the necessary data to accomplish this task. Use dot or bracket notation to traverse the data provided.

**ONE RULE: You cannot update the HTML or CSS files directly. You must use JavaScript and the DOM only for your tasks today.**

## Set Up The Project With Git
## Instructions

### Task 1: Set Up The Project With Git

**Follow these steps to set up and work on your project:**

* [ ] Create a forked copy of this project.
* [ ] Add your project manager as collaborator on Github.
* [ ] Clone your OWN version of the repository (Not Lambda's by mistake!).
* [ ] Create a new branch: git checkout -b `<firstName-lastName>`.
* [ ] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly.
* [ ] Push commits: git push origin `<firstName-lastName>`.
* [X] Create a forked copy of this project.
* [X] Clone your OWN version of the repository (Not Lambda's by mistake!).
* [X] Create a new branch: git checkout -b `<firstName-lastName>`.
* [X] Implement the project on your newly created `<firstName-lastName>` branch, committing changes regularly.
* [X] Push commits: git push origin `<firstName-lastName>`.

**Follow these steps for completing your project.**
### Task 2a: MVP

* [ ] Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repo). **Please don't merge your own pull request**
* [ ] Add your project manager as a reviewer on the pull-request
* [ ] Your project manager will count the project as complete by merging the branch back into master.
#### Create selectors to point your data into elements

## Task 1: Create selectors to point your data into elements
* [ ] Create selectors by using any of the DOM element's methods
* [ ] Note that IDs have been used on all images. Use the IDs to update src path content
* [ ] Note that IDs have been used on all images. Use the IDs to update src path content

#### Update the HTML with the JSON data

## Task 2: Update the HTML with the JSON data
* [ ] Remember, NO direct updating of the HTML source is allowed.
* [ ] Using your selectors, update the content to match the example file.
* [ ] Remember to update the src attributes on images

## Task 3: Add new content
#### Add new content

* [ ] Change the color of the navigation text to be green.
* [ ] Utilize `.appendChild()` and `.prepend()` to add two new items to the navigation system. You can call them whatever you want.
* [ ] Check your work by looking at the [original html](original.html) in the browser

## Stretch Goals
* [ ] Update styles throughout the page as you see fit. Study what happens when you updated the DOM using style in JavaScript.
### Task 3: Stretch

* [ ] Update styles throughout the page as you see fit. Study what happens when you updated the DOM using style in JavaScript.
* [ ] Study tomorrow's lesson on events and try to integrate a button that can update content on the site with a click of a button. You could build a similar data object with new values to help you test the click event.

## Stretch Project: Digital Timer
This project is heavier on logic but employs some DOM manipulation to achieve it's goals. Go check it out here: [stretch assignment](stretch-assignment) and see how far you can get.
#### Stretch Project: Digital Timer

This project is heavier on logic but employs some DOM manipulation to achieve its goals. Go check it out here: [stretch assignment](stretch-assignment) and see how far you can get.

## Submission Format

**Follow these steps for completing your project.**

* [ ] Submit a Pull-Request to merge `<firstName-lastName>` Branch into `main` (student's Repo). **Please don't merge your own pull request**
21 changes: 9 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
<!doctype html>

<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Great Idea! DOM</title>
<title>Great Idea! DOM</title>

<link href="https://fonts.googleapis.com/css?family=Bangers|Titillium+Web" rel="stylesheet">
<link rel="stylesheet" href="css/index.css">
<link href="https://fonts.googleapis.com/css?family=Bangers|Titillium+Web" rel="stylesheet">
<link rel="stylesheet" href="css/index.css">

<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
<![endif]-->
<script src="js/index.js" async></script>
<script src="js/index.js" defer></script>
</head>

<body>

<div class="container">

<header>
<nav>
<a href="#"></a>
Expand Down Expand Up @@ -89,6 +85,7 @@ <h4></h4>
<p></p>
</footer>

</div><!-- container -->
</div><!-- container ends -->
</body>

</html>
75 changes: 75 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,78 @@ const siteContent = {
// Example: Update the img src for the logo
let logo = document.getElementById("logo-img");
logo.setAttribute('src', siteContent["nav"]["img-src"])

//Navigation Section


//Alternate Way of writing section

// const navElements = document.querySelectorAll('a')
// consple.log(navElements);

// navElements.forEach((item, idx) => item.textContent = Object.values(siteContent.nav)[idx])

const newNav = document.createElement('a');
newNav.textContent = 'Projects';
document.querySelector('nav').appendChild(newNav);

// const newNav2 = document.createElement('a');
// newNav2.textContent = 'API';
// document.querySelector('nav').prepend(newNav2);

const navItems = document.querySelectorAll('nav a');
navItems.forEach(item => item.style.color = 'green');

document.querySelector('nav a').text = 'Services';
document.querySelector('nav a:nth-of-type(2)').text = 'Product';
document.querySelector('nav a:nth-of-type(3)').text = 'Vision';
document.querySelector('nav a:nth-of-type(4)').text = 'Features';
document.querySelector('nav a:nth-of-type(5)').text = 'About';
document.querySelector('nav a:nth-of-type(6)').text = 'Contact';

document.querySelector('h1').innerHTML = 'DOM <br> is <br> Awesome!'
document.querySelector('button').innerHTML = siteContent['cta']['button'];

//Image
document.querySelector('#cta-img').src = siteContent['cta']['img-src'];

// const circleImg = document.querySelector('#cta-img');
// circleImg.src = siteContent['cta']['img-src'];


//Main Section

//Above Wide Image
document.querySelector('h4').textContent = siteContent['main-content']['features-h4'];
document.querySelector('p').textContent = siteContent['main-content']['features-content'];

document.querySelector('.top-content .text-content:nth-of-type(2) h4').textContent = siteContent['main-content']['about-h4'];
document.querySelector('.top-content .text-content:nth-of-type(2) p').textContent = siteContent['main-content']['about-content'];


//Image
document.querySelector('#middle-img').src = siteContent['main-content']['middle-img-src'];

// const wideImg = document.querySelector('#middle-img');
// wideImg.src = siteContent['main-content']['middle-img-src'];


//Below Wide Image
document.querySelector('.bottom-content h4').textContent = siteContent['main-content']['services-h4'];
document.querySelector('.bottom-content p').textContent = siteContent['main-content']['services-content'];

document.querySelector('.bottom-content .text-content:nth-of-type(2) h4').textContent = siteContent['main-content']['product-h4'];
document.querySelector('.bottom-content .text-content:nth-of-type(2) p').textContent = siteContent['main-content']['product-content'];

document.querySelector('.bottom-content .text-content:nth-of-type(3) h4').textContent = siteContent['main-content']['vision-h4'];
document.querySelector('.bottom-content .text-content:nth-of-type(3) p').textContent = siteContent['main-content']['vision-content'];

//Contact Section
document.querySelector('.contact h4').textContent = siteContent['contact']['contact-h4'];
document.querySelector('.contact p').innerHTML = '123 Way 456 Street <br> Somewhere USA';
document.querySelector('.contact p:nth-of-type(2)').textContent = siteContent['contact']['phone'];
document.querySelector('.contact p:nth-of-type(3)').textContent = siteContent['contact']['email'];


//Footer Section
document.querySelector('footer p').textContent = siteContent['footer']['copyright'];
Loading