diff options
-rw-r--r-- | index.html | 5 | ||||
-rw-r--r-- | static/poems.js | 52 | ||||
-rw-r--r-- | static/script.js | 6 |
3 files changed, 35 insertions, 28 deletions
@@ -70,6 +70,7 @@ <div class="key" data-key="I">I</div> <div class="key" data-key="O">O</div> <div class="key" data-key="P">P</div> + <div class="key" data-key="Backspace">⇤</div> </div> <div class="kbrow"> <div class="key" data-key="A">A</div> @@ -84,13 +85,15 @@ </div> <div class="kbrow"> <div class="key" data-key="Z">Z</div> + <div class="key" data-key="Z">Z</div> <div class="key" data-key="X">X</div> <div class="key" data-key="C">C</div> <div class="key" data-key="V">V</div> <div class="key" data-key="B">B</div> <div class="key" data-key="N">N</div> <div class="key" data-key="M">M</div> - <div class="key" data-key="Backspace">⇤</div> + <div class="key" data-key="ArrowLeft">←</div> + <div class="key" data-key="ArrowRight">→</div> </div> </div> <script src="/prosodyle/static/poems.js"></script> diff --git a/static/poems.js b/static/poems.js index fd5d0bd..89e8701 100644 --- a/static/poems.js +++ b/static/poems.js @@ -1,31 +1,5 @@ var challenges = [ { - "line": [["In", "/fin", "ite"], ["/wrath"], ["and"], ["/in", "fin", "/ite"], ["des", "/pair"]], - "title": "Book IV", - "collection": "Paradise Lost", - "author": "John Milton", - "meter": "iambic pentameter", - "ctx": `Me miserable! which way shall I flie -Infinite wrauth, and infinite despaire? -Which way I flie is Hell; my self am Hell; -And in the lowest deep a lower deep -Still threatning to devour me opens wide, -To which the Hell I suffer seems a Heav'n.`, - "link": "https://milton.host.dartmouth.edu/reading_room/pl/book_4/text.shtml", - }, - { - "line": [["For"], ["the"], ["/An", "gel"], ["of"], ["/Death"], ["spread"], ["his"], ["/wings"], ["on"], ["the"], ["/blast"]], - "title": "The Destruction of Sennacherib", - "collection": "Hebrew Melodies", - "author": "Lord Byron", - "meter": "anapestic tetrameter", - "ctx": `For the Angel of Death spread his wings on the blast, -And breathed in the face of the foe as he passed; -And the eyes of the sleepers waxed deadly and chill, -And their hearts but once heaved, and for ever grew still!`, - "link": "https://www.poetryfoundation.org/poems/43827/the-destruction-of-sennacherib", - }, - { "line": [["A"], ["/pre", "sence"], ["/that"], ["dis", "/turbs"], ["me"], ["/with"], ["the"], ["/joy"]], "title": "Lines written a few miles above Tintern Abbey", "collection": "Lyrical Ballads", @@ -43,4 +17,30 @@ All thinking things, all objects of all thought, And rolls through all things.`, "link": "https://www.gutenberg.org/files/9622/9622-h/9622-h.htm#poem23", }, + { + "line": [["For"], ["the"], ["/An", "gel"], ["of"], ["/Death"], ["spread"], ["his"], ["/wings"], ["on"], ["the"], ["/blast"]], + "title": "The Destruction of Sennacherib", + "collection": "Hebrew Melodies", + "author": "Lord Byron", + "meter": "anapestic tetrameter", + "ctx": `For the Angel of Death spread his wings on the blast, +And breathed in the face of the foe as he passed; +And the eyes of the sleepers waxed deadly and chill, +And their hearts but once heaved, and for ever grew still!`, + "link": "https://www.poetryfoundation.org/poems/43827/the-destruction-of-sennacherib", + }, + { + "line": [["In", "/fin", "ite"], ["/wrath"], ["and"], ["/in", "fin", "/ite"], ["des", "/pair"]], + "title": "Book IV", + "collection": "Paradise Lost", + "author": "John Milton", + "meter": "iambic pentameter", + "ctx": `Me miserable! which way shall I flie +Infinite wrauth, and infinite despaire? +Which way I flie is Hell; my self am Hell; +And in the lowest deep a lower deep +Still threatning to devour me opens wide, +To which the Hell I suffer seems a Heav'n.`, + "link": "https://milton.host.dartmouth.edu/reading_room/pl/book_4/text.shtml", + }, ] diff --git a/static/script.js b/static/script.js index 9692f36..7585efa 100644 --- a/static/script.js +++ b/static/script.js @@ -167,6 +167,10 @@ function keyHandler(key) { if (key == 'Backspace') { el.innerText = ''; nextel = document.querySelector(`[data-offset="${offset-1}"]`); + } else if (key == 'ArrowLeft') { + nextel = document.querySelector(`[data-offset="${offset-1}"]`); + } else if (key == 'ArrowRight') { + nextel = document.querySelector(`[data-offset="${offset+1}"]`); } else { el.innerText = key.toUpperCase(); nextel = document.querySelector(`[data-offset="${offset+1}"]`); @@ -184,7 +188,7 @@ document.addEventListener('keydown', function(e) { // if (e.ctrlKey || e.altKey || (e.key.length != 1 && e.key != 'Backspace')) { // return; // } - if (e.ctrlKey || e.altKey || (!"ABCDEFGHIJKLMNOPQRSTUVWXYZ".includes(e.key.toUpperCase()) && e.key != 'Backspace' && e.key != 'Enter')) { + if (e.ctrlKey || e.altKey || (!"ABCDEFGHIJKLMNOPQRSTUVWXYZ".includes(e.key.toUpperCase()) && e.key != 'Backspace' && e.key != 'Enter' && e.key != 'ArrowLeft' && e.key != 'ArrowRight')) { return; } if (e.target.id == 'share') { |