Refactor to copy button script
This commit is contained in:
parent
0847809834
commit
7fe413d720
@ -1,10 +1,10 @@
|
|||||||
import clickableMaker from "./clickable-maker";
|
import clickableMaker from "./clickable-maker";
|
||||||
import codeBlockFormatter from "./code-block-formatter";
|
import copyButton from "./copy-button";
|
||||||
import tabbed from "./tabbed";
|
import tabbed from "./tabbed";
|
||||||
import _ from "./lunr";
|
import _ from "./lunr";
|
||||||
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
clickableMaker();
|
clickableMaker();
|
||||||
codeBlockFormatter();
|
copyButton();
|
||||||
tabbed();
|
tabbed();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,6 +2,7 @@ export default function() {
|
|||||||
Array.from(document.querySelectorAll('[data-copy-button=true]')).forEach(e => {
|
Array.from(document.querySelectorAll('[data-copy-button=true]')).forEach(e => {
|
||||||
const copyButton = document.createElement('button');
|
const copyButton = document.createElement('button');
|
||||||
copyButton.classList.add('copy-button');
|
copyButton.classList.add('copy-button');
|
||||||
|
copyButton.title = "Click to copy";
|
||||||
|
|
||||||
copyButton.addEventListener('click', () => {
|
copyButton.addEventListener('click', () => {
|
||||||
const addTemporaryClass = (className, time) => {
|
const addTemporaryClass = (className, time) => {
|
||||||
Loading…
Reference in New Issue
Block a user