add hide long brief feature

This commit is contained in:
doubaniux 2020-07-05 20:14:19 +08:00
parent 9c3d888aa3
commit 48484966ba
10 changed files with 73 additions and 11 deletions

View file

@ -1,4 +1,5 @@
$(document).ready( function() {
$(".submit").click(function(e) {
e.preventDefault();
$("#scrapeForm form").submit();
@ -81,5 +82,5 @@ $(document).ready( function() {
}
});
});
});

View file

@ -107,9 +107,15 @@
<div class="dividing-line"></div>
<div class="entity-desc">
<h5 class="entity-desc__title">{% trans '简介' %}</h5>
{% if book.brief %}
<p class="entity-desc__content">{{ book.brief | linebreaksbr }}</p>
<p class="entity-desc__content">{{ book.brief | linebreaksbr }}</p>
<div class="entity-desc__unfold-button entity-desc__unfold-button--hidden">
<a href="javascript:void(0);">展开全部</a>
</div>
{% else %}
<div>{% trans '暂无简介' %}</div>
{% endif %}

View file

@ -1225,6 +1225,30 @@ select::placeholder {
margin-bottom: 8px;
}
.entity-desc .entity-desc__content {
overflow: hidden;
}
.entity-desc .entity-desc__content--folded {
max-height: 200px;
}
.entity-desc .entity-desc__unfold-button {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
color: #00a1cc;
background-color: transparent;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
text-align: center;
}
.entity-desc .entity-desc__unfold-button--hidden {
display: none;
}
.entity-marks {
margin-bottom: 28px;
}

View file

@ -1,5 +1,5 @@
$(document).ready( function() {
$(".markdownx-preview").hide();
$(".markdownx textarea").attr("placeholder", "拖拽图片至编辑框即可插入哦~");
@ -23,4 +23,5 @@ $(document).ready( function() {
readOnly: true,
});
});
});

View file

@ -1,6 +1,5 @@
$(document).ready( function() {
$(".modal-close").on('click', function() {
$(this).parents(".modal").hide();
$(".bg-mask").hide();
@ -102,4 +101,24 @@ $(document).ready( function() {
$(".mark-panel form").submit();
});
// hide long text
let copy = $(".entity-desc__content").clone()
.addClass('entity-desc__content--folded')
.css("visibility", "hidden");
$(".entity-desc__content").after(copy);
if ($(".entity-desc__content").height() > copy.height()) {
$(".entity-desc__content").addClass('entity-desc__content--folded');
$(".entity-desc__unfold-button").removeClass("entity-desc__unfold-button--hidden");
console.log($(".entity-desc__content").height())
console.log(copy.height())
}
copy.remove();
// expand hidden long text
$(".entity-desc__unfold-button a").click(function() {
$(".entity-desc__content").removeClass('entity-desc__content--folded');
$(".entity-desc__unfold-button").remove();
});
});

View file

@ -1,5 +1,6 @@
$(document).ready( function() {
let token = $("#oauth2Token").text();
let mast_uri = $("#mastodonURI").text();
let id = $("#userMastodonID").text();
@ -96,5 +97,5 @@ $(document).ready( function() {
}
);
});

View file

@ -1,4 +1,5 @@
$(document).ready( function() {
let ratingLabels = $(".rating-star");
$(ratingLabels).each( function(index, value) {
let ratingScore = $(this).data("rating-score") / 2;

View file

@ -139,11 +139,18 @@ $mark-review-padding-wider: 6px 0
margin-bottom: $sub-section-title-margin
& &__content
overflow: hidden
&--folded
max-height: 200px
& &__show_all_button
& &__unfold-button
display: flex
background-color: $color-secondary
color: $color-primary
background-color: transparent
justify-content: center
text-align: center
&--hidden
display: none
& &__empty
// includes marks of an entity

View file

@ -1,5 +1,6 @@
$(document).ready( function() {
let token = $("#oauth2Token").text();
let mast_uri = $("#mastodonURI").text();
let id = $("#userMastodonID").text();
@ -188,5 +189,5 @@ $(document).ready( function() {
}
});
});

View file

@ -1,5 +1,6 @@
$(document).ready( function() {
let token = $("#oauth2Token").text();
let mast_uri = $("#mastodonURI").text();
let id = $("#userMastodonID").text();
@ -188,6 +189,6 @@ $(document).ready( function() {
}
}
});
});