Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cahva/e44800dd2334063f3b758881b675057e to your computer and use it in GitHub Desktop.
Save cahva/e44800dd2334063f3b758881b675057e to your computer and use it in GitHub Desktop.
Redirects to the event page after agreeing to disclaimer
<script src="https://getvideosync.com/js/vs-helpers.js"></script>
<script>
var isRegister = window.location.href.indexOf('register') > -1;
if (isRegister) {
waitForElement('.modal', handleModalClose);
}
function handleModalClose(modalNode) {
var config = {
childList: true
};
var callback = function callback(mutationsList, observer) {
for (var i = 0; i < mutationsList.length; i++) {
var mutation = mutationsList[i];
if (mutation.type === 'childList') {
if (mutation.removedNodes.length > 0) {
// Click the priv policy if its there (setting it to checked won't work)
var checkbox = document.querySelector('input[type=checkbox]');
if (checkbox) {
checkbox.click();
}
document.getElementById('submit-button').click();
observer.disconnect();
}
}
}
};
var observer = new MutationObserver(callback);
observer.observe(modalNode, config);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment