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 {
|
|
|
|
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
|
|
|
}
|
2022-11-25 06:10:57 +00:00
|
|
|
|
2022-11-25 05:28:24 +00:00
|
|
|
/* TODO: remove this */
|
|
|
|
#three-col-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
2022-04-13 05:52:03 +00:00
|
|
|
</style>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block js_media %}
|
|
|
|
<script type="text/javascript">
|
2022-11-25 05:28:24 +00:00
|
|
|
// TODO: remove this
|
|
|
|
function onWindowReady() {
|
|
|
|
// http://stackoverflow.com/a/1060034/1090657
|
|
|
|
var hidden = 'hidden';
|
|
|
|
|
|
|
|
// Standards:
|
|
|
|
if (hidden in document)
|
|
|
|
document.addEventListener('visibilitychange', onchange);
|
|
|
|
else if ((hidden = 'mozHidden') in document)
|
|
|
|
document.addEventListener('mozvisibilitychange', onchange);
|
|
|
|
else if ((hidden = 'webkitHidden') in document)
|
|
|
|
document.addEventListener('webkitvisibilitychange', onchange);
|
|
|
|
else if ((hidden = 'msHidden') in document)
|
|
|
|
document.addEventListener('msvisibilitychange', onchange);
|
|
|
|
// IE 9 and lower:
|
|
|
|
else if ('onfocusin' in document)
|
|
|
|
document.onfocusin = document.onfocusout = onchange;
|
|
|
|
// All others:
|
|
|
|
else
|
|
|
|
window.onpageshow = window.onpagehide
|
|
|
|
= window.onfocus = window.onblur = onchange;
|
|
|
|
|
|
|
|
function onchange(evt) {
|
|
|
|
var v = 'window-visible', h = 'window-hidden', evtMap = {
|
|
|
|
focus: v, focusin: v, pageshow: v, blur: h, focusout: h, pagehide: h
|
|
|
|
};
|
|
|
|
|
|
|
|
evt = evt || window.event;
|
|
|
|
if (evt.type in evtMap)
|
|
|
|
document.body.className = evtMap[evt.type];
|
|
|
|
else
|
|
|
|
document.body.className = this[hidden] ? 'window-hidden' : 'window-visible';
|
|
|
|
|
|
|
|
if ('$' in window)
|
|
|
|
$(window).trigger('dmoj:' + document.body.className);
|
|
|
|
}
|
|
|
|
|
|
|
|
$('.tabs').each(function () {
|
|
|
|
var $this = $(this), $h2 = $(this).find('h2'), $ul = $(this).find('ul');
|
|
|
|
var cutoff = ($h2.textWidth() || 400) + 20, handler;
|
|
|
|
$ul.children().each(function () {
|
|
|
|
cutoff += $(this).width();
|
|
|
|
});
|
|
|
|
$(window).resize(handler = function () {
|
|
|
|
$this.toggleClass('tabs-no-flex', $this.width() < cutoff);
|
|
|
|
});
|
|
|
|
handler();
|
|
|
|
});
|
|
|
|
|
|
|
|
// set the initial state (but only if browser supports the Page Visibility API)
|
|
|
|
if (document[hidden] !== undefined)
|
|
|
|
onchange({type: document[hidden] ? 'blur' : 'focus'});
|
|
|
|
|
|
|
|
$("a.close").click(function () {
|
|
|
|
var $closer = $(this);
|
|
|
|
$closer.parent().fadeOut(200);
|
|
|
|
});
|
|
|
|
|
|
|
|
register_time($('.time-with-rel'));
|
|
|
|
|
|
|
|
if (typeof window.orientation !== 'undefined') {
|
|
|
|
$(window).resize(function () {
|
|
|
|
var width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
|
|
|
// $('#viewport').attr('content', width > 480 ? 'initial-scale=1' : 'width=480');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$.ajaxSetup({
|
|
|
|
beforeSend: function (xhr, settings) {
|
|
|
|
if (!(/^(GET|HEAD|OPTIONS|TRACE)$/.test(settings.type)) && !this.crossDomain)
|
|
|
|
xhr.setRequestHeader('X-CSRFToken', $.cookie('csrftoken'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
$("[data-src]img").each(function() {
|
|
|
|
$(this).attr("src", $(this).attr("data-src"));
|
|
|
|
})
|
|
|
|
$("[data-src]iframe").each(function() {
|
|
|
|
$(this).attr("src", $(this).attr("data-src"));
|
|
|
|
})
|
|
|
|
}, "100");
|
|
|
|
|
|
|
|
$('form').submit(function (evt) {
|
|
|
|
// Prevent multiple submissions of forms, see #565
|
|
|
|
$("input[type='submit']").prop('disabled', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
registerPopper($('#nav-lang-icon'), $('#lang-dropdown'));
|
|
|
|
registerPopper($('#user-links'), $('#userlink_dropdown'));
|
|
|
|
$('.lang-dropdown-item').click(function() {
|
|
|
|
$('select[name="language"]').val($(this).attr('value'));
|
|
|
|
$('#form-lang').submit();
|
|
|
|
})
|
|
|
|
$('#logout').on('click', () => $('#logout-form').submit());
|
|
|
|
}
|
2022-11-25 06:10:57 +00:00
|
|
|
$(function () {
|
|
|
|
const loading_page = `{% include "loading-page.html" %}`;
|
2022-11-25 05:28:24 +00:00
|
|
|
window.addEventListener('popstate', (e) => {
|
|
|
|
window.location.href = e.currentTarget.location.href;
|
|
|
|
});
|
|
|
|
|
2022-04-13 05:52:03 +00:00
|
|
|
$('.left-sidebar-item').on('click', function() {
|
|
|
|
var url = $(this).attr('data-href');
|
2022-11-25 05:28:24 +00:00
|
|
|
|
2022-04-13 05:52:03 +00:00
|
|
|
if (url === '#') return;
|
2022-11-25 05:28:24 +00:00
|
|
|
$('.left-sidebar-item').removeClass('active');
|
|
|
|
$(this).addClass('active');
|
2022-11-25 06:10:57 +00:00
|
|
|
$('.middle-right-content').html(loading_page);
|
2022-11-25 05:28:24 +00:00
|
|
|
$.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());
|
|
|
|
MathJax.typeset($('.middle-right-content')[0]);
|
|
|
|
onWindowReady();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
window.location.href = url;
|
|
|
|
}
|
|
|
|
});
|
2022-04-13 05:52:03 +00:00
|
|
|
});
|
2022-06-02 22:29:00 +00:00
|
|
|
$('.blog-box').on('click', function() {
|
|
|
|
var $description = $(this).children('.blog-description');
|
|
|
|
var max_height = $description.css('max-height');
|
2022-04-13 05:52:03 +00:00
|
|
|
if (max_height !== 'fit-content') {
|
2022-06-02 22:29:00 +00:00
|
|
|
$description.css('max-height', 'fit-content');
|
2022-04-13 05:52:03 +00:00
|
|
|
$(this).css('cursor', 'auto');
|
2022-06-02 22:29:00 +00:00
|
|
|
$(this).removeClass('pre-expand-blog');
|
2022-04-13 05:52:03 +00:00
|
|
|
}
|
|
|
|
})
|
2022-06-02 22:29:00 +00:00
|
|
|
$('.blog-box').each(function() {
|
2022-04-13 05:52:03 +00:00
|
|
|
if ($(this).prop('scrollHeight') > $(this).height() ) {
|
2022-06-02 22:29:00 +00:00
|
|
|
$(this).addClass('pre-expand-blog');
|
2022-04-13 05:52:03 +00:00
|
|
|
$(this).css('cursor', 'pointer');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</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">
|
2022-11-25 05:28:24 +00:00
|
|
|
{% 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 %}
|