NDOJ/templates/three-column-content.html

152 lines
4.4 KiB
HTML
Raw Permalink Normal View History

2023-02-08 05:14:48 +00:00
{% set layout = 'no_wrapper' %}
2023-01-27 23:11:10 +00:00
{% extends "base.html" %}
{% block title_row %}{% endblock %}
{% block title_ruler %}{% endblock %}
{% block media %}
2023-02-08 05:14:48 +00:00
<style>
@media(min-width: 800px) {
#content {
width: 98%;
margin-left: 0;
}
2023-02-04 13:14:50 +00:00
2023-02-08 05:14:48 +00:00
.middle-right-content {
margin-left: 13%;
display: inline-flex;
}
2023-01-27 23:11:10 +00:00
}
2023-02-08 05:14:48 +00:00
@media(max-width: 799px) {
#content {
width: 100%;
margin-left: 0;
}
2023-01-27 23:11:10 +00:00
2023-02-08 05:14:48 +00:00
.middle-right-content {
display: block;
}
2023-02-04 13:14:50 +00:00
}
2023-02-08 05:14:48 +00:00
</style>
2023-02-04 13:14:50 +00:00
{% endblock %}
2023-01-27 23:11:10 +00:00
2023-02-04 13:14:50 +00:00
{% block js_media %}
2023-02-08 05:14:48 +00:00
<script type="text/javascript">
function activateBlogBoxOnClick() {
$('.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).children().children('.show-more').hide();
}
});
2023-02-06 17:26:04 +00:00
2023-02-08 05:14:48 +00:00
$('.blog-box').each(function () {
var $precontent = $(this).children('.blog-description').height();
var $content = $(this).children().children('.content-description').height();
if ($content == undefined) {
$content = $(this).children().children('.md-typeset').height()
}
if ($content > $precontent - 30) {
$(this).addClass('pre-expand-blog');
$(this).css('cursor', 'pointer');
} else {
$(this).children().children('.show-more').hide();
}
});
}
2023-02-04 13:14:50 +00:00
2023-02-08 05:14:48 +00:00
function navigateTo($elem, update_sidebar = false) {
var url = $elem.attr('data-href') || $elem.attr('href');
2023-01-27 23:11:10 +00:00
2023-02-08 05:14:48 +00:00
if (url === '#') return;
if (update_sidebar) {
$('.left-sidebar-item').removeClass('active');
$elem.addClass('active');
}
$(window).off("scroll");
2023-02-08 05:14:48 +00:00
$('.middle-right-content').html(loading_page);
$.get(url, function (data) {
var reload_content = $(data).find('.middle-right-content');
if (reload_content.length) {
window.history.pushState("", "", url);
$('html, body').animate({scrollTop: 0}, 'fast');
2023-02-08 05:14:48 +00:00
$('.middle-right-content').html(reload_content.first().html());
if (reload_content.hasClass("wrapper")) {
$('.middle-right-content').addClass("wrapper");
}
else {
$('.middle-right-content').removeClass("wrapper");
}
$(document).prop('title', $(data).filter('title').text());
MathJax.typeset($('.middle-right-content')[0]);
onWindowReady();
activateBlogBoxOnClick();
$('.xdsoft_datetimepicker').hide();
registerNavigation();
2023-02-08 05:14:48 +00:00
}
else {
window.location.href = url;
}
});
2023-01-27 23:11:10 +00:00
}
2023-02-08 05:14:48 +00:00
function registerNavigation() {
const links = ['.pagination a', '.tabs li a', '.problem-feed-option a'];
for (link of links) {
$(link).on('click', function (e) {
e.preventDefault();
navigateTo($(this));
})
2023-02-04 13:14:50 +00:00
}
2023-01-27 23:11:10 +00:00
}
2023-02-08 05:14:48 +00:00
$(function () {
window.addEventListener('popstate', (e) => {
window.location.href = e.currentTarget.location.href;
});
activateBlogBoxOnClick();
2023-01-27 23:11:10 +00:00
2023-02-08 05:14:48 +00:00
$('.left-sidebar-item').on('click', function () {
navigateTo($(this), true);
});
registerNavigation();
2023-01-27 23:11:10 +00:00
});
2023-02-08 05:14:48 +00:00
</script>
2023-01-27 23:11:10 +00:00
{% endblock %}
{% macro make_tab_item(name, fa, url, text) %}
2023-02-08 05:14:48 +00:00
<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>
2023-01-27 23:11:10 +00:00
{% endmacro %}
{% block body %}
2023-02-08 05:14:48 +00:00
{% block before_posts %}{% endblock %}
<div id="three-col-container">
{% block left_sidebar %}{% endblock %}
<div class="middle-right-content {{'wrapper' if is_two_column}}">
{% block three_col_media %}{% endblock %}
{% block three_col_js %}{% endblock %}
<div class="middle-content">
{% block middle_title %}{% endblock %}
{% block middle_content %}{% endblock %}
</div>
{% block right_sidebar %}{% endblock %}
2023-01-27 23:11:10 +00:00
</div>
</div>
2023-02-08 05:14:48 +00:00
{% block after_posts %}{% endblock %}
2023-01-27 23:11:10 +00:00
{% endblock %}
{% block bodyend %}
2023-02-08 05:14:48 +00:00
{{ super() }}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
{% endif %}
{% include "comments/math.html" %}
2023-02-04 13:14:50 +00:00
{% endblock %}