Add data attributes to the item divs to move towards a more ajaxy way of doing things
This commit is contained in:
		
							parent
							
								
									4322ad6c50
								
							
						
					
					
						commit
						dc63ba9710
					
				| 
						 | 
				
			
			@ -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 "<div class='item{$classmod}' ";
 | 
			
		||||
      echo "onClick='document.location=\"index.php?newpath=$np\";'>";
 | 
			
		||||
      echo "<div class='item folder{$classmod}' ";
 | 
			
		||||
      echo "data-path=\"{$np}\" ";
 | 
			
		||||
      echo "data-name=\"{$comname}\">";
 | 
			
		||||
      $thumburl = htmlentities($thumb, ENT_QUOTES);
 | 
			
		||||
      echo "<img src='$thumburl'><br clear=all />{$comname}</div>\n";
 | 
			
		||||
   } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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") + "\"<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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user