Last active
September 25, 2017 21:09
-
-
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.
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
<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