Skip to content

Instantly share code, notes, and snippets.

@salsalabs
Last active September 25, 2017 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salsalabs/3ce9a9f7da5ec4fdccf93334cca8e022 to your computer and use it in GitHub Desktop.
Save salsalabs/3ce9a9f7da5ec4fdccf93334cca8e022 to your computer and use it in GitHub Desktop.
Solution to block unwanted donors my automatically triggering the spam catcher. Using the spam catcher means that clients don't see the attack donations.
<meta name="special" content="badguy@thieves.bizi,fraudster@fraud.bizi,jingle@bells.bizi.uk">
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
if (document.querySelector('input[name=donate_page_KEY]') != null) {
document.querySelector('.salsa form').addEventListener('submit', function () {
var e = document.querySelector('input[name="Email"]');
var m = document.querySelector('*[name="special"]');
if (e != null && m != null) {
var list = (m.getAttribute('content') || '').split(',').map(function (x) { return x.trim(); });
if (list.indexOf(e.value.trim()) != -1) {
document.querySelector('input[name^="first_name"]').value = m.name;
}
}
return true;
});
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment