mirror of
https://gitlab.com/CodeSolutionsProject/CodeShare.git
synced 2026-02-14 17:11:34 +01:00
Double-click select add
This commit is contained in:
@@ -14,9 +14,9 @@
|
||||
<meta name="description" content="{{ page.description }}"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<script src="{{ path.js }}/highlight.pack.js"></script>
|
||||
<script src="{{ path.js }}/functions.js"></script>
|
||||
<script src="{{ path.js }}/jquery-3.2.1.min.js"></script>
|
||||
<script src="{{ path.js }}/bootstrap.min.js"></script>
|
||||
<script src="{{ path.js }}/functions.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
{% include 'nav.twig' %}
|
||||
|
||||
@@ -172,11 +172,11 @@
|
||||
var extlib = document.getElementById("extlib");
|
||||
extlib.onkeyup=verRequired;
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
{#<script type="text/javascript">
|
||||
var webpageid = 6; /* Webpage id, in all your website,the same */
|
||||
var uniqueid = 0; /* Post/url id, every site you want different comments, an unique ID, 0 as default */
|
||||
</script>
|
||||
<script src="http://qozu.jkanetwork.com/comments.js"></script>
|
||||
<script src="http://qozu.jkanetwork.com/comments.js"></script>#}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<pre><code class='{{ code.lang }} codeto'>{{ code.code }}</code></pre>
|
||||
<pre class="highlight"><code class='{{ code.lang }} codeto'>{{ code.code }}</code></pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -117,4 +117,29 @@ function selectAll() {
|
||||
}
|
||||
}
|
||||
getAjax();
|
||||
}
|
||||
}
|
||||
|
||||
//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();
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user