lib.itmens/catalog/templates/podcast.html
2024-02-09 03:40:19 -05:00

103 lines
3.2 KiB
HTML

{% extends "item_base.html" %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% load humanize %}
{% load admin_url %}
{% load mastodon %}
{% load oauth_token %}
{% load truncate %}
{% load strip_scheme %}
{% load thumb %}
{% block head %}
<script src="https://cdn.jsdelivr.net/npm/shikwasa@2.2.1/dist/shikwasa.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/shikwasa@2.2.1/dist/style.min.css"
rel="stylesheet"></link>
<script src="{% static 'js/podcast.js' %}"></script>
{% endblock %}
{% block details %}
<div>
{% if item.genre %}
{% trans '类型:' %}
{% for genre in item.genre %}
<span>{{ genre }}</span>
{% if not forloop.last %}/{% endif %}
{% endfor %}
{% endif %}
</div>
<div>
{% if item.official_site %}
{% trans '网站:' %}{{ item.official_site|urlizetrunc:24 }}
{% endif %}
</div>
<div>
{% if item.hosts %}
{% trans '主播:' %}
{% for host in item.hosts %}
<span {% if forloop.counter > 5 %}style="display: none;"{% endif %}>
<span class="other_title">{{ host }}</span>
{% if not forloop.last %}/{% endif %}
</span>
{% endfor %}
{% if item.hosts|length > 5 %}
<a href="javascript:void(0);" id="otherTitleMore">{% trans '更多' %}</a>
<script>
$("#otherTitleMore").on('click', function (e) {
$("span.other_title:not(:visible)").each(function (e) {
$(this).parent().removeAttr('style');
});
$(this).remove();
})
</script>
{% endif %}
{% endif %}
</div>
{% endblock %}
{% block content %}
<h5>{% trans '近期节目' %}</h5>
<div hx-get="{% url 'catalog:episode_data' item.uuid %}"
hx-trigger="load"
hx-swap="outerHTML"></div>
{% endblock %}
<!-- class specific sidebar -->
{% block left_sidebar %}
<section>
<center>
<button href="#" class="podlove-subscribe-button-primary outline">{% trans '用播客应用订阅' %}</button>
</center>
</section>
<script>
window.podcastData = {
"title": "{{ item.title | escapejs }}",
"subtitle": "",
"description": "{{ item.brief | escapejs }}",
"cover": "{{ item.cover.url | escapejs }}",
"feeds": [{"type": "audio", "format": "mp3", "url": "{{ item.feed_url | escapejs }}", "variant": "high"}]
}
$(()=>{
{% if focus_item %}
var position = 1 * "{{request.GET.position|escapejs}}";
window.current_item_uuid = "{{focus_item.uuid}}";
create_player({
title: "{{ focus_item.title | escapejs }}",
cover: "{{ focus_item.cover_url | default:item.cover.url | escapejs }}",
src: "{{ focus_item.media_url | escapejs }}",
album: "{{ item.title|escapejs }}",
artist: "{{ item.hosts|join:' / '|escapejs }}"
})
if (position) window.player._initSeek = position;
{% if request.user.is_authenticated %}
set_podcast_comment_button("{% url 'journal:comment' focus_item.uuid %}")
{% endif %}
{% endif %}
});
</script>
<script class="podlove-subscribe-button"
src="https://cdn.podlove.org/subscribe-button/javascripts/app.js"
data-json-data="podcastData"
data-buttonid="primary"
data-language="en"
data-hide="true"
data-color="#1190C0"></script>
{% endblock %}