diff --git a/submissions/templates/submissions/reports_pdf_compile.html b/submissions/templates/submissions/reports_pdf_compile.html index 4caf7ba1d7cc677e9299aa26dd367a5cf88c6816..ec589e3041a93937562bb617f1c15aa68bd8b8a5 100644 --- a/submissions/templates/submissions/reports_pdf_compile.html +++ b/submissions/templates/submissions/reports_pdf_compile.html @@ -24,7 +24,7 @@ <div class="row"> <div class="col-12"> <h3>Please process this code in your Tex Compiler:</h3> - <pre><code>{% include 'submissions/_report_tex_template.html' with report=report %}</code></pre> + <pre class="clickfocus"><code>{% include 'submissions/_report_tex_template.html' with report=report %}</code></pre> </div> </div> @@ -38,4 +38,36 @@ </form> </div> </div> + +<script> + jQuery.fn.selectText = function(){ + this.find('input').each(function() { + if($(this).prev().length == 0 || !$(this).prev().hasClass('p_copy')) { + $('<p class="p_copy" style="position: absolute; z-index: -1;"></p>').insertBefore($(this)); + } + $(this).prev().html($(this).val()); + }); + var doc = document; + var element = this[0]; + + if (doc.body.createTextRange) { + var range = document.body.createTextRange(); + range.moveToElementText(element); + range.select(); + } else if (window.getSelection) { + var selection = window.getSelection(); + var range = document.createRange(); + range.selectNodeContents(element); + selection.removeAllRanges(); + selection.addRange(range); + } + }; + + $(function() { + $('.clickfocus').on('click', function() { + $(this).find('code').selectText(); + }); + }); +</script> + {% endblock %}