1- const projectSection = document . getElementById ( 'project-section' ) ;
2- const projectButton = document . getElementById ( 'project-button' ) ;
3-
41const sections = [
5- { button : projectButton , section : projectSection } ,
2+ { button : document . getElementById ( 'project-button' ) , section : document . getElementById ( 'project-section' ) } ,
63 { button : document . getElementById ( 'about-button' ) , section : document . getElementById ( 'about-section' ) }
74] ;
85
6+ const projects = document . querySelector ( 'table#projects' ) ;
7+
8+ const strings = [
9+ "still celebrating Homework 25th anniversary." ,
10+ "the prime time of your life. now, live it." ,
11+ "something's in the air." ,
12+ "we are human, after all." ,
13+ "WDPK 83.7, the sound of tomorrow the music of today, brings you exclusively the essential mix." ,
14+ "if love is the answer, you're home." ,
15+ "the perfect song is framed with silence." ,
16+ "make love." ,
17+ "and we will never be alone again." ,
18+ "many rooms to explore but the doors look the same." ,
19+ "ROCK. ROBOT ROCK." ,
20+ "touch it. bring it. pay it. watch it. turn it. leave it. stop. format it." ,
21+ "around the world." ,
22+ "music sounds better with you." ,
23+ "one more time."
24+ ] ;
25+
926sections . forEach ( ( { button, section } ) => {
1027 button . addEventListener ( 'click' , ( ) => {
11- toggleSection ( section , button ) ;
28+ toggleSection ( section ) ;
1229 } ) ;
1330} ) ;
1431
@@ -18,22 +35,27 @@ document.getElementById('title').addEventListener('click', () => {
1835
1936marqueeString ( ) ;
2037
38+ // order projects by starred
39+ projects . querySelectorAll ( '.project' ) . forEach ( ( project ) => {
40+ if ( project . classList . contains ( 'star' ) ) {
41+ projects . append ( project ) ;
42+
43+ project . querySelector ( '.project-title' ) . innerHTML += ' ⭐' ;
44+ }
45+ } ) ;
46+
47+ projects . querySelectorAll ( '.project' ) . forEach ( ( project ) => {
48+ if ( ! project . classList . contains ( 'star' ) ) {
49+ projects . append ( project ) ;
50+ }
51+ } ) ;
52+
2153// --------------------------------------------- //
2254
23- function toggleSection ( section , button ) {
55+ function toggleSection ( section ) {
2456 // if section is already active, save to constant
2557 const sectionIsActive = section . classList . contains ( 'active' ) ;
2658
27- // toggle active class on button
28- button . classList . toggle ( 'active' ) ;
29-
30- // remove active class from other buttons
31- sections . forEach ( ( { button : b } ) => {
32- if ( b !== button ) {
33- b . classList . remove ( 'active' ) ;
34- }
35- } ) ;
36-
3759 // remove active class from all sections
3860 document . querySelectorAll ( '.section' ) . forEach ( ( s ) => {
3961 s . classList . remove ( 'active' ) ;
@@ -47,24 +69,6 @@ function toggleSection(section, button) {
4769
4870
4971function marqueeString ( ) {
50- let strings = [
51- "still celebrating Homework 25th anniversary." ,
52- "the prime time of your life. now, live it." ,
53- "something's in the air." ,
54- "we are human, after all." ,
55- "WDPK 83.7, the sound of tomorrow the music of today, brings you exclusively the essential mix." ,
56- "if love is the answer, you're home." ,
57- "the perfect song is framed with silence." ,
58- "make love." ,
59- "and we will never be alone again." ,
60- "many rooms to explore but the doors look the same." ,
61- "ROCK. ROBOT ROCK." ,
62- "touch it. bring it. pay it. watch it. turn it. leave it. stop. format it." ,
63- "around the world." ,
64- "music sounds better with you." ,
65- "one more time."
66- ] ;
67-
6872 let randomString = strings [ Math . floor ( Math . random ( ) * strings . length ) ] ;
6973 document . getElementById ( 'marquee' ) . innerHTML = randomString ;
7074}
0 commit comments