This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
media/plg_captcha_recaptcha/js/recaptcha.js (#112)
* converted to es6 * updated code to support IE * compile es6
- Loading branch information
1 parent
df1ba80
commit 25642a5
Showing
2 changed files
with
45 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @package Joomla.JavaScript | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
window.JoomlaInitReCaptcha2 = () => { | ||
'use strict'; | ||
|
||
const itemNodes = document.getElementsByClassName('g-recaptcha'); | ||
const items = [].slice.call(itemNodes); | ||
items.forEach((item) => { | ||
const options = item.dataset ? item.dataset : { | ||
sitekey: item.getAttribute('data-sitekey'), | ||
theme: item.getAttribute('data-theme'), | ||
size: item.getAttribute('data-size'), | ||
}; | ||
|
||
/* global grecaptcha */ | ||
grecaptcha.render(item, options); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
/** | ||
* @package Joomla.JavaScript | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION. | ||
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD. | ||
**/ | ||
|
||
/** | ||
* @package Joomla.JavaScript | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
window.JoomlaInitReCaptcha2 = function() { | ||
'use strict'; | ||
window.JoomlaInitReCaptcha2 = function () { | ||
'use strict'; | ||
|
||
var itemNodes = document.getElementsByClassName('g-recaptcha'); | ||
var items = [].slice.call(itemNodes); | ||
items.forEach(function (item) { | ||
var options = item.dataset ? item.dataset : { | ||
sitekey: item.getAttribute('data-sitekey'), | ||
theme: item.getAttribute('data-theme'), | ||
size: item.getAttribute('data-size') | ||
}; | ||
|
||
var items = document.getElementsByClassName('g-recaptcha'), item, options; | ||
for (var i = 0, l = items.length; i < l; i++) { | ||
item = items[i]; | ||
options = item.dataset ? item.dataset : { | ||
sitekey: item.getAttribute('data-sitekey'), | ||
theme: item.getAttribute('data-theme'), | ||
size: item.getAttribute('data-size') | ||
}; | ||
grecaptcha.render(item, options); | ||
} | ||
} | ||
/* global grecaptcha */ | ||
grecaptcha.render(item, options); | ||
}); | ||
}; |