mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-18 14:17:57 +00:00
perf: foot_js
This commit is contained in:
parent
92b20fe2ef
commit
7d06819bbe
@ -1,6 +1,15 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
|
<script src="{% static "js/plugins/metisMenu/jquery.metisMenu.3.0.7.js" %}"></script>
|
||||||
|
|
||||||
|
<script src="{% static "js/plugins/toastr/toastr.min.js" %}"></script>
|
||||||
|
<script src="{% static "js/inspinia.js" %}"></script>
|
||||||
|
<script src="{% static "js/jumpserver.js" %}?v=10"></script>
|
||||||
|
<script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
|
||||||
|
<script src="{% static 'js/plugins/select2/i18n/zh-CN.js' %}"></script>
|
||||||
|
<script src="{% static 'js/plugins/markdown-it.min.js' %}"></script>
|
||||||
|
|
||||||
{% if INTERFACE.footer_content %}
|
{% if INTERFACE.footer_content %}
|
||||||
<style>
|
<style>
|
||||||
.markdown-footer{
|
.markdown-footer{
|
||||||
@ -21,34 +30,39 @@
|
|||||||
<div id="markdown-output" class="markdown-footer" role="contentinfo" aria-label="{% trans 'Page footer' %}"></div>
|
<div id="markdown-output" class="markdown-footer" role="contentinfo" aria-label="{% trans 'Page footer' %}"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="{% static 'js/plugins/markdown-it.min.js' %}"></script>
|
<script type="text/markdown"> {{ INTERFACE.footer_content }} </script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
activeNav("{{ FORCE_SCRIPT_NAME }}");
|
||||||
var container = document.getElementById('markdown-output');
|
|
||||||
if (!container) return;
|
|
||||||
|
|
||||||
var src = `{{ INTERFACE.footer_content|default:''|escapejs }}`.replace(/\r\n?/g, '\n').trim();
|
$(document).ready(function () {
|
||||||
if (!src) { container.remove(); return; }
|
setAjaxCSRFToken();
|
||||||
|
|
||||||
var md = window.markdownit({
|
$('textarea').attr('rows', 5);
|
||||||
html: false,
|
|
||||||
linkify: true,
|
|
||||||
typographer: true,
|
|
||||||
breaks: true
|
|
||||||
});
|
|
||||||
|
|
||||||
var html = md.render(src);
|
if ($('.tooltip')[0]) {
|
||||||
|
$('.tooltip').tooltip();
|
||||||
|
}
|
||||||
|
|
||||||
if (window.DOMPurify) {
|
$.fn.select2.defaults.set('language', getUserLang());
|
||||||
html = window.DOMPurify.sanitize(html);
|
|
||||||
}
|
|
||||||
|
|
||||||
container.innerHTML = html;
|
var md = window.markdownit({
|
||||||
|
html: false,
|
||||||
|
linkify: true,
|
||||||
|
typographer: true,
|
||||||
|
breaks: true
|
||||||
|
});
|
||||||
|
|
||||||
container.querySelectorAll('a').forEach(function (a) {
|
const markdownContent = `{{ INTERFACE.footer_content|default:''|escapejs }}`.replace(/\r\n?/g, '\n').trim();;
|
||||||
a.setAttribute('target', '_blank');
|
const markdownRef = document.getElementById('markdown-output');
|
||||||
a.setAttribute('rel', 'noopener noreferrer');
|
|
||||||
});
|
if (markdownRef && markdownContent) {
|
||||||
})();
|
const renderedContent = md.render(markdownContent.trim());
|
||||||
|
|
||||||
|
markdownRef.innerHTML = renderedContent;
|
||||||
|
markdownRef.querySelectorAll('a').forEach(link => {
|
||||||
|
link.setAttribute('target', '_blank');
|
||||||
|
link.setAttribute('rel', 'noopener noreferrer');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user