Skip to content

Commit

Permalink
add fa icon to copy.js
Browse files Browse the repository at this point in the history
  • Loading branch information
oraNod committed Mar 4, 2022
1 parent da4c2a6 commit 0e5e298
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions assets/javascript/copy.js
Expand Up @@ -2,8 +2,7 @@ window.onload = function() {
var pre = document.getElementsByTagName('pre');
for (var i = 0; i < pre.length; i++) {
var b = document.createElement('button');
b.className = 'clipboard';
b.textContent = 'Copy';
b.className = 'clipboard fa fa-clipboard';
if (pre[i].childNodes.length === 1 && pre[i].childNodes[0].nodeType === 3) {
var div = document.createElement('div');
div.textContent = pre[i].textContent;
Expand All @@ -25,9 +24,9 @@ window.onload = function() {
});
clipboard.on('success', function(e) {
e.clearSelection();
e.trigger.textContent = 'Copied';
e.trigger.className = e.trigger.className.replace("fa-clipboard", "fa-check");
setTimeout(function() {
e.trigger.textContent = 'Copy';
e.trigger.textContent = 'Copied';
}, 2000);
});
clipboard.on('error', function(e) {
Expand Down

0 comments on commit 0e5e298

Please sign in to comment.