Advertisement
metalx1000

Comic Index Page

Sep 18th, 2015
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <title>Comics - <?php echo basename(getcwd());?></title>
  5.   <meta charset="utf-8">
  6.   <meta name="viewport" content="width=device-width, initial-scale=1">
  7.   <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  8.   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  9.   <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  10.   <script>
  11.     $(document).ready(function(){
  12.       var comicLinks = [];
  13.       if(localStorage["comicLinks"]){
  14.         var storedLinks = JSON.parse(localStorage["comicLinks"]);
  15.         storedLinks.forEach(function(item){
  16.           $("a[href*='"+item+"']").css({ opacity: 0.4});
  17.           comicLinks.push(item);
  18.         });
  19.       }
  20.  
  21.       $(".comicLink").click(function(){
  22.         var link = $(this).attr("href");
  23.         comicLinks.push(link);
  24.         localStorage["comicLinks"] = JSON.stringify(comicLinks);
  25.       })
  26.     });
  27.   </script>
  28.   <style>
  29.     h1{
  30.       color:red;
  31.     }
  32.     body {
  33.       background-color: #b0c4de;
  34.     }
  35.   </style>
  36. </head>
  37. <body>
  38.  
  39. <div class="container-fluid">
  40.   <a href="../">
  41.     <h1><?php echo basename(getcwd());?></h1>
  42.   </a>
  43.   <div class="row">
  44. <?php
  45.   $directory = './';
  46.   $comics = array_diff(scandir($directory), array('..', '.'));
  47.   foreach ($comics as $comic) {
  48.     if(is_dir($comic)){
  49.       $pages = glob($comic.'/*.jpg');
  50.       $num = count($pages);
  51.       print "<a href='$comic' class='comicLink'>\n";
  52.       print "<div class='col-sm-6 col-md-2' style='height:225px'>\n";
  53.       print "<div style='background-image:url(\"$comic.jpg\"); background-size: cover; background-position: 50%; height:200px;'>\n";
  54.       print "<h1>$num</h1>\n";
  55.       print "</div>\n";
  56.       print "<div>$comic</div>\n";
  57.       print "</div></a>\n";
  58.     }
  59.   }  
  60. ?>
  61.      
  62.   </div>
  63. </div>
  64.  
  65. </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement