mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 01:55:40 +00:00
add-data rendering & clipboard takes element
This commit is contained in:
@@ -28,7 +28,7 @@ const index = () => {
|
||||
document.querySelector(`.${SECRET_COPY_ICON}`)
|
||||
);
|
||||
const writeText = secretElement.dataset.secret;
|
||||
new CopyIcon(writeText, SECRET_COPY_ICON, SECRET_COPY_DONE_ICON);
|
||||
new CopyIcon(writeText, secretElement, SECRET_COPY_DONE_ICON);
|
||||
};
|
||||
|
||||
export default index;
|
||||
|
||||
@@ -20,13 +20,14 @@ const SITEKEY_COPY_ICON = `sitekey__copy-icon`;
|
||||
const SITEKEY_COPY_DONE_ICON = `sitekey__copy-done-icon`;
|
||||
|
||||
export const index = () => {
|
||||
const image = <HTMLElement>document.querySelector(`.${SITEKEY_COPY_ICON}`);
|
||||
if (!image.classList.contains(SITEKEY_COPY_ICON)) {
|
||||
throw new Error(
|
||||
'This method should only be called when sitekey copy button/icon is clicked',
|
||||
);
|
||||
}
|
||||
const sitekey = image.dataset.sitekey;
|
||||
|
||||
new CopyIcon(sitekey, SITEKEY_COPY_ICON, SITEKEY_COPY_DONE_ICON);
|
||||
const image = document.querySelectorAll(`.${SITEKEY_COPY_ICON}`);
|
||||
image.forEach((img: HTMLElement) => {
|
||||
if (!img.classList.contains(SITEKEY_COPY_ICON)) {
|
||||
throw new Error(
|
||||
'This method should only be called when sitekey copy button/icon is clicked',
|
||||
);
|
||||
}
|
||||
const sitekey = img.dataset.sitekey;
|
||||
new CopyIcon(sitekey, img, SITEKEY_COPY_DONE_ICON);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user