Merge pull request #221 from CounterPillow/focus-report-field

Focus report reason text field when reporting
This commit is contained in:
Alex Ingram 2017-06-01 06:30:57 -05:00 committed by GitHub
commit 91a9264442
1 changed files with 17 additions and 1 deletions

View File

@ -200,4 +200,20 @@
</div>
</div>
{% endblock %}
<script type="text/javascript">
var target = document.getElementById('torrent-description');
var text = target.innerHTML;
var reader = new commonmark.Parser({safe: true});
var writer = new commonmark.HtmlRenderer({safe: true, softbreak: '<br />'});
var parsed = reader.parse(text.trim());
target.innerHTML = writer.render(parsed);
</script>
<script>
// Focus the report text field once the modal is opened.
$('#reportModal').on('shown.bs.modal', function () {
$('#reason').focus();
})
</script>
{% endblock %}