NDOJ/templates/three-column-content.html

132 lines
4.4 KiB
HTML
Raw Normal View History

2022-04-13 05:52:03 +00:00
{% extends "base.html" %}
{% block title_row %}{% endblock %}
{% block title_ruler %}{% endblock %}
{% block media %}
<style>
2022-07-05 05:54:04 +00:00
@media(min-width: 800px) {
#content {
width: 98%;
margin-left: 0;
}
2022-11-25 06:10:57 +00:00
.middle-right-content {
2022-11-27 07:03:38 +00:00
margin-left: 13%;
2022-11-25 06:10:57 +00:00
display: inline-flex;
}
2022-07-05 05:54:04 +00:00
}
@media(max-width: 799px) {
#content {
width: 100%;
margin-left: 0;
}
2022-11-25 06:10:57 +00:00
.middle-right-content {
display: block;
}
2022-04-13 05:52:03 +00:00
}
</style>
{% endblock %}
{% block js_media %}
<script type="text/javascript">
2022-11-27 01:15:01 +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');
}
})
$('.blog-box').each(function() {
if ($(this).prop('scrollHeight') > $(this).height() ) {
$(this).addClass('pre-expand-blog');
$(this).css('cursor', 'pointer');
}
});
}
2022-12-16 10:53:37 +00:00
function navigateTo($elem, update_sidebar=false) {
2022-11-25 06:27:39 +00:00
var url = $elem.attr('data-href') || $elem.attr('href');
if (url === '#') return;
2022-12-16 10:53:37 +00:00
if (update_sidebar) {
$('.left-sidebar-item').removeClass('active');
$elem.addClass('active');
}
2022-11-25 06:27:39 +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);
$('.middle-right-content').html(reload_content.first().html());
2022-12-16 10:53:37 +00:00
$(document).prop('title', $(data).filter('title').text());
2022-11-25 06:27:39 +00:00
MathJax.typeset($('.middle-right-content')[0]);
onWindowReady();
2022-11-27 01:15:01 +00:00
activateBlogBoxOnClick();
2022-11-25 07:50:32 +00:00
$('.xdsoft_datetimepicker').hide();
2022-12-16 10:53:37 +00:00
registerNavigation();
2022-11-25 06:27:39 +00:00
}
else {
window.location.href = url;
}
});
}
2022-12-16 10:53:37 +00:00
function registerNavigation() {
2022-12-16 11:11:24 +00:00
const links = ['.pagination a', '.tabs a', '.problem-feed-option a'];
for (link of links) {
$(link).on('click', function(e) {
e.preventDefault();
navigateTo($(this));
})
}
2022-12-16 10:53:37 +00:00
}
2022-11-25 06:10:57 +00:00
$(function () {
window.addEventListener('popstate', (e) => {
window.location.href = e.currentTarget.location.href;
});
2022-11-27 01:15:01 +00:00
activateBlogBoxOnClick();
2022-04-13 05:52:03 +00:00
$('.left-sidebar-item').on('click', function() {
2022-12-16 10:53:37 +00:00
navigateTo($(this), true);
2022-04-13 05:52:03 +00:00
});
2022-12-16 10:53:37 +00:00
registerNavigation();
2022-04-13 05:52:03 +00:00
});
</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">
2022-06-02 22:09:24 +00:00
<span class="sidebar-icon"><i class="{{ fa }}"></i></span>
<span>{{ text }}</span>
2022-04-13 05:52:03 +00:00
</div>
{% endmacro %}
{% block body %}
{% block before_posts %}{% endblock %}
<div id="three-col-container">
{% block left_sidebar %}{% endblock %}
2022-11-25 06:10:57 +00:00
<div class="middle-right-content">
{% 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 %}
2022-04-13 05:52:03 +00:00
</div>
</div>
{% block after_posts %}{% endblock %}
{% endblock %}
{% block bodyend %}
{{ super() }}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
{% endif %}
{% include "comments/math.html" %}
{% endblock %}