diff --git a/templates/three-column-content.html b/templates/three-column-content.html index d90161d..eea22ee 100644 --- a/templates/three-column-content.html +++ b/templates/three-column-content.html @@ -3,129 +3,134 @@ {% block title_ruler %}{% endblock %} {% block media %} - + } + + @media(max-width: 799px) { + #content { + width: 100%; + margin-left: 0; + } + + .middle-right-content { + display: block; + } + } + {% endblock %} {% block js_media %} - + } + + function navigateTo($elem, update_sidebar = false) { + var url = $elem.attr('data-href') || $elem.attr('href'); + + if (url === '#') return; + if (update_sidebar) { + $('.left-sidebar-item').removeClass('active'); + $elem.addClass('active'); + } + $('.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()); + $(document).prop('title', $(data).filter('title').text()); + MathJax.typeset($('.middle-right-content')[0]); + onWindowReady(); + activateBlogBoxOnClick(); + $('.xdsoft_datetimepicker').hide(); + registerNavigation(); + } + else { + window.location.href = url; + } + }); + } + + 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)); + }) + } + } + + $(function () { + window.addEventListener('popstate', (e) => { + window.location.href = e.currentTarget.location.href; + }); + activateBlogBoxOnClick(); + + $('.left-sidebar-item').on('click', function () { + navigateTo($(this), true); + }); + registerNavigation(); + }); + {% endblock %} {% macro make_tab_item(name, fa, url, text) %} - + {% endmacro %} {% block body %} - {% block before_posts %}{% endblock %} -
- {% block left_sidebar %}{% endblock %} -
- {% block three_col_media %}{% endblock %} - {% block three_col_js %}{% endblock %} -
- {% block middle_title %}{% endblock %} - {% block middle_content %}{% endblock %} -
- {% block right_sidebar %}{% endblock %} +{% block before_posts %}{% endblock %} +
+ {% block left_sidebar %}{% endblock %} +
+ {% block three_col_media %}{% endblock %} + {% block three_col_js %}{% endblock %} +
+ {% block middle_title %}{% endblock %} + {% block middle_content %}{% endblock %}
+ {% block right_sidebar %}{% endblock %}
- {% block after_posts %}{% endblock %} +
+{% block after_posts %}{% endblock %} {% endblock %} {% block bodyend %} - {{ super() }} - {% if REQUIRE_JAX %} - {% include "mathjax-load.html" %} - {% endif %} - {% include "comments/math.html" %} -{% endblock %} +{{ super() }} +{% if REQUIRE_JAX %} +{% include "mathjax-load.html" %} +{% endif %} +{% include "comments/math.html" %} +{% endblock %} \ No newline at end of file