diff options
| -rw-r--r-- | languages/default.yml | 5 | ||||
| -rw-r--r-- | languages/zh-cn.yml | 5 | ||||
| -rw-r--r-- | layout/post.ejs | 41 | ||||
| -rw-r--r-- | scripts/feed.js | 2 | ||||
| -rw-r--r-- | scripts/meta.js | 50 | 
5 files changed, 53 insertions, 50 deletions
| diff --git a/languages/default.yml b/languages/default.yml index 73af215..e280019 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -1,7 +1,4 @@  next: Next Page  prev: Previous Page  listen: Listen Now -read: Continue Read -timeline: Timeline -authors: Authors -references: References
\ No newline at end of file +read: Continue Read
\ No newline at end of file diff --git a/languages/zh-cn.yml b/languages/zh-cn.yml index 9d618fc..c46f638 100644 --- a/languages/zh-cn.yml +++ b/languages/zh-cn.yml @@ -1,7 +1,4 @@  next: 下一页  prev: 上一页  listen: 现在收听 -read: 继续阅读 -timeline: 时间轴 -authors: 本期作者 -references: 相关资料
\ No newline at end of file +read: 继续阅读
\ No newline at end of file diff --git a/layout/post.ejs b/layout/post.ejs index ffa49e6..1e75de4 100644 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -39,48 +39,7 @@                      </script>                  <% } %>                  <section class="content is-size-6"> -                      <%- page.content %> - -                    <!-- Add podcast authors --> -                     -                    <% if (page.podcast && page.podcast.authors) { %> -                        <h3><%= __('authors') %>: </h3> -                        <ul> -                            <% (page.podcast.authors).forEach(function(author) { %> -                                <li><%= author %></li> -                            <% }); %>  -                        </ul> -                    <% } %>   -                     -                    <!-- Add podcast chapters --> -                    <% if (page.podcast && page.podcast.chapters) { %> -                        <h3><%= __('timeline') %>: </h3> -                        <ul> -                            <% (page.podcast.chapters).forEach(function(item) { %> -                                <% -                                    const title = item[0]; -                                    const timestamp = item[1]; -                                    const hour = Math.floor(timestamp / 3600); -                                    const minute = Math.floor((timestamp / 60) % 60); -                                    const second = Math.floor(timestamp % 60); -                                    const viewstr = String(hour).padStart(2, '0') + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0'); -                                %>  -                                <li class="is-family-monospace"><a href="#t=<%= viewstr %>" onclick="eval('player.seek(<%= timestamp %>)')"><%= viewstr %></a> <%= title %></li> -                            <% }); %> -                        </ul> -                    <% } %> - -                    <!-- Add podcast references --> -                    <% if (page.podcast && page.podcast.references) { %> -                        <h3><%= __('references') %>: </h3> -                        <ul> -                            <% (page.podcast.references).forEach(function(item) { %> -                                <li><a href="<%= item[1] %>" rel="noopener"><%= item[0] %></a></li> -                            <% }); %> -                        </ul> -                    <% } %> -                  </section>                  <div class="level">                      <div class="level-left"> diff --git a/scripts/feed.js b/scripts/feed.js index db38359..6ea931e 100644 --- a/scripts/feed.js +++ b/scripts/feed.js @@ -18,7 +18,7 @@ hexo.extend.generator.register("feed", (locals) => {          copyright: theme.copyright,          language: config.language.slice(0, 2),          siteUrl: config.url, -        imageUrl: theme.logo, +        imageUrl: theme.logo.lightmode,          itunesSubtitle: config.subtitle,          itunesSummary: config.description,          itunesAuthor: config.author, diff --git a/scripts/meta.js b/scripts/meta.js new file mode 100644 index 0000000..9b4a779 --- /dev/null +++ b/scripts/meta.js @@ -0,0 +1,50 @@ +const ejs = require("ejs") + +hexo.extend.tag.register('authors', function (_args) { +    let page = this; +    if (!(page.podcast && page.podcast.authors)) +        return; +    return ejs.render(` +    <ul> +        <% (page.podcast.authors).forEach(function(author) { %> +            <li><%= author %></li> +        <% }); %> +    </ul> +    `, {page: page}) +}); + +hexo.extend.tag.register('references', function (_args) { +    let page = this; +    if (!(page.podcast && page.podcast.references)) +        return; +    return ejs.render(` +    <ul> +        <% (page.podcast.references).forEach(function(item) { %> +            <li><a href="<%= item[1] %>" rel="noopener"><%= item[0] %></a></li> +        <% }); %> +    </ul> +    ` +    , {page: page}); +}); + +hexo.extend.tag.register('timeline', function (_args) { +    let page = this; +    if (!(page.podcast && page.podcast.chapters)) +        return; +    return ejs.render(` +    <ul> +        <% (page.podcast.chapters).forEach(function(item) { %> +            <% +                const title = item[0]; +                const timestamp = item[1]; +                const hour = Math.floor(timestamp / 3600); +                const minute = Math.floor((timestamp / 60) % 60); +                const second = Math.floor(timestamp % 60); +                const viewstr = String(hour).padStart(2, '0') + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0'); +            %> +            <li class="is-family-monospace"><a href="#t=<%= viewstr %>" onclick="eval('player.seek(<%= timestamp %>)')"><%= viewstr %></a> <%= title %></li> +        <% }); %> +    </ul> +    ` +    , {page: page}); +}) | 
