Move function out of compressor
This commit is contained in:
parent
2116dda86b
commit
ec7f5a2047
2 changed files with 31 additions and 30 deletions
|
@ -26,7 +26,7 @@ pyotp
|
||||||
qrcode[pil]
|
qrcode[pil]
|
||||||
jsonfield @ git+https://github.com/DMOJ/jsonfield.git
|
jsonfield @ git+https://github.com/DMOJ/jsonfield.git
|
||||||
pymoss
|
pymoss
|
||||||
packaging
|
packaging<23
|
||||||
celery
|
celery
|
||||||
ansi2html @ git+https://github.com/DMOJ/ansi2html.git
|
ansi2html @ git+https://github.com/DMOJ/ansi2html.git
|
||||||
sqlparse
|
sqlparse
|
||||||
|
|
|
@ -3,6 +3,36 @@
|
||||||
{% block js_media %}
|
{% block js_media %}
|
||||||
<script type="text/javascript" src="{{ ACE_URL }}/ace.js"></script>
|
<script type="text/javascript" src="{{ ACE_URL }}/ace.js"></script>
|
||||||
{{ form.media.js }}
|
{{ form.media.js }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
function update_submit_area(code) {
|
||||||
|
window.previous_template = code;
|
||||||
|
$('textarea#id_source').val(code);
|
||||||
|
window.ace_source.getSession().setValue(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_language_template() {
|
||||||
|
{% if output_only %}
|
||||||
|
window.ace_source.env.editor.setReadOnly(true);
|
||||||
|
{% else %}
|
||||||
|
var source = $('textarea#id_source');
|
||||||
|
if (source.val() == window.previous_template.replace(/\r/g, '') || source.val() == '') {
|
||||||
|
var lang_id = $('#id_language').val();
|
||||||
|
var code = localStorage.getItem('submit:' + $('#id_language').val());
|
||||||
|
|
||||||
|
if (code != null) {
|
||||||
|
update_submit_area(code);
|
||||||
|
} else {
|
||||||
|
$.get('{{ url('language_template_ajax') }}', {
|
||||||
|
id: lang_id,
|
||||||
|
problem: {{problem_id}}
|
||||||
|
}).done(function (template) {
|
||||||
|
update_submit_area(template);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{% compress js %}
|
{% compress js %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
|
@ -13,35 +43,6 @@
|
||||||
|
|
||||||
window.previous_template = '';
|
window.previous_template = '';
|
||||||
|
|
||||||
function update_submit_area(code) {
|
|
||||||
window.previous_template = code;
|
|
||||||
$('textarea#id_source').val(code);
|
|
||||||
window.ace_source.getSession().setValue(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_language_template() {
|
|
||||||
{% if output_only %}
|
|
||||||
window.ace_source.env.editor.setReadOnly(true);
|
|
||||||
{% else %}
|
|
||||||
var source = $('textarea#id_source');
|
|
||||||
if (source.val() == window.previous_template.replace(/\r/g, '') || source.val() == '') {
|
|
||||||
var lang_id = $('#id_language').val();
|
|
||||||
var code = localStorage.getItem('submit:' + $('#id_language').val());
|
|
||||||
|
|
||||||
if (code != null) {
|
|
||||||
update_submit_area(code);
|
|
||||||
} else {
|
|
||||||
$.get('{{ url('language_template_ajax') }}', {
|
|
||||||
id: lang_id,
|
|
||||||
problem: {{problem_id}}
|
|
||||||
}).done(function (template) {
|
|
||||||
update_submit_area(template);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{% endif %}
|
|
||||||
}
|
|
||||||
|
|
||||||
function makeDisplayData(data) {
|
function makeDisplayData(data) {
|
||||||
var site_data = data.attr('data-info');
|
var site_data = data.attr('data-info');
|
||||||
var judge_data = data.attr('data-judge-info');
|
var judge_data = data.attr('data-judge-info');
|
||||||
|
|
Loading…
Reference in a new issue