From dc63ba97101aad8dc610e2bb11b993c5c9561123 Mon Sep 17 00:00:00 2001 From: Junior Date: Fri, 18 Aug 2023 14:35:45 -0400 Subject: [PATCH] Add data attributes to the item divs to move towards a more ajaxy way of doing things --- index.php | 8 ++++---- js/comics.js | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index d45e080..592e0c8 100644 --- a/index.php +++ b/index.php @@ -142,9 +142,8 @@ $newthumbs = 0; $thumbfiles = ""; $total = count($items); for ( $i=1; $i<=$total; $i++ ) { -//for ( $i=6; $i<=6; $i++ ) { if ( $i <= count($folders) ) { - $np = urlencode($compath . "/" . $items[$i-1]); + $np = urlencode((($compath == "/") ? "" : $compath) . "/" . $items[$i-1]); $thumbfile = THUMBSDIR . $compath . "/" . $items[$i-1] . ".jpg"; } else { $np = urlencode($compath . "/" . substr($items[$i-1], 0, -4) . ".jpg"); @@ -168,8 +167,9 @@ for ( $i=1; $i<=$total; $i++ ) { $classmod = ""; if ( $i <= count($folders) ) { if ( in_array($items[$i-1], $comics) ) $classmod=" readborder"; - echo "
"; + echo "
"; $thumburl = htmlentities($thumb, ENT_QUOTES); echo "
{$comname}
\n"; } else { diff --git a/js/comics.js b/js/comics.js index 16d82e4..1c74215 100644 --- a/js/comics.js +++ b/js/comics.js @@ -1,5 +1,9 @@ // 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") + "\"
If this is the first time it may take a while to generate thumbnails."); + window.location.replace("index.php?newpath=" + $(this).data("path")); + }); }); var lightbox = null;