Change pre code css in markdown

This commit is contained in:
cuom1999 2024-01-18 19:46:41 -06:00
parent d75a498d18
commit aef795b40c
24 changed files with 200 additions and 397 deletions

View file

@ -50,9 +50,7 @@
<link rel="stylesheet" type="text/css" href="{{ static('markdown.css') }}">
{% compress css %}
<link rel="stylesheet" href="{{ static('style.css') }}">
{% if PYGMENT_THEME %}
<link rel="stylesheet" href="{{ static(PYGMENT_THEME) }}">
{% endif %}{% if INLINE_FONTAWESOME %}
{% if INLINE_FONTAWESOME %}
<link rel="stylesheet" href="{{ static('libs/fontawesome/font-awesome.css') }}">{% endif %}
<link rel="stylesheet" type="text/css" href="{{ static('libs/featherlight/featherlight.min.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('libs/clipboard/tooltip.css') }}">

View file

@ -113,6 +113,7 @@
$('#chat-box').scrollTop($('#chat-box')[0].scrollHeight);
register_time($('.time-with-rel'));
MathJax.typeset();
populateCopyButton();
merge_authors();
}
@ -167,6 +168,7 @@
add_new_message(message, room, true);
}
MathJax.typeset();
populateCopyButton();
register_time($('.time-with-rel'));
remove_unread_current_user();
merge_authors();

View file

@ -21,34 +21,6 @@
info_float.width(container.width());
}
}
// TODO: remove this
var copyButton;
$('pre code').each(function () {
$(this).parent().before($('<div>', {'class': 'copy-clipboard'})
.append(copyButton = $('<span>', {
'class': 'btn-clipboard',
'data-clipboard-text': $(this).text(),
'title': 'Click to copy'
}).text('Copy')));
$(copyButton.get(0)).mouseleave(function () {
$(this).attr('class', 'btn-clipboard');
$(this).removeAttr('aria-label');
});
var curClipboard = new Clipboard(copyButton.get(0));
curClipboard.on('success', function (e) {
e.clearSelection();
showTooltip(e.trigger, 'Copied!');
});
curClipboard.on('error', function (e) {
showTooltip(e.trigger, fallbackMessage(e.action));
});
});
});
</script>
{% endcompress %}

View file

@ -4,4 +4,4 @@
<hr>
{% endif %}
{{ tag.description|markdown }}
{{ tag.description }}

View file

@ -44,15 +44,13 @@
$.ajax({
url: "{{url('blog_preview')}}",
type: 'POST',
headers: {
'X-CSRFToken': csrfToken, // Include the CSRF token in the headers
},
data: {
preview: $(this).val()
},
success: function(data) {
$('#display').html(data);
MathJax.typeset();
populateCopyButton();
},
error: function(error) {
alert(error);

View file

@ -1,20 +1,5 @@
{% extends "base.html" %}
{% block body %}
<div class="source-wrap">
<table>
<tr>
<td class="source-ln">
<div>
{% for line in raw_source.split('\n') %}
<a href="#line-{{ loop.index }}" name="line-{{ loop.index }}">
<pre>{{ loop.index }}</pre>
</a>
{% endfor %}
</div>
</td>
<td class="source-code">{{ highlighted_source }}</td>
</tr>
</table>
</div>
{{ highlighted_source }}</td>
{% endblock %}

View file

@ -13,6 +13,6 @@
{% if request.profile.id in submission.problem.editor_ids or perms.judge.edit_all_problem %}
<hr style="float:left;width:30%"><br>
<h4>{{ _('Error information') }}</h4>
<code>{{ submission.error|highlight('pytb', linenos=False) }}</code>
<code>{{ submission.error|highlight('pytb', linenos=True) }}</code>
{% endif %}
{% endif %}

View file

@ -1,64 +0,0 @@
{% extends "submission/info-base.html" %}
{% block media %}
<style>
.line {
position: relative;
}
.highlighter {
position: absolute;
width: 9999px;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
a:active .line .highlighter {
background: rgba(255, 212, 0, 0.48);
}
.copy-clipboard {
margin-top: 0;
}
</style>
{% endblock %}
{% block body %}
<div style="clear: both"></div>
<br>
<div><a href="{{ url('submission_status', submission.id) }}">{{ _('View status') }}</a></div>
<div><a href="{{ url('submission_source_raw', submission.id) }}">{{ _('View raw source') }}</a></div>
{% if request.user == submission.user.user or perms.judge.resubmit_other %}
<div><a href="{{ url('problem_submit', submission.problem.code, submission.id) }}">{{ _('Resubmit') }}</a></div>
{% endif %}
{% if perms.judge.rejudge_submission %}
<div>
<form action="{{ url('submission_rejudge') }}" method="post">
{% csrf_token %}
<a href="#" onclick="parentNode.submit()">{{ _('Rejudge') }}</a>
<input type="hidden" name="id" value="{{ submission.id }}">
<input type="hidden" name="path" value="{{ url('submission_status', submission.id) }}">
</form>
</div>
{% endif %}
<br>
<hr>
<br>
<div class="source-wrap">
<table style="width: 100%">
<tr>
<td class="source-ln" style="width: 0">
<div>
{% for line in raw_source.split('\n') %}
<a href="#line-{{ loop.index }}" name="line-{{ loop.index }}">
<pre class="line">{{ loop.index }}</pre>
</a>
{% endfor %}
</div>
</td>
<td class="source-code">{{ highlighted_source }}</td>
</tr>
</table>
</div>
{% endblock %}

View file

@ -135,7 +135,7 @@
{% block body %}
<div style="clear: both"></div>
<br>
{% if request.user == submission.user.user or perms.judge.resubmit_other %}
{% if request.profile == submission.user or perms.judge.resubmit_other %}
<div><a href="{{ url('problem_submit', submission.problem.code, submission.id) }}">{{ _('Resubmit') }}</a></div>
{% endif %}
{% if perms.judge.rejudge_submission %}
@ -151,21 +151,8 @@
<br>
<h3 id="source-header" class="toggle closed"><i class="fa fa-chevron-right fa-fw"></i>{{_('Source code')}}</h3>
<div class="source-wrap toggled" style="display: none; margin-bottom: 1em">
<table style="width: 100%">
<tr>
<td class="source-ln" style="width: 0">
<div>
{% for line in raw_source.split('\n') %}
<a href="#line-{{ loop.index }}" name="line-{{ loop.index }}">
<pre class="line">{{ loop.index }}</pre>
</a>
{% endfor %}
</div>
</td>
<td class="source-code">{{ highlighted_source }}</td>
</tr>
</table>
<div class="toggled" style="display: none; margin-bottom: 1em">
{{ highlighted_source }}
</div>
<div id="test-cases">{% include "submission/status-testcases.html" %}</div>