Skip to content

Commit

Permalink
External package not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
BernatBC committed Aug 31, 2024
1 parent 62f9b68 commit 8fe6d54
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions assets/scripts/features/copyCode/copyCode.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
if (navigator && navigator.clipboard) {
addCopyButtons(navigator.clipboard)
} else {
const script = document.createElement('script')
script.src =
'https://cdnjs.cloudflare.com/ajax/libs/clipboard-polyfill/2.7.0/clipboard-polyfill.promise.js'
script.integrity = 'sha256-waClS2re9NUbXRsryKoof+F9qc1gjjIhc2eT7ZbIv94='
script.crossOrigin = 'anonymous'
script.onload = function () {
addCopyButtons(clipboard)
}

document.body.appendChild(script)
}
addCopyButtons(navigator.clipboard)

function addCopyButtons(clipboard) {
document.querySelectorAll('pre > code').forEach(function (codeBlock) {
Expand Down

0 comments on commit 8fe6d54

Please sign in to comment.