Skip to content

Commit

Permalink
Bolster up included script some more (OpenUserJS#1874)
Browse files Browse the repository at this point in the history
Post OpenUserJS#944

Auto-merge
  • Loading branch information
Martii authored Dec 8, 2021
1 parent e04e822 commit 77b7fef
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions views/includes/scripts/loginEcho.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script type="text/javascript"{{#nonce}} nonce="{{nonce}}"{{/nonce}}>
(function () {

var captcha = document.querySelector('div.h-captcha');

// NOTE: Keep in sync with helper
function cleanFilename(aFilename, aDefaultName) {
// Blacklist problem characters (slashes, colons, etc.).
Expand All @@ -17,7 +19,6 @@
var auth = document.querySelector('select[name="auth"]');
var consent = document.querySelector('input[name="consent"]');
var action = document.querySelector('button#action');
var captcha = document.querySelector('div.h-captcha');

function onInput(aEv) {
var req = new XMLHttpRequest();
Expand Down Expand Up @@ -80,11 +81,26 @@
if (username && auth && action) {
action.innerHTML = action.innerHTML.replace(/Next/, 'Sign Up');

username.addEventListener('input', onInput);
username.addEventListener('input', onInput, {
capture : true,
passive : true
});
}
}

document.addEventListener('DOMContentLoaded', onDOMContentLoaded);
if (captcha) {
setInterval(function () {
if (captcha && captcha.hasChildNodes()) {
captcha.removeAttribute('class');
captcha.removeAttribute('data-sitekey');
}
}, 1);
}

document.addEventListener('DOMContentLoaded', onDOMContentLoaded, {
capture : true,
passive : true
});

})();
</script>

0 comments on commit 77b7fef

Please sign in to comment.