Fix Chapter UI

This commit is contained in:
Mike Nolan 2023-09-03 14:14:37 -05:00
parent 3f753541a3
commit 242d91c39d
1 changed files with 33 additions and 2 deletions

View File

@ -126,6 +126,7 @@
</div>*/
var card = document.createElement('div');
card.id = `verse-${i}`;
card.classList.add('card');
var card_content = document.createElement('div');
card_content.classList.add('card-content');
@ -138,10 +139,40 @@
card_content.appendChild(title);
card_content.appendChild(subtitle);
card.appendChild(card_content);
/*
<footer class="card-footer">
<p class="card-footer-item">
<span>
View on <a href="https://twitter.com/codinghorror/status/506010907021828096">Twitter</a>
</span>
</p>
*/
var card_footer = document.createElement('footer');
card_footer.classList.add('card-footer');
var card_footer_item = document.createElement('p');
card_footer_item.classList.add('card-footer-item');
var card_footer_link = document.createElement('a');
card_footer_link.innerText= "Copy Link";
card_footer_link.classList.add('button');
card_footer_link.classList.add('is-primary');
card_footer_link.classList.add('is_light');
//card_footer_link.href = `./chapter?bible=${encodeURIComponent(bible)}&book=${encodeURIComponent(book)}&chapter=${chapter}#verse-${i}`;
const myUrl = new URL(window.location.href);
myUrl.hash = `#verse-${i}`;
card_footer_link.href = myUrl.toString();
card_footer_link.click = (e)=>{
e.preventDefault();
navigator.clipboard.writeText(myUrl.toString());
};
card_footer_item.appendChild(card_footer_link);
card_footer.appendChild(card_footer_item);
card.appendChild(card_footer);
verses.appendChild(card);
if(card.id === window.location.hash.replace("#",""))
{
card.scrollIntoView();
}
}
init();