diff --git a/books/static/js/scrape.js b/books/static/js/scrape.js index f5174069..69e015d2 100644 --- a/books/static/js/scrape.js +++ b/books/static/js/scrape.js @@ -1,4 +1,5 @@ $(document).ready( function() { + $(".submit").click(function(e) { e.preventDefault(); $("#scrapeForm form").submit(); @@ -81,5 +82,5 @@ $(document).ready( function() { } }); }); - + }); \ No newline at end of file diff --git a/books/templates/books/detail.html b/books/templates/books/detail.html index abeb9f93..c74d8629 100644 --- a/books/templates/books/detail.html +++ b/books/templates/books/detail.html @@ -107,9 +107,15 @@
{% trans '简介' %}
- {% if book.brief %} -

{{ book.brief | linebreaksbr }}

+ + +

{{ book.brief | linebreaksbr }}

+
+ 展开全部 +
+ + {% else %}
{% trans '暂无简介' %}
{% endif %} diff --git a/common/static/css/boofilsic.css b/common/static/css/boofilsic.css index 0b75ad09..00ae8832 100644 --- a/common/static/css/boofilsic.css +++ b/common/static/css/boofilsic.css @@ -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; } diff --git a/common/static/js/create_update_review.js b/common/static/js/create_update_review.js index 715c1ed4..9dad74dc 100644 --- a/common/static/js/create_update_review.js +++ b/common/static/js/create_update_review.js @@ -1,5 +1,5 @@ $(document).ready( function() { - + $(".markdownx-preview").hide(); $(".markdownx textarea").attr("placeholder", "拖拽图片至编辑框即可插入哦~"); @@ -23,4 +23,5 @@ $(document).ready( function() { readOnly: true, }); }); + }); \ No newline at end of file diff --git a/common/static/js/detail.js b/common/static/js/detail.js index 1458e532..7a7251c3 100644 --- a/common/static/js/detail.js +++ b/common/static/js/detail.js @@ -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(); + }); }); \ No newline at end of file diff --git a/common/static/js/home.js b/common/static/js/home.js index 3b7ae39a..3f8528a3 100644 --- a/common/static/js/home.js +++ b/common/static/js/home.js @@ -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() { } ); - + }); \ No newline at end of file diff --git a/common/static/js/rating-star-readonly.js b/common/static/js/rating-star-readonly.js index da61b68d..76802ea8 100644 --- a/common/static/js/rating-star-readonly.js +++ b/common/static/js/rating-star-readonly.js @@ -1,4 +1,5 @@ $(document).ready( function() { + let ratingLabels = $(".rating-star"); $(ratingLabels).each( function(index, value) { let ratingScore = $(this).data("rating-score") / 2; diff --git a/common/static/sass/_MainSection.sass b/common/static/sass/_MainSection.sass index 66f5f0c7..7155de3a 100644 --- a/common/static/sass/_MainSection.sass +++ b/common/static/sass/_MainSection.sass @@ -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 diff --git a/users/static/js/followers_list.js b/users/static/js/followers_list.js index 7c5f31ce..ebe10888 100644 --- a/users/static/js/followers_list.js +++ b/users/static/js/followers_list.js @@ -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() { } }); - + }); diff --git a/users/static/js/following_list.js b/users/static/js/following_list.js index c27dfc3f..19363d5d 100644 --- a/users/static/js/following_list.js +++ b/users/static/js/following_list.js @@ -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() { } } }); - + });