From 04ecc3472802ec02f943a63683d3e311bfc19613 Mon Sep 17 00:00:00 2001 From: Doge Date: Sat, 8 May 2021 01:21:15 +0800 Subject: Add podcast player support Thanks to Shikwasa :+1: --- layout/_partial/scripts.ejs | 2 +- layout/index.ejs | 13 +++++++------ layout/post.ejs | 23 ++++++++++++++++++++++- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs index 1b20314..a60011f 100644 --- a/layout/_partial/scripts.ejs +++ b/layout/_partial/scripts.ejs @@ -19,7 +19,7 @@ <% if (theme.highlight.enable === true) { %> - +
- <% if (post.podcast && theme.podcast && post.duration) { %> + <% if (post.podcast && theme.podcast) { %> <% - const hour = Math.floor(post.duration / 3600); - const minute = Math.floor((post.duration / 60) % 60); - const second = Math.floor(post.duration % 60); - const duration = hour + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0'); + const duration = post.podcast.duration; + const hour = Math.floor(duration / 3600); + const minute = Math.floor((duration / 60) % 60); + const second = Math.floor(duration % 60); + const viewstr = hour + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0'); %> -
<%- duration %>
+
<%- viewstr %>
<% } %>
<%- date(post.date, "MMM, D YYYY") %> diff --git a/layout/post.ejs b/layout/post.ejs index 0de6e5a..d83d694 100644 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -2,10 +2,31 @@
+ + <% if (page.podcast) { %> +
+ + <% } %> +

<%= page.title %>

-- cgit v1.2.3