Files
jumpserver/apps/templates/_foot_js.html
2025-08-14 16:09:43 +08:00

54 lines
1.3 KiB
Python

{% load i18n %}
{% load static %}
{% if INTERFACE.footer_content %}
<style>
.markdown-footer{
left: 50%;
bottom: 0;
max-width: 520px;
width: calc(100% - 40px);
padding: 8px 0;
text-align: center;
line-height: 1.4;
color: inherit;
}
.markdown-footer p{ margin: 0; }
.markdown-footer a{ color: #428bca; text-decoration: none; }
.markdown-footer a:hover{ text-decoration: underline; }
</style>
<div id="markdown-output" class="markdown-footer" role="contentinfo" aria-label="{% trans 'Page footer' %}"></div>
{% endif %}
<script src="{% static 'js/plugins/markdown-it.min.js' %}"></script>
<script>
(function () {
var container = document.getElementById('markdown-output');
if (!container) return;
var src = `{{ INTERFACE.footer_content|default:''|escapejs }}`.replace(/\r\n?/g, '\n').trim();
if (!src) { container.remove(); return; }
var md = window.markdownit({
html: false,
linkify: true,
typographer: true,
breaks: true
});
var html = md.render(src);
if (window.DOMPurify) {
html = window.DOMPurify.sanitize(html);
}
container.innerHTML = html;
container.querySelectorAll('a').forEach(function (a) {
a.setAttribute('target', '_blank');
a.setAttribute('rel', 'noopener noreferrer');
});
})();
</script>