updated books.pl to have variables for file names; changed the js variable names; updated index.html to match changes

This commit is contained in:
Jacob Haddon
2024-03-17 19:57:37 -04:00
parent ccde468e88
commit 697aff0b8d
2 changed files with 42 additions and 23 deletions

View File

@ -36,7 +36,7 @@ this file uses:
<script src="jquery-3.7.1.min.js"></script>
<script src="html2canvas.min.js"></script>
<script src="FileSaver.min.js"></script>
<script src="test5.js"></script>
<script src="book_pages.js"></script>
<script>
@ -69,11 +69,11 @@ $(document).ready(function(){
// console.log(book[todayString]);
// Make the header with the book info
$("#poem_header").html("<h2>" + book[todayString].title + "</h2>\n\n<h3>" + book[todayString].author + "</h3>\n");
$("#poem_header").html("<h2>" + book_pages[todayString].title + "</h2>\n\n<h3>" + book_pages[todayString].author + "</h3>\n");
// Add in the page, change the underscores to italics
// $("#spina").html(book.pages[14][6].replace(/(_([a-z0-9]+)_)/ig, "<i>$2</i>"));
$("#spina").html(book[todayString].page.replace(/(_([a-z0-9]+)_)/ig, "<i>$2</i>"));
$("#spina").html(book_pages[todayString].page.replace(/(_([a-z0-9]+)_)/ig, "<i>$2</i>"));
// format the text with span tags
$("#spina p").each(function( index ) {
@ -123,7 +123,7 @@ $(document).ready(function(){
todayFormatted = today.toString();
// add the byline
$("#byline").html("<p>blackout poem inspired by " + book[todayString].title + " by " + book[todayString].author + "</p><p>composed on: " + todayFormatted) + "</p>";
$("#byline").html("<p>blackout poem inspired by " + book_pages[todayString].title + " by " + book_pages[todayString].author + "</p><p>composed on: " + todayFormatted) + "</p>";
// toggle the text on the button
$(this).text(function(i, text) {
@ -158,7 +158,7 @@ $(document).ready(function(){
todayFormatted = today.toString();
// add the meta to the copyed text
var poem_meta = "#dailyBlackoutPoetryChallenge\n\n" + $("#poem_list").text() + "\n\n" + book[todayString].title + " - " + todayFormatted;
var poem_meta = "#dailyBlackoutPoetryChallenge\n\n" + $("#poem_list").text() + "\n\n" + book_pages[todayString].title + " - " + todayFormatted;
navigator.clipboard.writeText(poem_meta);
}); // copy text w/meta
@ -187,7 +187,9 @@ $(document).ready(function(){
<header>
<h1>Daily <span class="purple">Blackout</span> Poetry Challenge</h1>
<p>Your daily blackout poetry challenge! Make a poem, save the poem, share the poem!</p><p>Tag the poem: #dailyBlackoutPoetryChallenge</p>
<p>Your daily blackout poetry challenge! Make a poem, save the poem, share the poem!</p>
<p>Tag the poem: #dailyBlackoutPoetryChallenge</p>
<p>Click on a word to select it, click on it again to unselect. When youve found your poem hit Blackout! Get a screen shot and copy the words below!</p>
</header>