-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add minified version of code-copy.js to resources
- Loading branch information
1 parent
095d8aa
commit d2c0991
Showing
2 changed files
with
6 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
resources/_gen/assets/js/js/code-copy.js_d11fe7b62c27961c87ecd0f2490357b9.content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(function(){'use strict';if(!document.queryCommandSupported('copy')){return;} | ||
function flashCopyMessage(el,msg){el.textContent=msg;setTimeout(function(){el.textContent="Copy";},1000);} | ||
function selectText(node){var selection=window.getSelection();var range=document.createRange();range.selectNodeContents(node);selection.removeAllRanges();selection.addRange(range);return selection;} | ||
function addCopyButton(containerEl){var copyBtn=document.createElement("button");copyBtn.className="highlight-copy-btn";copyBtn.textContent="Copy";var codeEl=containerEl.firstElementChild;copyBtn.addEventListener('click',function(){try{var selection=selectText(codeEl);document.execCommand('copy');selection.removeAllRanges();flashCopyMessage(copyBtn,'Copied!')}catch(e){console&&console.log(e);flashCopyMessage(copyBtn,'Failed :\'(')}});containerEl.appendChild(copyBtn);} | ||
var highlightBlocks=document.getElementsByClassName('highlight');Array.prototype.forEach.call(highlightBlocks,addCopyButton);})(); |
1 change: 1 addition & 0 deletions
1
resources/_gen/assets/js/js/code-copy.js_d11fe7b62c27961c87ecd0f2490357b9.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Target":"js/code-copy.min.0b73c3e137ac0bb903c3a422bc6acc074838e8ebfb94de26a65197d62b436d15.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-C3PD4TesC7kDw6QivGrMB0g46Ov7lN4mplGX1itDbRU="}} |