1
0
Prechádzať zdrojové kódy

Add basic tracklist

Sunny 2 rokov pred
rodič
commit
329c260b78
4 zmenil súbory, kde vykonal 30 pridanie a 8 odobranie
  1. 6 3
      assets/style.css
  2. 20 1
      pages/album.php
  3. 2 2
      pages/artist.php
  4. 2 2
      pages/search.php

+ 6 - 3
assets/style.css

@@ -22,11 +22,13 @@ body {
   padding: 1em;
 }
 
-.wrapper > :first-child {
+.wrapper > :first-child,
+.wrapper div > :first-child {
   margin-top: 0;
 }
 
-.wrapper > :last-child {
+.wrapper > :last-child,
+.wrapper div > :last-child {
   margin-bottom: 0;
 }
 
@@ -118,7 +120,8 @@ main .wrapper .results img {
   object-fit: cover;
 }
 
-main .wrapper .sidebar a {
+main .wrapper .sidebar a,
+main .wrapper .tracks a {
   font-weight: bold;
   text-decoration: initial;
 }

+ 20 - 1
pages/album.php

@@ -27,7 +27,26 @@
 
   echo "</div>";
 
-  echo "<div>";
+  echo "<div class=\"tracks\">";
+
+  $tracks = $document->find(".track_list .track_row_view");
+
+  echo "<ol>";
+  foreach ($tracks as $track) {
+    $link = $track->find(".title a")->attr("href");
+    if (!filter_var($link, FILTER_VALIDATE_URL)) {
+      $link = "https://" . urlencode($_GET["artist"]) . ".bandcamp.com" . $link;
+    };
+    $link = convert_link($link);
+
+    echo "<li>";
+    echo "<a href=\"" . $link . "\">";
+    echo $track->find(".track-title")->text();
+    echo "</a>";
+    echo "</li>";
+  };
+  echo "</ol>";
+
   echo "</div>";
 
   include "../elements/sidebar.php";

+ 2 - 2
pages/artist.php

@@ -34,7 +34,7 @@
     echo "<a href=\"" . $link . "\">";
     echo "<div>";
     echo "<img src=\"" . $image . "\">";
-    echo "<p>";
+    echo "<span>";
     echo htmlspecialchars($title[0]);
 
     if (isset($title[1])) {
@@ -44,7 +44,7 @@
       echo "</small>";
     };
 
-    echo "</p>";
+    echo "</span>";
     echo "</div>";
     echo "</a>";
   };

+ 2 - 2
pages/search.php

@@ -29,7 +29,7 @@
     echo "<a href=\"" . $link . "\">";
     echo "<div>";
     echo "<img src=\"" . convert_link($result->img) . "\">";
-    echo "<p>";
+    echo "<span>";
     echo htmlspecialchars($result->name);
 
     unset($text);
@@ -49,7 +49,7 @@
     if (isset($text))
       echo "<br><small>" . $text . "</small>";
 
-    echo "</p>";
+    echo "</span>";
     echo "</div>";
     echo "</a>";
   };