hide ratings/comments/reviews in solo mode

This commit is contained in:
Your Name 2023-06-09 10:17:48 -04:00 committed by Henri Dickson
parent 2f753ca1f2
commit b47d322e5a
14 changed files with 51 additions and 21 deletions

View file

@ -3,7 +3,9 @@
{% load i18n %}
{% block brief %}
<div class="multi-fields">
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% include '_people.html' with people=item.artist role='' max=2 %}
{% include '_people.html' with people=item.genre role='流派' max=5 %}
</div>

View file

@ -44,7 +44,7 @@
{% endblock full %}
</div>
{% if show_tags %}
<div class="tag-list">
<div class="tag-list solo-hidden">
{% for tag in item.tags %}
{% if forloop.counter <= 5 %}
<span>

View file

@ -2,7 +2,9 @@
{% load humanize %}
{% load i18n %}
{% block brief %}
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% include '_people.html' with people=item.author role='作者' max=2 %}
{% include '_people.html' with people=item.translator role='译者' max=2 %}
{% include '_people.html' with people=item.director role='导演' max=2 %}

View file

@ -3,7 +3,9 @@
{% load i18n %}
{% block brief %}
<div class="multi-fields">
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% if item.other_title %}
{% include '_people.html' with people=item.other_title role='又名' max=2 %}
{% endif %}

View file

@ -3,7 +3,9 @@
{% load i18n %}
{% block brief %}
<div class="multi-fields">
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% include '_people.html' with people=item.director role='导演' max=2 %}
{% include '_people.html' with people=item.actor role='主演' max=2 %}
</div>

View file

@ -3,7 +3,9 @@
{% load i18n %}
{% block brief %}
<div class="multi-fields">
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% include '_people.html' with people=item.genre role='类型' max=2 %}
{% include '_people.html' with people=item.playwright role='编剧' max=2 %}
{% include '_people.html' with people=item.composer role='作曲' max=2 %}

View file

@ -3,7 +3,9 @@
{% load i18n %}
{% block brief %}
<div class="multi-fields">
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% include '_people.html' with people=item.genre role='类型' max=2 %}
{% include '_people.html' with people=item.language role='语言' max=5 %}
{% include '_people.html' with people=item.troupe role='剧团' max=2 %}

View file

@ -3,7 +3,9 @@
{% load i18n %}
{% block brief %}
<div class="multi-fields">
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% include '_people.html' with people=item.hosts role='主播' max=5 %}
</div>
{% endblock brief %}

View file

@ -3,7 +3,9 @@
{% load i18n %}
{% block brief %}
<div class="multi-fields">
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% include '_people.html' with people=item.director role='导演' max=2 %}
{% include '_people.html' with people=item.actor role='主演' max=2 %}
</div>

View file

@ -3,7 +3,9 @@
{% load i18n %}
{% block brief %}
<div class="multi-fields">
{% if item.rating %}<span>{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>{% endif %}
{% if item.rating %}
<span class="solo-hidden">{{ item.rating | floatformat:1 }}分({{ item.rating_count }}人)</span>
{% endif %}
{% include '_people.html' with people=item.director role='导演' max=2 %}
{% include '_people.html' with people=item.actor role='主演' max=2 %}
</div>

View file

@ -279,7 +279,7 @@
{% endif %}
</div>
{% endif %}
<div class="rating{% if not item.rating %} unavailable{% endif %}">
<div class="rating solo-hidden {% if not item.rating %}unavailable{% endif %}">
<div class="display">
<div>
<hgroup>
@ -313,7 +313,7 @@
<span>评分人数不足</span>
</div>
</div>
<div class="tag-list">
<div class="tag-list solo-hidden">
{% for tag in item.tags %}
<span>
<a href="{% url 'catalog:search' %}?tag={{ tag }}">{{ tag }}</a>
@ -364,7 +364,7 @@
{% endif %}
{% block content %}{% endblock %}
</section>
<section>
<section class="solo-hidden">
<h5>
短评
{% if request.user.is_authenticated %}
@ -386,7 +386,7 @@
<p class="empty">登录后可见</p>
{% endif %}
</section>
<section class="entity-reviews">
<section class="solo-hidden">
<h5>
{% trans '评论' %}
{% comment %}

View file

@ -1,4 +1,4 @@
&>footer {
body>footer {
text-align: center;
margin-bottom: 4px;
width: 80%;

View file

@ -43,6 +43,12 @@
style.innerHTML = s;
document.head.appendChild(style);
}
const solo = localStorage.getItem("solo_mode");
if (solo) {
const style = document.createElement("style");
style.innerHTML = ".solo-hidden {display: none;}";
document.head.appendChild(style);
}
})();
</script>
<link rel="icon" href="{% static 'img/logo-icon.png' %}">

View file

@ -124,17 +124,23 @@
<section>
<details>
<summary>{% trans '当前设备设置' %}</summary>
<h6>专注模式 (实验功能)</h6>
<p>
<input type="checkbox" id="solo_mode">
<label for="solo_mode">启用专注模式后搜索和条目页面将不再显示来自他人的评价和打分</label>
</p>
<h6>自定义样式代码 (实验功能)</h6>
<textarea id="user_style"></textarea>
<br>
<button onclick="localStorage.setItem('user_style', document.getElementById('user_style').value);location.reload();">
保存
</button>
<button onclick="save_local();">保存</button>
</details>
<script>
const s = localStorage.getItem("user_style");
if (s) {
document.getElementById("user_style").value = s;
$("#user_style").val(localStorage.getItem("user_style")||"");
$("#solo_mode").prop("checked", localStorage.getItem("solo_mode")=="1");
function save_local() {
localStorage.setItem("user_style", $("#user_style").val());
localStorage.setItem("solo_mode", $("#solo_mode").prop("checked")?"1":"0");
alert("本地设置已保存");
}
</script>
</section>