My previous post about the blockquote syntax highlighter. Complicated if we want copied code in the blockquote, especially if the code a lot. To make it easier to copy blocquote code, use the following script blockquote auto selection.
<script type='text/javascript'>
var pres = document.getElementsByTagName("blockquote");
for (var i = 0; i < pres.length; i++) {
pres[i].addEventListener("dblclick", function () {
var selection = getSelection();
var range = document.createRange();
range.selectNodeContents(this);
selection.removeAllRanges();
selection.addRange(range);
}, false);
}
</script>
Place that code above </body>
This script also applies to the pre tag. Replace it 'blockquote' with 'pre'
<script type='text/javascript'>
var pres = document.getElementsByTagName("pre");
for (var i = 0; i < pres.length; i++) {
pres[i].addEventListener("dblclick", function () {
var selection = getSelection();
var range = document.createRange();
range.selectNodeContents(this);
selection.removeAllRanges();
selection.addRange(range);
}, false);
}
</script>
Well done.
0 Comments:
Posting Komentar