Add data attributes to the item divs to move towards a more ajaxy way of doing things

This commit is contained in:
Junior 2023-08-18 14:35:45 -04:00
parent 4322ad6c50
commit dc63ba9710
2 changed files with 8 additions and 4 deletions

View File

@ -142,9 +142,8 @@ $newthumbs = 0;
$thumbfiles = ""; $thumbfiles = "";
$total = count($items); $total = count($items);
for ( $i=1; $i<=$total; $i++ ) { for ( $i=1; $i<=$total; $i++ ) {
//for ( $i=6; $i<=6; $i++ ) {
if ( $i <= count($folders) ) { if ( $i <= count($folders) ) {
$np = urlencode($compath . "/" . $items[$i-1]); $np = urlencode((($compath == "/") ? "" : $compath) . "/" . $items[$i-1]);
$thumbfile = THUMBSDIR . $compath . "/" . $items[$i-1] . ".jpg"; $thumbfile = THUMBSDIR . $compath . "/" . $items[$i-1] . ".jpg";
} else { } else {
$np = urlencode($compath . "/" . substr($items[$i-1], 0, -4) . ".jpg"); $np = urlencode($compath . "/" . substr($items[$i-1], 0, -4) . ".jpg");
@ -168,8 +167,9 @@ for ( $i=1; $i<=$total; $i++ ) {
$classmod = ""; $classmod = "";
if ( $i <= count($folders) ) { if ( $i <= count($folders) ) {
if ( in_array($items[$i-1], $comics) ) $classmod=" readborder"; if ( in_array($items[$i-1], $comics) ) $classmod=" readborder";
echo "<div class='item{$classmod}' "; echo "<div class='item folder{$classmod}' ";
echo "onClick='document.location=\"index.php?newpath=$np\";'>"; echo "data-path=\"{$np}\" ";
echo "data-name=\"{$comname}\">";
$thumburl = htmlentities($thumb, ENT_QUOTES); $thumburl = htmlentities($thumb, ENT_QUOTES);
echo "<img src='$thumburl'><br clear=all />{$comname}</div>\n"; echo "<img src='$thumburl'><br clear=all />{$comname}</div>\n";
} else { } else {

View File

@ -1,5 +1,9 @@
// This function is executed after the page load completes on the client // This function is executed after the page load completes on the client
$(document).ready(function() { $(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"));
});
}); });
var lightbox = null; var lightbox = null;