External package not needed
This commit is contained in:
parent
62f9b68a16
commit
8fe6d54cac
1 changed files with 1 additions and 14 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue