core: move jquery to header section

This commit is contained in:
Antoine Bartuccio 2018-12-18 13:54:53 +01:00
parent 4afd7a0023
commit 4d866843e1
2 changed files with 10 additions and 14 deletions

View File

@ -16,6 +16,9 @@
{% else %}
<link rel="stylesheet" href="{{ static('core/font-awesome/css/font-awesome.min.css') }}">
{% endif %}
<!-- Jquery declared here to be accessible in every django widgets -->
<script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
{% endblock %}
</head>
@ -248,7 +251,6 @@
{% endblock %}
-->
{% block script %}
<script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
<script src="{{ static('core/js/ui/jquery-ui.min.js') }}"></script>
<script src="{{ static('core/js/ui/i18n/datepicker-fr.js') }}"></script>
<script src="{{ static('core/js/jquery.datetimepicker.full.min.js') }}"></script>

View File

@ -33,19 +33,13 @@
// Custom markdown parser
function customMarkdownParser(plainText, preview) {
// Wait for jquery to load
var waitForJquery = setInterval(function () {
if (typeof $ != 'undefined'){
clearInterval(waitForJquery)
$.ajax({
url: "{{ markdown_api_url }}",
method: "POST",
data: { text: plainText, csrfmiddlewaretoken: getCookie('csrftoken') },
}).done(function (msg) {
preview.innerHTML = msg;
});
}
}, 10);
$.ajax({
url: "{{ markdown_api_url }}",
method: "POST",
data: { text: plainText, csrfmiddlewaretoken: getCookie('csrftoken') },
}).done(function (msg) {
preview.innerHTML = msg;
});
}
// Pretty markdown input