Fix
parent
1261ad70b0
commit
4d1efbff7c
|
@ -54,7 +54,7 @@ class Snipt(models.Model):
|
|||
self.stylized = markdown(self.code, 'default')
|
||||
for match in re.findall('\[\[(.*)\]\]', self.stylized):
|
||||
self.stylized = self.stylized.replace('[[' + str(match) + ']]',
|
||||
'<script type="text/javascript" src="https://snipt.net/embed/{}"></script><div id="snipt-embed-{}"></div>'.format(match, match))
|
||||
'<script type="text/javascript" src="https://snipt.net/embed/{}/?snipt"></script><div id="snipt-embed-{}"></div>'.format(match, match))
|
||||
else:
|
||||
self.stylized = highlight(self.code,
|
||||
get_lexer_by_name(self.lexer, encoding='UTF-8'),
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{% if 'snipt.net' or 'snipt.localhost' in request.HTTP_REFERER %}$(function() {
|
||||
{% if 'snipt' in request.GET %}$(function() {
|
||||
$('div#snipt-embed-{{ snipt.key }}').html('<div onmouseover="document.getElementById(\'snipt-flag-{{ snipt.id }}\').style.display = \'block\'; return false;" onmouseout="document.getElementById(\'snipt-flag-{{ snipt.id }}\').style.display = \'none\'; return false;" style="position: relative;">{% for line in lines %}{{ line|safe }}\n{% endfor %}<div style="background-color: #111; color: #D0D0D0; float: right; padding: 5px 10px; -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; font: 11px Arial,Sans-Serif; display: none; position: absolute; bottom: 0; right: 0;" id="snipt-flag-{{ snipt.id }}">code hosted by <a href="https://snipt.net/{{ snipt.user }}/{{ snipt.slug }}{% if not snipt.public %}?key={{ snipt.key }}{% endif %}" style="color: #0084FF; text-decoration: none;">snipt.net</a></div></div>');
|
||||
});{% else %}document.open();document.writeln('<div onmouseover="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'block\'; return false;" onmouseout="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'none\'; return false;" style="position: relative;">');{% for line in lines %}document.writeln('{{ line|safe }}');{% endfor %}document.writeln('<div style="background-color: #111; color: #D0D0D0; float: right; padding: 5px 10px; -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; font: 11px Arial,Sans-Serif; display: none; position: absolute; bottom: 0; right: 0;" id="snipt-{{ snipt.id }}">code hosted by <a href="https://snipt.net/{{ snipt.user }}/{{ snipt.slug }}{% if not snipt.public %}?key={{ snipt.key }}{% endif %}" style="color: #0084FF; text-decoration: none;">snipt.net</a></div>');document.writeln('</div>');document.close();{% endif %}
|
||||
|
|
Loading…
Reference in New Issue