![]() |
Adding Double Tap to Copy for Syntax Highlighter - CodeBox |
Hello, everyone! Wellcome to SoiPro .Today on this occasion I will going to share a tutorial about How to Add Double Click to Copy for CodeBox - Syntax Highlighter
As always, before starting, take a backup of your blog template to restore it easily in case of any kind of error .
Adding Double Tap to Copy for Syntax Highlighter
You have to follow only one step, just be patient and follow the post till the last. You will not regret after adding it to your blog. Because it is very useful for bloggers and for user interface.
Follow these steps carefully
arrow down
icon next to 'customize' button.Ctrl + F
to find the code </body>
and paste the following JavaScript Codes given below. <!--[ Double click to Copy ]-->
<script > /*<![CDATA[*/
for (var preclick = document.getElementsByTagName('pre'), i = 0; i < preclick.length; i++) preclick[i].addEventListener('dblclick', function () {
var e = getSelection(),
t = document.createRange();
t.selectNodeContents(this), e.removeAllRanges(), e.addRange(t), document.execCommand('copy'), this.classList.add('copied'), setTimeout(() => {
window.getSelection().removeAllRanges(), this.classList.remove('copied')
}, 4e3)
}, !1); /*]]>*/ < /script>
So after following the above steps, I hope that you have successfully installed Syntax Highlighter Scripts to be copied by double tabbing in your blog. If you are facing any problem then you can comment below, you will definitely be helped by replying.
Conclusion
Source:
www.soipro.com