srctree

Gregory Mullen parent c98341ab 838e55a4
compile time random is wrong-ish

inlinesplit
src/main.zig added: 8, removed: 11, total 0
@@ -29,13 +29,11 @@ pub fn main() !void {
std.sort.pdq([]u8, list.items, {}, cmpStr);
 
for (list.items) |str| {
try bout.print(" <li><a href=\"{s}\">{s}</a></li>\n", .{ str, str });
const video = if (std.mem.endsWith(u8, str, ".mp4")) " class=\"vid\"" else "";
try bout.print(" <li><a{s} href=\"{s}\">{s}</a></li>\n", .{ video, str, str });
}
 
try bout.writeAll(index_middle);
// TODO put random image here
try bout.print(" <div class=preview><img src=\"\"></div>\n", .{});
try bout.writeAll(index_last);
try bout.writeAll(index_tail);
}
 
fn cmpStr(_: void, lhs: []const u8, rhs: []const u8) bool {
@@ -65,13 +63,12 @@ const index =
\\
;
 
const index_middle =
const index_tail =
\\ </ul>
\\ </div>
\\
;
 
const index_last =
\\ <div class=preview>
\\ <img src="">
\\ </div>
\\ <script>
\\ document.querySelectorAll("a").forEach((link) => {
\\ link.addEventListener("mouseover", (ev) => {