Skip to content

Commit

Permalink
Remove text select javascript, closes joshbuchea#141
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbuchea committed Sep 15, 2016
1 parent 19e4127 commit 4cd6e5c
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,5 @@ <h1 class="site__title">{{ site.title | xml_escape }}</h1>
</div>
</div>
</body>

<!-- <script src="js/script.js"></script> -->
<script>

// highlight text in code blocks when clicked
var codeBlocks = document.querySelectorAll('.highlighter-rouge code');
var codeBlocksLength = codeBlocks.length;
var i;

for (i = 0; i < codeBlocksLength; i++) {
codeBlocks[i].addEventListener('click', function() {
clip(this);
}, false);
}

var clip = function(el) {
var range = document.createRange();
var sel = window.getSelection();

range.selectNodeContents(el);

sel.removeAllRanges();
sel.addRange(range);
};

// open external links in new tab
var links = document.links;
var linksLength = links.length;
var i;

for (i = 0; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].rel = 'noopener noreferrer';
links[i].target = '_blank';
}
}

</script>
{% include analytics.html %}
</html>

0 comments on commit 4cd6e5c

Please sign in to comment.