Skip to content

Commit

Permalink
remove comment and fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vengi717 committed Apr 30, 2024
1 parent faf8e1e commit 3c47132
Show file tree
Hide file tree
Showing 7 changed files with 23,654 additions and 4,841 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ document.getElementById('procaptcha-script').addEventListener('load', function (
function onCaptchaVerified(output) {
console.log('Captcha verified, output: ' + JSON.stringify(output))
}

// Get the Element using elementId
const captchaContainer = document.getElementById('procaptcha-container');
const captchaContainer = document.getElementById('procaptcha-container')
// Render the CAPTCHA explicitly on a container with id "procaptcha-container"
window.procaptcha.render(captchaContainer, {
siteKey: 'YOUR_SITE_KEY',
Expand All @@ -118,7 +118,7 @@ following fields:
| Key | Type | Description | Required |
| ---------------------- | -------- | -------------------------------------------------------------------------------------------------------- | -------- |
| siteKey | string | The site key of your application / website. This is required. ||
| callback | function | The function that will be called when the CAPTCHA is verified. ||
| callback | function | The function that will be called when the CAPTCHA is verified. ||
| theme | string | The theme of the CAPTCHA widget. The default is `light`. The other option is `dark`. ||
| captchaType | string | The type of CAPTCHA to render. The default is `frictionless`. Other options are `image`, `pow`. ||
| chalexpired-callback | string | The name of the window function that will be called when the CAPTCHA challenge expires. ||
Expand Down Expand Up @@ -274,7 +274,7 @@ document.getElementById('procaptcha-script').addEventListener('load', function (
console.log('Captcha verified, output: ' + JSON.stringify(output))
}
// Get the Element using elementId
const captchaContainer = document.getElementById('procaptcha-container');
const captchaContainer = document.getElementById('procaptcha-container')
window.procaptcha.render(captchaContainer, {
siteKey: 'YOUR_SITE_KEY',
theme: 'dark',
Expand Down Expand Up @@ -304,7 +304,7 @@ document.getElementById('procaptcha-script').addEventListener('load', function (
console.log('Captcha verified, output: ' + JSON.stringify(output))
}
// Get the Element using elementId
const captchaContainer = document.getElementById('procaptcha-container');
const captchaContainer = document.getElementById('procaptcha-container')
window.procaptcha.render(captchaContainer, {
siteKey: 'YOUR_SITE_KEY',
theme: 'dark',
Expand Down Expand Up @@ -333,7 +333,7 @@ document.getElementById('procaptcha-script').addEventListener('load', function (
console.log('Captcha verified, output: ' + JSON.stringify(output))
}
// Get the Element using elementId
const captchaContainer = document.getElementById('procaptcha-container');
const captchaContainer = document.getElementById('procaptcha-container')
window.procaptcha.render(captchaContainer, {
siteKey: 'YOUR_SITE_KEY',
theme: 'dark',
Expand Down
4 changes: 2 additions & 2 deletions demos/client-bundle-example/src/frictionless.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const render = (await import('./assets/procaptcha.bundle')).render
console.log('Captcha loaded')
// Get the Element using elementId
const captchaContainer = document.getElementById('procaptcha-container');
const captchaContainer = document.getElementById('procaptcha-container')
render(captchaContainer, {
siteKey: '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw',
theme: 'dark',
Expand All @@ -25,7 +25,7 @@
<script
id="procaptchaScript"
type="module"
src="./assets/procaptcha.bundle.js?onload=captchaLoaded&render=explicit"
src="./procaptcha.bundle.js?onload=captchaLoaded&render=explicit"
async
defer
></script>
Expand Down
2 changes: 1 addition & 1 deletion demos/client-bundle-example/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}

// Get the Element using elementId
const captchaContainer = document.getElementById('procaptcha-container');
const captchaContainer = document.getElementById('procaptcha-container')
// Render the CAPTCHA explicitly on a container with id "procaptcha-container"
render(captchaContainer, {
siteKey: '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw',
Expand Down
2 changes: 1 addition & 1 deletion demos/client-bundle-example/src/urlParams.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const render = (await import('./assets/procaptcha.bundle')).render
console.log('Captcha loaded')
// Get the Element using elementId
const captchaContainer = document.getElementById('procaptcha-container');
const captchaContainer = document.getElementById('procaptcha-container')
render(captchaContainer, {
siteKey: '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw',
theme: 'dark',
Expand Down
2 changes: 1 addition & 1 deletion packages/procaptcha-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@rollup/plugin-typescript": "^11.1.2",
"@vitejs/plugin-react": "^4.2.1",
"tslib": "2.6.2",
"typescript": "5.1.6",
"typescript": "^5.1.6",
"webpack-merge": "^5.9.0"
}
}
10 changes: 2 additions & 8 deletions packages/procaptcha-bundle/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const renderLogic = (
config: ProcaptchaClientConfigInput,
renderOptions?: ProcaptchaRenderOptions
) => {
elements.forEach((element) => { // || element.getAttribute('data-callback')
elements.forEach((element) => {
const callbackName = renderOptions?.callback
const chalExpiredCallbackName =
renderOptions?.['chalexpired-callback'] || element.getAttribute('data-chalexpired-callback')
Expand Down Expand Up @@ -197,12 +197,6 @@ const implicitRender = () => {
// Explicit render for targeting specific elements
export const render = (element: Element, renderOptions: ProcaptchaRenderOptions) => {
const siteKey = renderOptions.siteKey
// const element = document.getElementById(elementId)

if (!element) {
console.error('Element not found:', element)
return
}

renderLogic([element], getConfig(siteKey), renderOptions)
}
Expand Down Expand Up @@ -242,4 +236,4 @@ if (onloadUrlCallback) {
getProcaptchaScript()?.addEventListener('load', () => {
ready(onloadCallback)
})
}
}
Loading

0 comments on commit 3c47132

Please sign in to comment.