From 4405dfc3a0a94b00e43f737f3efe5809ba035cf7 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Wed, 28 Dec 2016 22:11:00 -0700 Subject: [PATCH 01/19] Finished --- 01 - JavaScript Drum Kit/drumKit.js | 30 +++++++++++++++++++++++ 01 - JavaScript Drum Kit/index-START.html | 7 +++--- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 01 - JavaScript Drum Kit/drumKit.js diff --git a/01 - JavaScript Drum Kit/drumKit.js b/01 - JavaScript Drum Kit/drumKit.js new file mode 100644 index 0000000000..ce7f01bd7c --- /dev/null +++ b/01 - JavaScript Drum Kit/drumKit.js @@ -0,0 +1,30 @@ +function playSound (evnt) { + + const audio = document.querySelector(`audio[data-key="${evnt.keyCode}"]`); // This selects the audio element. + + const key = document.querySelector(`.key[data-key="${evnt.keyCode}"]`);// This selects the
with the class="key". + + if (!audio) return; //this will stop the function from running if there is no audio associated with the pressed key. + + audio.currentTime = 0;// allows the audio to restart when the key is pressed multiple times. + + audio.play();// excecutes audio file. + + key.classList.add('playing');//This adds the CSS class of "playing" to the key being pressed. + + // console.log(audio); + // console.log(key); +}; + +function removeTransition(evnt) { + if (evnt.propertyName !== 'transform') return; + + this.classList.remove('playing'); +}; + +const keys = document.querySelectorAll('.key'); + +keys.forEach(key => key.addEventListener('transitionend', removeTransition)); + + +window.addEventListener('keydown', playSound);//On keydown this executes the playSound function. diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..cdf6acf4e3 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -4,6 +4,7 @@ JS Drum Kit + @@ -57,10 +58,8 @@ - - + + From c2704875ff0a8ebc3dcee778d648b5eb47264319 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Thu, 29 Dec 2016 20:47:32 -0700 Subject: [PATCH 02/19] Complete --- 02 - JS + CSS Clock/clockCtrl.js | 29 ++++++++ 02 - JS + CSS Clock/index-FINISHED.html | 98 ------------------------- 02 - JS + CSS Clock/index-START.html | 14 +++- 3 files changed, 40 insertions(+), 101 deletions(-) create mode 100644 02 - JS + CSS Clock/clockCtrl.js delete mode 100644 02 - JS + CSS Clock/index-FINISHED.html diff --git a/02 - JS + CSS Clock/clockCtrl.js b/02 - JS + CSS Clock/clockCtrl.js new file mode 100644 index 0000000000..450d30bf4c --- /dev/null +++ b/02 - JS + CSS Clock/clockCtrl.js @@ -0,0 +1,29 @@ +const secondHand = document.querySelector('.second-hand'); + +const minHand = document.querySelector('.min-hand'); + +const hourHand = document.querySelector('.hour-hand'); + +function setDate() { + const now = new Date(); + + // Seconds hand controller + const seconds = now.getSeconds(); + const secondsDegrees = ((seconds / 60) * 360) + 90; + secondHand.style.transform = `rotate(${secondsDegrees}deg)`; + // console.log(seconds); + + // minute hand controller + const minutes = now.getMinutes(); + const minDegrees = ((minutes / 60) * 360) + 90; + minHand.style.transform = `rotate(${minDegrees}deg)`; + // console.log(minutes); + + //Hour hand controller + const hour = now.getHours(); + const hourDegrees = ((hour / 24) * 360) + 90; + hourHand.style.transform = `rotate(${hourDegrees}deg)`; + // console.log(hour); +}; + +setInterval(setDate, 1000); diff --git a/02 - JS + CSS Clock/index-FINISHED.html b/02 - JS + CSS Clock/index-FINISHED.html deleted file mode 100644 index db653a5340..0000000000 --- a/02 - JS + CSS Clock/index-FINISHED.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - JS + CSS Clock - - - - -
-
-
-
-
-
-
- - - - - - - diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..93129bac1d 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,13 +61,21 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform: rotate(90deg); + /*transition: all 0.05s;*/ } - + .second-hand { + height: 4px; + } - + From e762cdd8d36ad60b81adc81a72435aff970b6f65 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Thu, 29 Dec 2016 20:49:51 -0700 Subject: [PATCH 03/19] deleted finished index file --- 01 - JavaScript Drum Kit/index-FINISHED.html | 83 -------------------- 1 file changed, 83 deletions(-) delete mode 100644 01 - JavaScript Drum Kit/index-FINISHED.html diff --git a/01 - JavaScript Drum Kit/index-FINISHED.html b/01 - JavaScript Drum Kit/index-FINISHED.html deleted file mode 100644 index 1a16d0997c..0000000000 --- a/01 - JavaScript Drum Kit/index-FINISHED.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - JS Drum Kit - - - - - -
-
- A - clap -
-
- S - hihat -
-
- D - kick -
-
- F - openhat -
-
- G - boom -
-
- H - ride -
-
- J - snare -
-
- K - tom -
-
- L - tink -
-
- - - - - - - - - - - - - - - - From 8e6ab5f37c73d3b9f27d638a78a5ea900a284390 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Fri, 30 Dec 2016 21:18:12 -0700 Subject: [PATCH 04/19] Finished --- 03 - CSS Variables/cssVariables.js | 15 +++++ 03 - CSS Variables/index-FINISHED.html | 79 -------------------------- 03 - CSS Variables/index-START.html | 20 ++++++- 3 files changed, 33 insertions(+), 81 deletions(-) create mode 100644 03 - CSS Variables/cssVariables.js delete mode 100644 03 - CSS Variables/index-FINISHED.html diff --git a/03 - CSS Variables/cssVariables.js b/03 - CSS Variables/cssVariables.js new file mode 100644 index 0000000000..feff9ca84a --- /dev/null +++ b/03 - CSS Variables/cssVariables.js @@ -0,0 +1,15 @@ + // this is selecting all the input elements and controls atributes in the HTML document +const inputs = document.querySelectorAll('.controls input'); + +function handleUpdate() { + // + const suffix = this.dataset.sizing || ''; + + document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix); + console.log(suffix); +} + +// this updates the inputs +inputs.forEach(input => input.addEventListener('change', handleUpdate)); +// this updates the inputs as the mouse moves +inputs.forEach(input => input.addEventListener('mousemove', handleUpdate)); diff --git a/03 - CSS Variables/index-FINISHED.html b/03 - CSS Variables/index-FINISHED.html deleted file mode 100644 index c3217fc003..0000000000 --- a/03 - CSS Variables/index-FINISHED.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - Scoped CSS Variables and JS - - -

Update CSS Variables with JS

- -
- - - - - - - - -
- - - - - - - - - - diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..710db9ee26 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -22,6 +22,23 @@

Update CSS Variables with JS

- + From 02dc1ce8c39f1b12d46ddf95fdd15841c1c2e4f2 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Fri, 30 Dec 2016 21:22:12 -0700 Subject: [PATCH 05/19] Updated comments --- 03 - CSS Variables/cssVariables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03 - CSS Variables/cssVariables.js b/03 - CSS Variables/cssVariables.js index feff9ca84a..b465392f2b 100644 --- a/03 - CSS Variables/cssVariables.js +++ b/03 - CSS Variables/cssVariables.js @@ -2,7 +2,7 @@ const inputs = document.querySelectorAll('.controls input'); function handleUpdate() { - // + //Used to get the suffix of the values that are being worked with. Accomplished this by adding "data-" to the input elements. const suffix = this.dataset.sizing || ''; document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix); From 3f8f8abaf1cc5b2d6b89433ecc8b62d49faaae40 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Sat, 31 Dec 2016 14:09:46 -0700 Subject: [PATCH 06/19] Complete --- 04 - Array Cardio Day 1/index-START.html | 59 --------- .../{index-FINISHED.html => index-START.js} | 124 +++++++++++------- 2 files changed, 76 insertions(+), 107 deletions(-) delete mode 100644 04 - Array Cardio Day 1/index-START.html rename 04 - Array Cardio Day 1/{index-FINISHED.html => index-START.js} (50%) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html deleted file mode 100644 index 317883a4c1..0000000000 --- a/04 - Array Cardio Day 1/index-START.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - Array Cardio 💪 - - -

Psst: have a look at the JavaScript Console 💁

- - - diff --git a/04 - Array Cardio Day 1/index-FINISHED.html b/04 - Array Cardio Day 1/index-START.js similarity index 50% rename from 04 - Array Cardio Day 1/index-FINISHED.html rename to 04 - Array Cardio Day 1/index-START.js index ede883f1f9..e02f9ddef7 100644 --- a/04 - Array Cardio Day 1/index-FINISHED.html +++ b/04 - Array Cardio Day 1/index-START.js @@ -1,12 +1,3 @@ - - - - - Array Cardio 💪 - - -

Psst: have a look at the JavaScript Console 💁

- - - From 969a8e229122a51763d5edb38467909dbda63573 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Sat, 31 Dec 2016 18:28:18 -0700 Subject: [PATCH 07/19] Complete --- 05 - Flex Panel Gallery/index-FINISHED.html | 145 -------------------- 05 - Flex Panel Gallery/index-START.html | 51 +++++++ 2 files changed, 51 insertions(+), 145 deletions(-) delete mode 100644 05 - Flex Panel Gallery/index-FINISHED.html diff --git a/05 - Flex Panel Gallery/index-FINISHED.html b/05 - Flex Panel Gallery/index-FINISHED.html deleted file mode 100644 index 243f8a221d..0000000000 --- a/05 - Flex Panel Gallery/index-FINISHED.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - Flex Panels 💪 - - - - - - -
-
-

Hey

-

Let's

-

Dance

-
-
-

Give

-

Take

-

Receive

-
-
-

Experience

-

It

-

Today

-
-
-

Give

-

All

-

You can

-
-
-

Life

-

In

-

Motion

-
-
- - - - - diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..cfff84d733 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,6 +24,8 @@ .panels { min-height:100vh; overflow: hidden; + display: flex; + flex: 1; } .panel { @@ -41,6 +43,11 @@ font-size: 20px; background-size:cover; background-position:center; + flex: 1; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; } @@ -54,6 +61,31 @@ margin:0; width: 100%; transition:transform 0.5s; + flex: 1 0 auto; + display: flex; + justify-content: center; + align-items: center; + } + + /*This moves the top words outside of the view*/ + .panel > *:first-child { + transform: translateY(-100%); + } + + /*This moves the bottom words outside of the view*/ + .panel > *:last-child { + transform: translateY(100%); + } + + /*When the element has the class of open-active it executes the code below.*/ + .panel.open-active > *:first-child { + transform: translateY(0); + } + + + /*When the element has the class of open-active it executes the code below.*/ + .panel.open-active > *:last-child { + transform: translateY(0); } .panel p { @@ -68,6 +100,7 @@ .panel.open { font-size:40px; + flex: 5; } .cta { @@ -107,6 +140,24 @@
From 80e6117842070ec010093848101a068ad1c0821b Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Sun, 1 Jan 2017 16:27:48 -0700 Subject: [PATCH 08/19] Half way through --- 06 - Type Ahead/index-START.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..3a880819d3 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,32 @@ From c4ce5fe1d72f4180b967342adaf4d311988c2188 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Sun, 1 Jan 2017 21:52:40 -0700 Subject: [PATCH 09/19] Finished --- 06 - Type Ahead/index-FINISHED.html | 61 ----------------------------- 06 - Type Ahead/index-START.html | 34 ++++++++++++---- 2 files changed, 26 insertions(+), 69 deletions(-) delete mode 100644 06 - Type Ahead/index-FINISHED.html diff --git a/06 - Type Ahead/index-FINISHED.html b/06 - Type Ahead/index-FINISHED.html deleted file mode 100644 index 5902b43936..0000000000 --- a/06 - Type Ahead/index-FINISHED.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Type Ahead 👀 - - - - -
- -
    -
  • Filter for a city
  • -
  • or a state
  • -
-
- - - diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 3a880819d3..20efc7a52b 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -21,21 +21,39 @@ //Fetch comes built into the browser. Keep in mind that Fectch itself returns a promise. fetch(endpoint) - .then(promise => promise.json()) // The promise needs to be converted to json. So access the json method that comes back with the promise and do another .then() which will return another promise. +// The promise needs to be converted to json. So access the json method that comes back with the promise and do another .then() which will return another promise. + .then(promise => promise.json()) + .then(data => cities.push(...data)); // We then push the data that comes back into the cities array. Now the data can be accessed by calling the cities variable. - .then(data => cities.push(...data)) // We then push the data that comes back into the cities array. Now the data can be accessed by calling the cities variable. + function findMatches(wordToMatch, cities) { + return cities.filter(place => { + // here we need to figure out if the city or state matches what was searched + const regex = new RegExp(wordToMatch, 'gi'); + return place.city.match(regex) || place.state.match(regex) + }); + } -function findMatch(wordsToMatch, cities) { - return cities.filter(place => { - const regex = new RegExp(wordsToMatch, 'gi'); - return place.city.match(regex) || place.state.match(regex); - }); +function numberWithCommas(x) { + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } function displayMatches() { - + const matchArray = findMatches(this.value, cities); + const html = matchArray.map(place => { + const regex = new RegExp(this.value, 'gi'); + const cityName = place.city.replace(regex, `${this.value}`); + const stateName = place.state.replace(regex, `${this.value}`); + return ` +
  • + ${cityName}, ${stateName} + ${numberWithCommas(place.population)} +
  • + `; + }).join(''); + suggestions.innerHTML = html; } + const searchInput = document.querySelector('.search'); // Selects the class="search" in HTML. const suggestions = document.querySelector('.suggestions'); // Selects the class="suggestions" in HTML. From 913ec121b884ae5f3f3b0fc2fc3b297af998e4ad Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Mon, 2 Jan 2017 16:34:34 -0700 Subject: [PATCH 10/19] Complete --- 07 - Array Cardio Day 2/index-FINISHED.html | 68 --------------------- 07 - Array Cardio Day 2/index-START.html | 37 +++++++++++ 2 files changed, 37 insertions(+), 68 deletions(-) delete mode 100644 07 - Array Cardio Day 2/index-FINISHED.html diff --git a/07 - Array Cardio Day 2/index-FINISHED.html b/07 - Array Cardio Day 2/index-FINISHED.html deleted file mode 100644 index c8e5b25d3b..0000000000 --- a/07 - Array Cardio Day 2/index-FINISHED.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Array Cardio 💪💪 - - -

    Psst: have a look at the JavaScript Console 💁

    - - - diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..4e99a49229 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,16 +26,53 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? + + // Old Way + // const isAdult = people.some(function (person) { + // const currentYear = (new Date()).getFullYear(); + // if (currentYear - person.year >= 19) { + // return true; + // } + // }); + + // ES6 Way + const isAdult = people.some(person => { + const currentYear = (new Date()).getFullYear(); + return currentYear - person.year >= 19; + }) + console.log(isAdult); + // Array.prototype.every() // is everyone 19 or older? + const isEveryoneAdult = people.every(function (person) { + const currentYear = (new Date()).getFullYear(); + if (currentYear - person.year >= 19) { + return true; + } + }); + console.log(isEveryoneAdult); + // Array.prototype.find() // Find is like filter, but instead returns just the one you are looking for // find the comment with the ID of 823423 + const findComment = comments.find(comment => comment.id === 823423); + + console.log(findComment); + // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + const findIndex = comments.findIndex(comment => comment.id === 823423); + + console.log(findIndex); + + // Deletes the comment with corresponding ID. + comments.splice(findIndex, 1); + + console.log(comments); + From 725fb019db9537ac134e0aa9331aa6d312bec62d Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Tue, 3 Jan 2017 17:13:37 -0700 Subject: [PATCH 11/19] Complete --- .../index-FINISHED.html | 73 ----------------- 08 - Fun with HTML5 Canvas/index-START.html | 78 +++++++++++++++++++ 2 files changed, 78 insertions(+), 73 deletions(-) delete mode 100644 08 - Fun with HTML5 Canvas/index-FINISHED.html diff --git a/08 - Fun with HTML5 Canvas/index-FINISHED.html b/08 - Fun with HTML5 Canvas/index-FINISHED.html deleted file mode 100644 index 0791e17d0d..0000000000 --- a/08 - Fun with HTML5 Canvas/index-FINISHED.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - HTML5 Canvas - - - - - - - - - diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..cb634efc9f 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,84 @@ - -
    -
    - -

    This is an inbox layout.

    -
    -
    - -

    Check one item

    -
    -
    - -

    Hold down your Shift key

    -
    -
    - -

    Check a lower item

    -
    -
    - -

    Everything inbetween should also be set to checked

    -
    -
    - -

    Try do it with out any libraries

    -
    -
    - -

    Just regular JavaScript

    -
    -
    - -

    Good Luck!

    -
    -
    - -

    Don't forget to tweet your result!

    -
    -
    - - - - diff --git a/10 - Hold Shift and Check Checkboxes/index-START.html b/10 - Hold Shift and Check Checkboxes/index-START.html index eb7ed310bb..5af2c0b0f1 100644 --- a/10 - Hold Shift and Check Checkboxes/index-START.html +++ b/10 - Hold Shift and Check Checkboxes/index-START.html @@ -104,6 +104,33 @@ From a7a42eac9696739da90d73d15be7f32c9cc173c2 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Mon, 30 Jan 2017 22:23:45 -0700 Subject: [PATCH 14/19] Complete --- 11 - Custom Video Player/scripts-FINISHED.js | 55 ----------------- 11 - Custom Video Player/scripts.js | 64 ++++++++++++++++++++ 2 files changed, 64 insertions(+), 55 deletions(-) delete mode 100644 11 - Custom Video Player/scripts-FINISHED.js diff --git a/11 - Custom Video Player/scripts-FINISHED.js b/11 - Custom Video Player/scripts-FINISHED.js deleted file mode 100644 index cedacf2f68..0000000000 --- a/11 - Custom Video Player/scripts-FINISHED.js +++ /dev/null @@ -1,55 +0,0 @@ -/* Get Our Elements */ -const player = document.querySelector('.player'); -const video = player.querySelector('.viewer'); -const progress = player.querySelector('.progress'); -const progressBar = player.querySelector('.progress__filled'); -const toggle = player.querySelector('.toggle'); -const skipButtons = player.querySelectorAll('[data-skip]'); -const ranges = player.querySelectorAll('.player__slider'); - -/* Build out functions */ -function togglePlay() { - const method = video.paused ? 'play' : 'pause'; - video[method](); -} - -function updateButton() { - const icon = this.paused ? '►' : '❚ ❚'; - console.log(icon); - toggle.textContent = icon; -} - -function skip() { - video.currentTime += parseFloat(this.dataset.skip); -} - -function handleRangeUpdate() { - video[this.name] = this.value; -} - -function handleProgress() { - const percent = (video.currentTime / video.duration) * 100; - progressBar.style.flexBasis = `${percent}%`; -} - -function scrub(e) { - const scrubTime = (e.offsetX / progress.offsetWidth) * video.duration; - video.currentTime = scrubTime; -} - -/* Hook up the event listners */ -video.addEventListener('click', togglePlay); -video.addEventListener('play', updateButton); -video.addEventListener('pause', updateButton); -video.addEventListener('timeupdate', handleProgress); - -toggle.addEventListener('click', togglePlay); -skipButtons.forEach(button => button.addEventListener('click', skip)); -ranges.forEach(range => range.addEventListener('change', handleRangeUpdate)); -ranges.forEach(range => range.addEventListener('mousemove', handleRangeUpdate)); - -let mousedown = false; -progress.addEventListener('click', scrub); -progress.addEventListener('mousemove', (e) => mousedown && scrub(e)); -progress.addEventListener('mousedown', () => mousedown = true); -progress.addEventListener('mouseup', () => mousedown = false); diff --git a/11 - Custom Video Player/scripts.js b/11 - Custom Video Player/scripts.js index e69de29bb2..3ab4913f4f 100644 --- a/11 - Custom Video Player/scripts.js +++ b/11 - Custom Video Player/scripts.js @@ -0,0 +1,64 @@ + +// Get Elements. +const player = document.querySelector('.player'); +const video = player.querySelector('.viewer'); +const progress = player.querySelector('.progress'); +const progressBar = player.querySelector('.progress__filled'); +const toggle = player.querySelector('.toggle'); +const skipButtons = player.querySelectorAll('[data-skip]'); +const ranges = player.querySelectorAll('.player__slider'); + + +// Functions. + +function togglePlay() { + if (video.paused) { + video.play(); + }else{ + video.pause(); + }; +}; + +function updateButton() { + const icon = this.paused ? '►' : '❚ ❚'; + toggle.textContent = icon; +}; + +function skip() { + video.currentTime += parseFloat(this.dataset.skip); +}; + +function handleRangeUpdate() { + video[this.name] = this.value; +} + +function handleProgress() { + const percent = (video.currentTime / video.duration) * 100; + progressBar.style.flexBasis = `${percent}%`; +} + +function scrub (e) { + const scrubTime = (e.offsetX / progress.offsetWidth) * video.duration; + video.currentTime = scrubTime; +} + + +// Hook up event listeners. + +video.addEventListener('click', togglePlay); +video.addEventListener('play', updateButton); +video.addEventListener('pause', updateButton); +video.addEventListener('timeupdate', handleProgress); + +toggle.addEventListener('click', togglePlay); + +skipButtons.forEach(button => button.addEventListener('click', skip)); + +ranges.forEach(range => range.addEventListener('change', handleRangeUpdate)); +ranges.forEach(range => range.addEventListener('mousemove', handleRangeUpdate)); + +let mousedown = false; +progress.addEventListener('click', scrub); +progress.addEventListener('mousemove', (e) => mousedown && scrub(e)); +progress.addEventListener('mousedown', () => mousedown = true); +progress.addEventListener('mouseup', () => mousedown = false); From 2bfeaa252ce6d6533eaa0d0fff4bf671ae5ee027 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Tue, 31 Jan 2017 21:37:36 -0700 Subject: [PATCH 15/19] Complete --- .../index-FINISHED.html | 25 ------------------- 12 - Key Sequence Detection/index-START.html | 16 ++++++++++++ 2 files changed, 16 insertions(+), 25 deletions(-) delete mode 100644 12 - Key Sequence Detection/index-FINISHED.html diff --git a/12 - Key Sequence Detection/index-FINISHED.html b/12 - Key Sequence Detection/index-FINISHED.html deleted file mode 100644 index 562127a0d2..0000000000 --- a/12 - Key Sequence Detection/index-FINISHED.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Key Detection - - - - - - diff --git a/12 - Key Sequence Detection/index-START.html b/12 - Key Sequence Detection/index-START.html index 8cab786140..80cfe25d41 100644 --- a/12 - Key Sequence Detection/index-START.html +++ b/12 - Key Sequence Detection/index-START.html @@ -7,6 +7,22 @@ From d7622c8381358112697c58f9ba50357583ca2ae7 Mon Sep 17 00:00:00 2001 From: ToasterTom Date: Wed, 1 Feb 2017 18:46:58 -0700 Subject: [PATCH 16/19] Complete --- 13 - Slide in on Scroll/index-FINISHED.html | 140 -------------------- 13 - Slide in on Scroll/index-START.html | 24 ++++ 2 files changed, 24 insertions(+), 140 deletions(-) delete mode 100644 13 - Slide in on Scroll/index-FINISHED.html diff --git a/13 - Slide in on Scroll/index-FINISHED.html b/13 - Slide in on Scroll/index-FINISHED.html deleted file mode 100644 index bbaf0b6f22..0000000000 --- a/13 - Slide in on Scroll/index-FINISHED.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Document - - - -
    - -

    Slide in on Scroll

    - -

    Consectetur adipisicing elit. Tempore tempora rerum, est autem cupiditate, corporis a qui libero ipsum delectus quidem dolor at nulla, adipisci veniam in reiciendis aut asperiores omnis blanditiis quod quas laborum nam! Fuga ad tempora in aspernatur pariaturlores sunt esse magni, ut, dignissimos.

    -

    Lorem ipsum cupiditate, corporis a qui libero ipsum delectus quidem dolor at nulla, adipisci veniam in reiciendis aut asperiores omnis blanditiis quod quas laborum nam! Fuga ad tempora in aspernatur pariatur fugit quibusdam dolores sunt esse magni, ut, dignissimos.

    -

    Adipisicing elit. Tempore tempora rerum..

    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempore tempora rerum, est autem cupiditate, corporis a qui libero ipsum delectus quidem dolor at nulla, adipisci veniam in reiciendis aut asperiores omnis blanditiis quod quas laborum nam! Fuga ad tempora in aspernatur pariatur fugit quibusdam dolores sunt esse magni, ut, dignissimos.

    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempore tempora rerum, est autem cupiditate, corporis a qui libero ipsum delectus quidem dolor at nulla, adipisci veniam in reiciendis aut asperiores omnis blanditiis quod quas laborum nam! Fuga ad tempora in aspernatur pariatur fugit quibusdam dolores sunt esse magni, ut, dignissimos.

    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempore tempora rerum, est autem cupiditate, corporis a qui libero ipsum delectus quidem dolor at nulla, adipisci veniam in reiciendis aut asperiores omnis blanditiis quod quas laborum nam! Fuga ad tempora in aspernatur pariatur fugit quibusdam dolores sunt esse magni, ut, dignissimos.

    - - - -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates, deserunt facilis et iste corrupti omnis tenetur est. Iste ut est dicta dolor itaque adipisci, dolorum minima, veritatis earum provident error molestias. Ratione magni illo sint vel velit ut excepturi consectetur suscipit, earum modi accusamus voluptatem nostrum, praesentium numquam, reiciendis voluptas sit id quisquam. Consequatur in quis reprehenderit modi perspiciatis necessitatibus saepe, quidem, suscipit iure natus dignissimos ipsam, eligendi deleniti accusantium, rerum quibusdam fugit perferendis et optio recusandae sed ratione. Culpa, dolorum reprehenderit harum ab voluptas fuga, nisi eligendi natus maiores illum quas quos et aperiam aut doloremque optio maxime fugiat doloribus. Eum dolorum expedita quam, nesciunt

    - - - -

    at provident praesentium atque quas rerum optio dignissimos repudiandae ullam illum quibusdam. Vel ad error quibusdam, illo ex totam placeat. Quos excepturi fuga, molestiae ea quisquam minus, ratione dicta consectetur officia omnis, doloribus voluptatibus? Veniam ipsum veritatis architecto, provident quas consequatur doloremque quam quidem earum expedita, ad delectus voluptatum, omnis praesentium nostrum qui aspernatur ea eaque adipisci et cumque ab? Ea voluptatum dolore itaque odio. Eius minima distinctio harum, officia ab nihil exercitationem. Tempora rem nemo nam temporibus molestias facilis minus ipsam quam doloribus consequatur debitis nesciunt tempore officiis aperiam quisquam, molestiae voluptates cum, fuga culpa. Distinctio accusamus quibusdam, tempore perspiciatis dolorum optio facere consequatur quidem ullam beatae architecto, ipsam sequi officiis dignissimos amet impedit natus necessitatibus tenetur repellendus dolor rem! Dicta dolorem, iure, facilis illo ex nihil ipsa amet officia, optio temporibus eum autem odit repellendus nisi. Possimus modi, corrupti error debitis doloribus dicta libero earum, sequi porro ut excepturi nostrum ea voluptatem nihil culpa? Ullam expedita eligendi obcaecati reiciendis velit provident omnis quas qui in corrupti est dolore facere ad hic, animi soluta assumenda consequuntur reprehenderit! Voluptate dolor nihil veniam laborum voluptas nisi pariatur sed optio accusantium quam consectetur, corrupti, sequi et consequuntur, excepturi doloremque. Tempore quis velit corporis neque fugit non sequi eaque rem hic. Facere, inventore, aspernatur. Accusantium modi atque, asperiores qui nobis soluta cumque suscipit excepturi possimus doloremque odit saepe perferendis temporibus molestiae nostrum voluptatum quis id sint quidem nesciunt culpa. Rerum labore dolor beatae blanditiis praesentium explicabo velit optio esse aperiam similique, voluptatem cum, maiores ipsa tempore. Reiciendis sed culpa atque inventore, nam ullam enim expedita consectetur id velit iusto alias vitae explicabo nemo neque odio reprehenderit soluta sint eaque. Aperiam, qui ut tenetur, voluptate doloremque officiis dicta quaerat voluptatem rerum natus magni. Eum amet autem dolor ullam.

    - - - -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio maiores adipisci quibusdam repudiandae dolor vero placeat esse sit! Quibusdam saepe aperiam explicabo placeat optio, consequuntur nihil voluptatibus expedita quia vero perferendis, deserunt et incidunt eveniet temporibus doloremque possimus facilis. Possimus labore, officia dolore! Eaque ratione saepe, alias harum laboriosam deserunt laudantium blanditiis eum explicabo placeat reiciendis labore iste sint. Consectetur expedita dignissimos, non quos distinctio, eos rerum facilis eligendi. Asperiores laudantium, rerum ratione consequatur, culpa consectetur possimus atque ab tempore illum non dolor nesciunt. Neque, rerum. A vel non incidunt, quod doloremque dignissimos necessitatibus aliquid laboriosam architecto at cupiditate commodi expedita in, quae blanditiis. Deserunt labore sequi, repellat laboriosam est, doloremque culpa reiciendis tempore excepturi. Enim nostrum fugit itaque vel corporis ullam sed tenetur ipsa qui rem quam error sint, libero. Laboriosam rem, ratione. Autem blanditiis

    - - -

    laborum neque repudiandae quam, cumque, voluptate veritatis itaque, placeat veniam ad nisi. Expedita, laborum reprehenderit ratione soluta velit natus, odit mollitia. Corporis rerum minima fugiat in nostrum. Assumenda natus cupiditate hic quidem ex, quas, amet ipsum esse dolore facilis beatae maxime qui inventore, iste? Maiores dignissimos dolore culpa debitis voluptatem harum, excepturi enim reiciendis, tempora ab ipsam illum aspernatur quasi qui porro saepe iure sunt eligendi tenetur quaerat ducimus quas sequi omnis aperiam suscipit! Molestiae obcaecati officiis quo, ratione eveniet, provident pariatur. Veniam quasi expedita distinctio, itaque molestiae sequi, dolorum nisi repellendus quia facilis iusto dignissimos nam? Tenetur fugit quos autem nihil, perspiciatis expedita enim tempore, alias ab maiores quis necessitatibus distinctio molestias eum, quidem. Delectus impedit quidem laborum, fugit vel neque quo, ipsam, quasi aspernatur quas odio nihil? Veniam amet reiciendis blanditiis quis reprehenderit repudiandae neque, ab ducimus, odit excepturi voluptate saepe ipsam. Voluptatem eum error voluptas porro officiis, amet! Molestias, fugit, ut! Tempore non magnam, amet, facere ducimus accusantium eos veritatis neque.

    - - - -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio maiores adipisci quibusdam repudiandae dolor vero placeat esse sit! Quibusdam saepe aperiam explicabo placeat optio, consequuntur nihil voluptatibus expedita quia vero perferendis, deserunt et incidunt eveniet temporibus doloremque possimus facilis. Possimus labore, officia dolore! Eaque ratione saepe, alias harum laboriosam deserunt laudantium blanditiis eum explicabo placeat reiciendis labore iste sint. Consectetur expedita dignissimos, non quos distinctio, eos rerum facilis eligendi. Asperiores laudantium, rerum ratione consequatur, culpa consectetur possimus atque ab tempore illum non dolor nesciunt. Neque, rerum. A vel non incidunt, quod doloremque dignissimos necessitatibus aliquid laboriosam architecto at cupiditate commodi expedita in, quae blanditiis. Deserunt labore sequi, repellat laboriosam est, doloremque culpa reiciendis tempore excepturi. Enim nostrum fugit itaque vel corporis ullam sed tenetur ipsa qui rem quam error sint, libero. Laboriosam rem, ratione. Autem blanditiis laborum neque repudiandae quam, cumque, voluptate veritatis itaque, placeat veniam ad nisi. Expedita, laborum reprehenderit ratione soluta velit natus, odit mollitia. Corporis rerum minima fugiat in nostrum. Assumenda natus cupiditate hic quidem ex, quas, amet ipsum esse dolore facilis beatae maxime qui inventore, iste? Maiores dignissimos dolore culpa debitis voluptatem harum, excepturi enim reiciendis, tempora ab ipsam illum aspernatur quasi qui porro saepe iure sunt eligendi tenetur quaerat ducimus quas sequi omnis aperiam suscipit! Molestiae obcaecati officiis quo, ratione eveniet, provident pariatur. Veniam quasi expedita distinctio, itaque molestiae sequi, dolorum nisi repellendus quia facilis iusto dignissimos nam? Tenetur fugit quos autem nihil, perspiciatis expedita enim tempore, alias ab maiores quis necessitatibus distinctio molestias eum, quidem. Delectus impedit quidem laborum, fugit vel neque quo, ipsam, quasi aspernatur quas odio nihil? Veniam amet reiciendis blanditiis quis reprehenderit repudiandae neque, ab ducimus, odit excepturi voluptate saepe ipsam. Voluptatem eum error voluptas porro officiis, amet! Molestias, fugit, ut! Tempore non magnam, amet, facere ducimus accusantium eos veritatis neque.

    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio maiores adipisci quibusdam repudiandae dolor vero placeat esse sit! Quibusdam saepe aperiam explicabo placeat optio, consequuntur nihil voluptatibus expedita quia vero perferendis, deserunt et incidunt eveniet temporibus doloremque possimus facilis. Possimus labore, officia dolore! Eaque ratione saepe, alias harum laboriosam deserunt laudantium blanditiis eum explicabo placeat reiciendis labore iste sint. Consectetur expedita dignissimos, non quos distinctio, eos rerum facilis eligendi. Asperiores laudantium, rerum ratione consequatur, culpa consectetur possimus atque ab tempore illum non dolor nesciunt. Neque, rerum. A vel non incidunt, quod doloremque dignissimos necessitatibus aliquid laboriosam architecto at cupiditate commodi expedita in, quae blanditiis. Deserunt labore sequi, repellat laboriosam est, doloremque culpa reiciendis tempore excepturi. Enim nostrum fugit itaque vel corporis ullam sed tenetur ipsa qui rem quam error sint, libero. Laboriosam rem, ratione. Autem blanditiis laborum neque repudiandae quam, cumque, voluptate veritatis itaque, placeat veniam ad nisi. Expedita, laborum reprehenderit ratione soluta velit natus, odit mollitia. Corporis rerum minima fugiat in nostrum. Assumenda natus cupiditate hic quidem ex, quas, amet ipsum esse dolore facilis beatae maxime qui inventore, iste? Maiores dignissimos dolore culpa debitis voluptatem harum, excepturi enim reiciendis, tempora ab ipsam illum aspernatur quasi qui porro saepe iure sunt eligendi tenetur quaerat ducimus quas sequi omnis aperiam suscipit! Molestiae obcaecati officiis quo, ratione eveniet, provident pariatur. Veniam quasi expedita distinctio, itaque molestiae sequi, dolorum nisi repellendus quia facilis iusto dignissimos nam? Tenetur fugit quos autem nihil, perspiciatis expedita enim tempore, alias ab maiores quis necessitatibus distinctio molestias eum, quidem. Delectus impedit quidem laborum, fugit vel neque quo, ipsam, quasi aspernatur quas odio nihil? Veniam amet reiciendis blanditiis quis reprehenderit repudiandae neque, ab ducimus, odit excepturi voluptate saepe ipsam. Voluptatem eum error voluptas porro officiis, amet! Molestias, fugit, ut! Tempore non magnam, amet, facere ducimus accusantium eos veritatis neque.

    - - - - -
    - - - - - - - diff --git a/13 - Slide in on Scroll/index-START.html b/13 - Slide in on Scroll/index-START.html index 0b9fb8fccb..c4d371b3be 100644 --- a/13 - Slide in on Scroll/index-START.html +++ b/13 - Slide in on Scroll/index-START.html @@ -43,6 +43,7 @@

    Slide in on Scroll