NDOJ/templates/three-column-content.html

161 lines
4.8 KiB
HTML
Raw 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>
2023-07-06 17:54:52 +00:00
#content {
width: 100%;
margin-left: 0;
}
2023-02-04 13:14:50 +00:00
2023-07-06 17:54:52 +00:00
@media(min-width: 800px) {
2023-02-08 05:14:48 +00:00
.middle-right-content {
margin-left: 13%;
2023-03-06 21:57:16 +00:00
display: flex;
2023-07-06 17:54:52 +00:00
margin-right: 2%;
2023-02-08 05:14:48 +00:00
}
2023-01-27 23:11:10 +00:00
}
2023-02-08 05:14:48 +00:00
@media(max-width: 799px) {
.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">
2023-11-02 01:54:09 +00:00
let loadingPage;
2023-02-08 05:14:48 +00:00
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) {
2023-09-17 05:18:30 +00:00
var url = $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-11-02 01:54:09 +00:00
$('.middle-right-content').html(loadingPage);
2023-02-08 05:14:48 +00:00
$.get(url, function (data) {
var reload_content = $(data).find('.middle-right-content');
2023-11-02 01:54:09 +00:00
var bodyend_script = $(data).find('#extra_js');
2023-02-08 05:14:48 +00:00
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());
2023-11-02 01:54:09 +00:00
$('#extra_js').html(bodyend_script.first().html());
2024-02-20 00:30:39 +00:00
$("#loading-bar").stop(true, true);
2023-11-02 00:14:21 +00:00
$("#loading-bar").hide().css({ width: 0});
2023-02-08 05:14:48 +00:00
if (reload_content.hasClass("wrapper")) {
$('.middle-right-content').addClass("wrapper");
}
else {
$('.middle-right-content').removeClass("wrapper");
}
$(document).prop('title', $(data).filter('title').text());
2024-02-05 23:02:49 +00:00
renderKatex($('.middle-right-content')[0]);
2023-02-08 05:14:48 +00:00
onWindowReady();
activateBlogBoxOnClick();
$('.xdsoft_datetimepicker').hide();
registerNavigation();
}
else {
window.location.href = url;
}
});
2023-01-27 23:11:10 +00:00
}
2023-02-08 05:14:48 +00:00
function registerNavigation() {
2024-02-19 23:00:44 +00:00
const links = ['.pagination a', '.tabs li a', '#control-panel a'];
for (let linkSelector of links) {
$(linkSelector).each(function() {
if ($(this).attr('target') !== '_blank') {
$(this).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-09-17 05:18:30 +00:00
$('.left-sidebar-item').on('click', function (e) {
e.preventDefault();
2023-02-08 05:14:48 +00:00
navigateTo($(this), true);
});
registerNavigation();
2023-11-02 01:54:09 +00:00
$.get("{{static('html/loading-page.html')}}", function(data) {
loadingPage = data;
});
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-09-17 05:18:30 +00:00
<a class="left-sidebar-item {% if page_type == name %}active{% endif %}" href="{{ url }}" id="{{ name }}-tab">
2023-02-08 05:14:48 +00:00
<span class="sidebar-icon"><i class="{{ fa }}"></i></span>
2023-08-24 16:10:39 +00:00
<span class="sidebar-text">{{ text }}</span>
2023-09-17 05:18:30 +00:00
</a>
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 %}
<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 %}
2023-11-02 01:54:09 +00:00
{% block extra_js %}
{% block three_col_js %}{% endblock %}
{% endblock %}
2023-01-27 23:11:10 +00:00
{% block bodyend %}
2023-02-08 05:14:48 +00:00
{{ super() }}
{% include "comments/math.html" %}
2023-02-04 13:14:50 +00:00
{% endblock %}