diff --git a/Source/assets/html/base.twig b/Source/assets/html/base.twig index 8cdb3f4..a450500 100644 --- a/Source/assets/html/base.twig +++ b/Source/assets/html/base.twig @@ -14,9 +14,9 @@ - + {% include 'nav.twig' %} diff --git a/Source/assets/html/code.twig b/Source/assets/html/code.twig index 7fd0fbd..2a19135 100644 --- a/Source/assets/html/code.twig +++ b/Source/assets/html/code.twig @@ -172,11 +172,11 @@ var extlib = document.getElementById("extlib"); extlib.onkeyup=verRequired; - - + #} {% endblock %} {% block css %} diff --git a/Source/assets/html/codebox.twig b/Source/assets/html/codebox.twig index cac4668..b6efe7f 100644 --- a/Source/assets/html/codebox.twig +++ b/Source/assets/html/codebox.twig @@ -29,7 +29,7 @@ -
{{ code.code }}
+
{{ code.code }}
diff --git a/Source/assets/js/functions.js b/Source/assets/js/functions.js index 0173958..0af1baa 100644 --- a/Source/assets/js/functions.js +++ b/Source/assets/js/functions.js @@ -117,4 +117,29 @@ function selectAll() { } } getAjax(); -} \ No newline at end of file +} + +//From https://stackoverflow.com/questions/35297919/javascript-select-all-text-inside-a-pre-code-block-on-double-click +window.onload = function(){ + + document.body.addEventListener('dblclick', function(e){ + var target = e.target || e.srcElement; + if (target.className.indexOf("highlight") !== -1 || target.parentNode.className.indexOf("highlight") !== -1){ + var range, selection; + + if (document.body.createTextRange) { + range = document.body.createTextRange(); + range.moveToElementText(target); + range.select(); + } else if (window.getSelection) { + selection = window.getSelection(); + range = document.createRange(); + range.selectNodeContents(target); + selection.removeAllRanges(); + selection.addRange(range); + } + e.stopPropagation(); + } + + }); +}; \ No newline at end of file