//comic_show.js was created by geno7, with much needed assistance from Dannarchy
//this is the script that actually displays the comics, nav and comic title on the page.
//below are what's called some "function calls", each one is responsible for making an element of the page. to get something to actually show up on the page, all you'd need to do is make a div with a class that has the same name as the function call. i.e. writeNav shows comic navigation, to show it on a page youd use <div class="writeNav"></div> wherever you want it to be. You can even put multiple divs with that same class name and it'll display multiple instances of the navigation.
//a couple of the function calls have toggles too.
writeNav(true);//show navigation for comic pages. to toggle either images or text for nav, set this to true or false.
//debug
console.log(pg)
writePageTitle(".writePageTitle",true," - ");//write title of page. true/false
writePageClickable(".writePageClickable",true);//show the current page. to toggle whether pages can be clicked to move to the next one, set this to true or false.
keyNav();//enables navigation through the comic with the arrow keys and WSAD. It doesn't need a div with a class name, it automatically works. delete or comment out (add // at the beginning) here to disable.
// below this point is more under-the-hood type stuff that we only encourage messing with if you're more familiar with js,
// but it's still commented as extensively as possible anyway just in case
//SHOW COMIC PAGE, with clickable link
functionwritePageClickable(div,clickable){
if(!clickable){
document.querySelector(div).innerHTML=`<div class="comicPage">${writePage()}</div>`;//display comic page without link
}elseif(pg<maxpg){
//check whether comic is on the last page
document.querySelector(div).innerHTML=`<div class="comicPage"><a href="?pg=${pg+1}${navScrollTo}"/>${writePage()}</a></div>`;//display comic page and make it so that clicking it will lead you to the next page
}else{
document.querySelector(div).innerHTML=`<div class="comicPage">${writePage()}</div>`;//display comic page without link
//toggle whether you want to display the page number
document.querySelector(div).innerHTML=`<h1>${pgData[pg-1].pgNum+char+pgData[pg-1].title}</h1>`;//char denotes a separating character between the number and the title