fix actionbar pre-expand-blog

This commit is contained in:
zhaospei 2023-02-04 20:14:50 +07:00
parent d59828df1c
commit 8c135a5396

View file

@ -3,50 +3,55 @@
{% block title_ruler %}{% endblock %}
{% block media %}
<style>
<style>
@media(min-width: 800px) {
#content {
width: 98%;
margin-left: 0;
}
.middle-right-content {
margin-left: 13%;
display: inline-flex;
}
}
@media(max-width: 799px) {
#content {
width: 100%;
margin-left: 0;
}
.middle-right-content {
display: block;
}
}
</style>
</style>
{% endblock %}
{% block js_media %}
<script type="text/javascript">
<script type="text/javascript">
function activateBlogBoxOnClick() {
$('.blog-box').on('click', function() {
$('.blog-box').on('click', function () {
var $description = $(this).children('.blog-description');
var max_height = $description.css('max-height');
if (max_height !== 'fit-content') {
$description.css('max-height', 'fit-content');
$(this).css('cursor', 'auto');
$(this).removeClass('pre-expand-blog');
$(this).find('.actionbar').show();
}
})
$('.blog-box').each(function() {
if ($(this).prop('scrollHeight') > $(this).height() ) {
$('.blog-box').each(function () {
if ($(this).prop('scrollHeight') > $(this).height()) {
$(this).addClass('pre-expand-blog');
$(this).css('cursor', 'pointer');
$(this).find('.actionbar').hide();
}
});
}
function navigateTo($elem, update_sidebar=false) {
function navigateTo($elem, update_sidebar = false) {
var url = $elem.attr('data-href') || $elem.attr('href');
if (url === '#') return;
@ -55,7 +60,7 @@
$elem.addClass('active');
}
$('.middle-right-content').html(loading_page);
$.get(url, function(data) {
$.get(url, function (data) {
var reload_content = $(data).find('.middle-right-content');
if (reload_content.length) {
@ -77,7 +82,7 @@
function registerNavigation() {
const links = ['.pagination a', '.tabs li a', '.problem-feed-option a'];
for (link of links) {
$(link).on('click', function(e) {
$(link).on('click', function (e) {
e.preventDefault();
navigateTo($(this));
})
@ -90,24 +95,24 @@
});
activateBlogBoxOnClick();
$('.left-sidebar-item').on('click', function() {
$('.left-sidebar-item').on('click', function () {
navigateTo($(this), true);
});
registerNavigation();
});
</script>
</script>
{% endblock %}
{% macro make_tab_item(name, fa, url, text) %}
<div class="left-sidebar-item {% if page_type == name %}active{% endif %}" data-href="{{ url }}" id="{{ name }}-tab">
<div class="left-sidebar-item {% if page_type == name %}active{% endif %}" data-href="{{ url }}" id="{{ name }}-tab">
<span class="sidebar-icon"><i class="{{ fa }}"></i></span>
<span>{{ text }}</span>
</div>
</div>
{% endmacro %}
{% block body %}
{% block before_posts %}{% endblock %}
<div id="three-col-container">
{% block before_posts %}{% endblock %}
<div id="three-col-container">
{% block left_sidebar %}{% endblock %}
<div class="middle-right-content">
{% block three_col_media %}{% endblock %}
@ -118,14 +123,14 @@
</div>
{% block right_sidebar %}{% endblock %}
</div>
</div>
{% block after_posts %}{% endblock %}
</div>
{% block after_posts %}{% endblock %}
{% endblock %}
{% block bodyend %}
{{ super() }}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
{% endif %}
{% include "comments/math.html" %}
{{ super() }}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
{% endif %}
{% include "comments/math.html" %}
{% endblock %}