Change comic issue (showcomic) to use the new ajaxy way, or at least prep for it

This commit is contained in:
Junior 2023-08-18 14:56:00 -04:00
parent dc63ba9710
commit 2c409a60c6
2 changed files with 9 additions and 6 deletions

View File

@ -176,8 +176,8 @@ for ( $i=1; $i<=$total; $i++ ) {
if ( in_array($items[$i-1], $issues) ) $classmod=" readborder";
$relcomic = trim(base64_encode($compath . "/" . $items[$i-1]), "=");
$thumburl = htmlentities($thumb, ENT_QUOTES);
echo "<div class='item{$classmod}' id='", $relcomic, "'><a onClick='showComic(\"", $relcomic, "\", \"", htmlspecialchars($comname, ENT_QUOTES), "\");' ";
echo "href='javascript:;'><img border=0 src='$thumburl'></a><br clear=all />";
echo "<div class='item{$classmod}' id='", $relcomic, "'>";
echo "<img class='issue' data-relcomic=\"{$relcomic}\" data-comname=\"" . htmlspecialchars($comname, ENT_QUOTES) . "\" border=0 src='$thumburl'><br clear=all />";
echo "<a href='downloadcomic.php?comic={$relcomic}'>{$comname}</a></div>\n";
}
}

View File

@ -1,9 +1,7 @@
// This function is executed after the page load completes on the client
$(document).ready(function() {
$(".folder").click(function() {
toastr.success("Opening comic \"" + $(this).data("name") + "\"<br>If this is the first time it may take a while to generate thumbnails.");
window.location.replace("index.php?newpath=" + $(this).data("path"));
});
$(".folder").click(function() { changeFolder($(this).data("name"), $(this).data("path")); });
$(".issue").click(function() { showComic($(this).data("relcomic"), $(this).data("comname")); });
});
var lightbox = null;
@ -20,6 +18,11 @@ function updateCurrentPage() {
});
}
function changeFolder(name, path) {
toastr.success("Opening comic \"" + name + "\"<br>If this is the first time it may take a while to generate thumbnails.");
window.location.replace("index.php?newpath=" + path);
}
//
// This JS function is called when a user clicks on a comic.
// "showcomic.php" is called with the comic to view as a parameter.