From bf1b71847ff68d86d204c9e330807f514418031c Mon Sep 17 00:00:00 2001 From: Andrew DeFaria Date: Sun, 26 Nov 2017 07:05:07 -0800 Subject: [PATCH] Rearranged sets --- Andrew/Set 1.lst | 19 +++++----- Andrew/Set 2.lst | 19 +++++----- Andrew/Set 3.lst | 21 +++++------ Andrew/Set 4.lst | 30 +++++++++++----- web/songbook.js | 94 +++++++++++++++++++++++++++++++++++------------- 5 files changed, 124 insertions(+), 59 deletions(-) diff --git a/Andrew/Set 1.lst b/Andrew/Set 1.lst index ba50294..d4ac776 100644 --- a/Andrew/Set 1.lst +++ b/Andrew/Set 1.lst @@ -1,11 +1,14 @@ Set 1 -Ventura Highway - America -Sister Golden Hair - America -Under the Boardwalk - The Drifters I Can See Clearly Now - Johnny Nash -Black Water - Doobie Brothers -Blackbird - Beatles -Nowhere Man - Beatles +I've Just Seen a Face - Beatles +From the Beginning - Emerson, Lake and Palmer +Landslide - Fleetwood Mac +Badge - Cream +Best of My Love - Eagles +Do It Again - Steely Dan +Drugstore Novels - Cast of Shadows +Harvest Moon - Neil Young +Doctor My Eyes - Jackson Browne Behind Blue Eyes - The Who -Can't Find My Way Home - Blind Faith -From the Beginning - Emerson, Lake and Palmer \ No newline at end of file +Knocking on Heaven's Door - Bob Dylan +One After 909 - Beatles diff --git a/Andrew/Set 2.lst b/Andrew/Set 2.lst index 1d335f2..f3ab802 100644 --- a/Andrew/Set 2.lst +++ b/Andrew/Set 2.lst @@ -1,11 +1,14 @@ Set 2 -Do It Again - Steely Dan -Doctor My Eyes - Jackson Browne -Take It Easy - Eagles Peaceful, Easy Feeling - Eagles -Drugstore Novels - Cast of Shadows -Your Momma Don't Dance - Loggins and Messina +Seven Bridges Road - Eagles +Take It Easy - Eagles +Sister Golden Hair - America +Little Wing - Jimi Hendrix Lay Down Sally - Eric Clapton -Feeling Alright -Harvest Moon - Neil Young -The Letter - Joe Cocker \ No newline at end of file +Can't Find My Way Home - Blind Faith +Pink Houses - John Cougar +Nowhere Man - Beatles +Ventura Highway - America +New Kid in Town - Eagles +Run to You - Bryan Adams +Your Momma Don't Dance - Loggins and Messina diff --git a/Andrew/Set 3.lst b/Andrew/Set 3.lst index 6561e7d..9a0347a 100644 --- a/Andrew/Set 3.lst +++ b/Andrew/Set 3.lst @@ -1,11 +1,12 @@ Set 3 -Tears in Heaven - Eric Clapton -Dust in the Wind - Kansas -Desperado - Eagles -Best of My Love - Eagles -Sweet Caroline - Neil Dimaond -All My Loving - Beatles -Here Comes the Sun - Beatles -Southern Cross -Suite Judy Blue Eyes - Crosby, Stills and Nash -Whiter Shade of Pale - Moody Blues \ No newline at end of file +Under the Boardwalk - The Drifters +Reeling in the Years - Steely Dan +Black Water - Doobie Brothers +If I Ever Lose My Faith In You - Sting +Sultans of Swing - Dire Straights +Feeling Alright - Joe Cocker +Refugee - Tom Petty +Soul Man - Blues Brothers +Don't Let Me Down - Beatles +The Letter - Joe Cocker +Wild Nights - Van Morrison diff --git a/Andrew/Set 4.lst b/Andrew/Set 4.lst index 646b3d6..3b77884 100644 --- a/Andrew/Set 4.lst +++ b/Andrew/Set 4.lst @@ -1,10 +1,22 @@ Set 4 -Sultans of Swing - Dire Straights -Soul Man - Blues Brothers -Reelin' in the Years - Steely Dan -I've Just Seen a Face - Beatles -If I Ever Lose My Faith In You - Sting -Run To You - Bryan Adams -Refuge - Tom Petty -Don't Let Me Down - Beatles -Crossroads - Eric Clapton \ No newline at end of file +Lucky Man - Emerson, Lake and Palmer +Dust in the Wind - Kansas +Your Move - Yes +Southern Cross - Crosby, Stills & Nash +Tears in Heaven - Eric Clapton +Blackbird - Beatles +Something - Beatles +Desperado - Eagles +Crossroads - Cream +Here Comes the Sun - Beatles +I'm Your Captain - Grand Funk Railroad +Midnight Rider - Allman Brothers +Let It Be - Beatles +Listen to the Music - Doobie Brothers +Lyin Eyes - Eagles +In My Life - Beatles +Tequila Sunrise - Eagles +Four & Twenty - Stephen Stills +A Day in a Life - Beatles +Cocaine - Eric Clapton +Turn the Page - Bob Seager diff --git a/web/songbook.js b/web/songbook.js index 036a4a2..5d0ec0f 100644 --- a/web/songbook.js +++ b/web/songbook.js @@ -1,28 +1,40 @@ // Javascript functions for controlling audio -starttime = 0; -endtime = 0; -song = null; -interval = null; +var starttime = 0; +var endtime = 0; +var ascrollpoint = 0; +var bscrollpoint = 0; -// Keycodes -spacebar = 32; -leftarrow = 37; -rightarrow = 39; -seta = 65; -setb = 66; -cleara = 67; -return2start = 82; +var song, interval, scroll, body; -howmanysecs = 10; +// Keycodes +const spacebar = 32; +const leftarrow = 37; +const rightarrow = 39; +const seta = 65; +const setb = 66; +const cleara = 67; +const return2start = 82; + +const howmanysecs = 10; +const scrollby = 1; +const oneSec = 1000; +const scrollTime = 400; function loop() { // If endtime is not set then we can't loop if (endtime == 0) return; // if we're past the endtime then it's time to start back at the A marker - if (song.currentTime > endtime) song.currentTime = starttime; + if (song.currentTime > endtime) { + song.currentTime = starttime; + if (ascrollpoint != 0) window.scrollTo(0, ascrollpoint); + } // if } // loop +function scrollLyrics(x, y) { + window.scrollBy(0, scrollby); +} // scrollLyrics + window.onload = function() { song = document.getElementById('song'); @@ -32,7 +44,8 @@ window.onload = function() { if (!song.paused) { // Set up loop - interval = setInterval(loop, 1000); + interval = setInterval(loop, oneSec); + scroll = setInterval(scrollLyrics, scrollTime); } // if body.onkeydown = @@ -47,38 +60,54 @@ window.onload = function() { if (playing) { // Stop loop - clearInterval(interval) + clearInterval(interval); + clearInterval(scroll); + song.pause(); playing = false; } else { + if (ascrollpoint != 0) { + window.scrollTo(0, ascrollpoint); + } else { + window.scrollTo(0, 0); + } // if + if (starttime != 0) { - song.currentTime = starttime + song.currentTime = starttime; } // if // Set up loop - interval = setInterval(loop, 1000); + interval = setInterval(loop, oneSec); + scroll = setInterval(scrollLyrics, scrollTime); + + if (ascrollpoint != 0) window.scrollTo(0, ascrollpoint); song.play(); + playing = true; } // if e.preventDefault(); + return; } else if (ev.keyCode == return2start) { - if (starttime != null) { + if (starttime != 0) { song.currentTime = starttime; } else { song.currentTime = 0; + body.scrollTo(0,0); } // if return; } else if (ev.keyCode == leftarrow) { song.currentTime -= howmanysecs; - song.play() + body.scrollBy(0, 50); + song.play(); return; } else if (ev.keyCode == rightarrow) { song.currentTime += howmanysecs; + bosy.scrollBy(0, -50); song.play(); return; @@ -89,17 +118,34 @@ window.onload = function() { starttime = song.currentTime; // Translate seconds to timecode - document.getElementById('a').innerHTML = Math.floor(starttime / 60) + ':' + Math.floor(starttime % 60); + secs = Math.floor(starttime % 60); + if (secs < 10) secs = '0' + secs; + + document.getElementById('a').innerHTML = + Math.floor(starttime / 60) + ':' + secs; + + ascrollpoint = window.pageYOffset; return; } else if (ev.keyCode == setb) { if (song.currentTime > starttime) { endtime = song.currentTime; - document.getElementById('b').innerHTML = Math.floor(endtime / 60) + ':' + Math.floor(endtime % 60); + song.currentTime = starttime; + + // Translate seconds to timecode + secs = Math.floor(endtime % 60); + if (secs < 10) secs = '0' + secs; + + document.getElementById('b').innerHTML = + Math.floor(endtime / 60) + ':' + secs; + + bscrollpoint = window.pageYOffset; } // if } else if (ev.keyCode == cleara) { - starttime = 0; - endtime = song.duration; + starttime = 0; + endtime = song.duration; + ascrollpoint = 0; + bscrollpoint = 0; document.getElementById('a').innerHTML = 'not set'; document.getElementById('b').innerHTML = 'not set'; -- 2.17.1