From 9c6b54c8413688cd8eff5cd95100615aebd24d3b Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 1 Apr 2019 18:13:36 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=E7=AC=AC1-4=E9=97=9C=20done?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 10244 bytes 01 - JavaScript Drum Kit/index-START.html | 19 +++++++ 02 - JS + CSS Clock/index-START.html | 31 ++++++++++- 03 - CSS Variables/index-START.html | 41 ++++++++++++-- 04 - Array Cardio Day 1/index-START.html | 62 +++++++++++++++++++++- 05 - Flex Panel Gallery/index-START.html | 2 +- 06 - Type Ahead/index-START.html | 1 - 7 files changed, 148 insertions(+), 8 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..44f09bee9fbaff2a82fa2f7d035bd2baf13a9044 GIT binary patch literal 10244 zcmeHMT~8cU7=8y(7ODZ;Dy8kk#Mq>XXaJ$qm?psPQm~~V9SSjO=zam4?#|%u!WI$3 zjqxuS{RPH<;*FR75aYEz&-tJ;XO}GW!Wc4>%)IZ+&ikBmp7-ONGbA{{bpG!dwa0VT3rw>vFQU+26QU+26QU?AH3}DXYk-4H} zdQBNf8Aus8Wq|d;$4NPF)aK%8bMZ{ep4p*zs&&};>UHtvwM?%m11STY3~=v$LndVk`Suac zSNr#pG^8qf(!$dm^nIyAdxU4Lm0DCP)}kV8nQp)0y!($jpov@q-t;M60PRDZS$q?q zo|T$JQj!-*6mRVHP>Sv5p6Sc)#l2d!*_xdE)9dRWc;n5%OlCMU{PytI!EV$JT7}kr zbFt9)l6Px`)^5@0>rqrY)eFUqYNfq3dOaJ3twJ@dG?a0*T)`_}ZC1l_)LxAC!*WyM z1p0?eW+*eXH9CHDG&MUn;ZNVccRb-kpP8BP=Vs@QkB2g2ccvb!Jg*;qd-UD$_dhG1 z#PhV25hJbm1K0`0y*Tf!P3gx=;F06z0&S=MD$ z9t$HPt1^q<{+;=y|2GG79GIUP%p5#_0DT=5GD0pkq3590(MAZYma3g$vX=wn4&nz` zzf2m$Wrb75U4TATWm~OanDu;?Rk4QEM?x>c<|TUK^nBn)r=1&U$F7vJV513a_SKgS zv{VKH>--wV!TMj3hSTrA9lTpWvn!=Xc%O4d0Qn8DE9h|vSMpIoI~Ck@WkWs#>QAxt z*BDUk8X!PlbkBT9dM{Gf0B8;9sDH^ms?}T^?GDiF+}3?{_!NEH#@WEB`%EuxnAKi{ zEI(9j?<8ANE53M3@1P}HTOOltC9qfn3OVMCx+4__fh(6d!h1ll^<@=S^bi@OexNkQ z1S$>g+YT0I;W*Y!VA(thR1dfk-o!{4`^4rwGmKs-p{E`3qh^sf=51iwY+67sxH1Sa zu4mwA9eSM@r)`keGTK2DB>URO${5ET0j|xcO;{BbcZ^Gwvq@`}<8kYE5rZ~+0#%b4 zYs~K+k*6{{jx-7+n;#F+55|}FW7o)4c^tQYANDpMmXtN^+lpsuom#b2#1xNBb%}I0Mg)k-3?`xD5;&@9crzu`%M$X0J=%n28D8YrwU! z&;6PnnU7xSD$4yJ@-aC=580SNxdjv(?eY3(V@%g$dX+s_wFqN&{O2Jr6R6jLYGXYM zE6zzRozc)ZljuBhaF~k;oGY>gf3fv#SnSBh@Lav48nU*=_eO(=z7@J<426SPTR88Qxxn)l>PRs}1JUgw3Fe70yLnT40VP-o}8; z(XXY?@BjI;|NpnIr!r+AW#AGr;0@%0+#&|%oiR9mYxi+J$H{~5ooJ~{a8aM*A=T%2 z-0*Y!U7UP(l9C7Xc_UA>#1kC<`JVyl{{MBqN^*B;S1srGs^aWTd+cO8XH$vKy*;ec M{l7}gbMF8D1=2Qm&j0`b literal 0 HcmV?d00001 diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index c771dea..81ffe17 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,25 @@ diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384..6fe3f79 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,12 +61,41 @@ background:black; position: absolute; top:50%; + transform-origin: 100% 50%; + transition: all 1s; } - + diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607..d31aeaa 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -9,19 +9,23 @@

Update CSS Variables with JS

- + - +
diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 4162bce..3e86b19 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,29 +33,87 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + console.table( + inventors.filter(el => { + return el.year > 1500 && el.year < 1600 + }) + ) // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + console.table( + inventors.map(el => { + return el.first + ' ' + el.last + }) + ) // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + console.table( + inventors.sort((a, b) => { + return a.year - b.year + }) + ) // Array.prototype.reduce() // 4. How many years did all the inventors live? + console.log( + inventors.reduce((acum, currentValue) => { + let num = currentValue.passed - currentValue.year + return acum += num + }, 0) + ) // 5. Sort the inventors by years lived + console.table( + inventors.sort((fst, secnd) => { + let fstYear = fst.passed - fst.year + let secndYear = secnd.passed - secnd.year + return secndYear > fstYear ? 1 : -1 + }) + ) // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris - + // 7. sort Exercise // Sort the people alphabetically by last name + console.log( + people.map(el => { return { first:el.split(' ')[0], last:el.split(' ')[1]} }) + .sort((a, b) => { + if (a.last < b.last) { + return -1; + } + if (a.last > b.last) { + return 1; + } + // names must be equal + return 0; + }) + .map(el => {return el.first + ' ' + el.last}) + ) + + // const alpha = people.sort((lastOne, nextOne) => { + // const [aFirst, aLast] = lastOne.split(', '); + // const [bFirst, bLast] = nextOne.split(', '); + // return aLast > bLast ? 1 : -1; + // }); + // console.log(alpha); + // 8. Reduce Exercise // Sum up the instances of each of these const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ]; - + console.log( + data.reduce((obj, current) => { + if(!obj[current]){ + obj[current] = 0 + } + obj[current] = obj[current] + 1 + return obj + }, {}) + ) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 04e974b..56b1482 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -107,7 +107,7 @@ diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886..68419db 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -16,7 +16,6 @@ From 31aa3e9b37d152eaacba6105cf51469da5914fe6 Mon Sep 17 00:00:00 2001 From: wen Tim Date: Fri, 2 Aug 2019 07:31:23 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=E7=AC=AC5=E9=97=9C=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05 - Flex Panel Gallery/index-FINISHED.html | 5 ++- 05 - Flex Panel Gallery/index-START.html | 49 ++++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/05 - Flex Panel Gallery/index-FINISHED.html b/05 - Flex Panel Gallery/index-FINISHED.html index 243f8a2..6d6fa70 100644 --- a/05 - Flex Panel Gallery/index-FINISHED.html +++ b/05 - Flex Panel Gallery/index-FINISHED.html @@ -126,12 +126,13 @@ const panels = document.querySelectorAll('.panel'); function toggleOpen() { - console.log('Hello'); + console.log('老媽,快打開'); this.classList.toggle('open'); } function toggleActive(e) { - console.log(e.propertyName); + console.log('媽呀!end了') + // console.log(e.propertyName); if (e.propertyName.includes('flex')) { this.classList.toggle('open-active'); } diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 56b1482..d0d56ed 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,6 +24,9 @@ .panels { min-height:100vh; overflow: hidden; + + display:flex; + justify-content: center; } .panel { @@ -41,6 +44,11 @@ font-size: 20px; background-size:cover; background-position:center; + + flex-grow: 1; + display: flex; + flex-direction: column; + justify-content: space-between; } @@ -62,12 +70,26 @@ text-shadow:0 0 4px rgba(0, 0, 0, 0.72), 0 0 14px rgba(0, 0, 0, 0.45); font-size: 2em; } + + .panel p:nth-child(1) { + transform: translateY(-100%) + } + .panel p:nth-child(2) { font-size: 4em; } + .panel p:nth-child(3) { + transform: translateY(100%) + } + + .panel.open-active p:nth-child(1), .panel.open-active p:nth-child(3){ + transform: translateY(0) + } + .panel.open { font-size:40px; + flex: 6; } .cta { @@ -107,7 +129,32 @@ From d15ddec34243d363cc5237ffba9fa7d1db08b464 Mon Sep 17 00:00:00 2001 From: wen Tim Date: Fri, 9 Aug 2019 10:20:23 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=E7=AC=AC5=E9=97=9C=E5=BE=AE=E8=AA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05 - Flex Panel Gallery/index-START.html | 30 ++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index d0d56ed..261707b 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -133,6 +133,7 @@ panels.addEventListener('click', function(e) { let isOpen let DIV + // 先判斷 isOpen 和 DIV if (e.target.nodeName === 'P') { DIV = e.target.parentNode isOpen = Array.prototype.slice.call(DIV.classList).includes('open') @@ -142,18 +143,23 @@ isOpen = Array.prototype.slice.call(e.target.classList).includes('open') } - if (!isOpen) { - DIV.classList.add('open') - setTimeout(() => { - DIV.classList.add('open-active') - }, 500) - }else { - DIV.classList.remove('open') - setTimeout(() => { - DIV.classList.remove('open-active') - }, 500) - - } + // 針對isOpen 是 true 或 false 做開/關的效果 + // if (!isOpen) { + // DIV.classList.add('open') + // setTimeout(() => { + // DIV.classList.add('open-active') + // }, 500) + // }else { + // DIV.classList.remove('open') + // setTimeout(() => { + // DIV.classList.remove('open-active') + // }, 500) + // } + + DIV.classList.toggle('open') + setTimeout(() => { + DIV.classList.toggle('open-active') + }, 500) }) From 8287b5423b4251a41fa2372ce9e9cb6acf1597fd Mon Sep 17 00:00:00 2001 From: wen Tim Date: Sun, 11 Aug 2019 20:08:44 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=E7=AC=AC=E5=85=AD=E9=97=9C?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 10244 -> 12292 bytes 06 - Type Ahead/index-START.html | 95 ++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/.DS_Store b/.DS_Store index 44f09bee9fbaff2a82fa2f7d035bd2baf13a9044..2275b43e08aaf9ea78b0125ba17ec17d8c6e0bc1 100644 GIT binary patch delta 895 zcmZn(Xh~3DU|?W$DortDV9)?EIe-{M3-ADmb_NCo?uiQOvdlmZBM=(_F_0|)6lc%{ zVn>D|hN6ju%99OLSXe;{SSH^R_n#auptiAyiG4FW2MY(IB2dUkIjOw3ASow538>~| zQbA5;afyM!bw(y;7FITP4o*%EPF~K*ABB_kLCkmoiRx-Y19Ke(BNL-q9ffL33o{)B zQzO&bT22meRYP0Pgxt!i>YCcRnUj0OKfJ||(xzOliUg;8KLk3b@;1PwyiK-6e* zmRLD0j9w$IH(5|dM+O*itUwF|8r(p_6*&=ZEPT&AnP0__kzuk8k2DJ~sc}rsP? From 6a5a9dd717fead595ede9a4699ea19d61b190bcd Mon Sep 17 00:00:00 2001 From: wen Tim Date: Sun, 15 Sep 2019 11:32:31 +0800 Subject: [PATCH 5/5] feat: finish to 8 --- 06 - Type Ahead/index-START.html | 4 +- 07 - Array Cardio Day 2/index-START.html | 22 +++- 08 - Fun with HTML5 Canvas/index-START.html | 109 +++++++++++++++++++- 3 files changed, 131 insertions(+), 4 deletions(-) diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 7f27d2c..3c44c21 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -39,8 +39,8 @@ let html = matchData.map(place => { let matchCity = place.city.match(regex) let matchState = place.state.match(regex) - let cityName = place.city.replace(regex, `${this.value ? matchCity : this.value}`) - let stateName = place.state.replace(regex, `${this.value ? matchState: this.value}`) + let cityName = this.value ? place.city.replace(regex, `${matchCity}`) : place.city + let stateName = this.value ? place.state.replace(regex, `${matchState}`) : place.state return `
  • ${cityName}, ${stateName} diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31..a2ecfe3 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -27,15 +27,35 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? // Array.prototype.every() // is everyone 19? - + let someData = people.some((currentValue, index, array) => { + return new Date().getFullYear() - currentValue.year > 19 + }) + console.log({isAdult: someData}) + let everydata = people.every((currentValue, index, array) => { + return new Date().getFullYear() - currentValue.year > 19 + }) + console.log({isAllAdult: everydata}) // 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 + let item = comments.find((el) => { + return el.id === 823423 + }) + console.log(item) // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + // comments.splice(comments.findIndex((el) => el.id === 823423), 1) + + let index = comments.findIndex(el => el.id === 823423) + const newComments = [ + ...comments.slice(0, index), + ...comments.slice(index+1) + ] + console.log(newComments) + diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148d..fa7ad56 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -5,14 +5,121 @@ HTML5 Canvas - + + + + +