So Hello viewers and visitors welcome to Tech Aadi another article. How are you, I hope you guys are doing good and great.
Have you written any article while instructing code for your viewers to help them. Then you must know that for long codes the visitors may have got problem with the codes you have given.
Because the codes they will use they have to select and then copy it. But what if they will just double tab it and the codes in the box will be automatically copied.
Yeah that right what you read. Today we are going to Add Double Tab to Copy for Syntax Highlighter or CodeBox.
So let's start the adding process.
Before starting as always do backup your blog template for any kind of error and easy restoration.
Adding Double Tap to Copy for Syntax Highlighter
There is only one step you have to do so just be patience and follow the article till last. You won't regret it adding in your blog. Because it is very useful for Blogger's with tips and tutorials.
Steps
- Login to your Blogger dashboard.
- Click on theme section then edit HTML.
- Then search for this code
</body>
tag. - Copy and paste the below given code just before the
</body>
tag.
<!--[ 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>
Now click on save theme.
So after doing above steps I hope you have successfully installed the Double Tap to Copy for Syntax Highlighter in your blog. If you got any error kindly contact us.
Conclusion
Today we have discussed about How to Add Syntax Highlighter Double Tap to Copy. I hope you find this article very useful. Please like and follow our blog for more post like this daily.
Reference :
Tech With Deo