From 64d8f91371ad6253e694c472a681e69474a3df94 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 4 Oct 2016 20:49:06 -0700 Subject: [PATCH] Add conditional logic for adding listener. --- ui/app/first-time/disclaimer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/app/first-time/disclaimer.js b/ui/app/first-time/disclaimer.js index 423d327ca..1c01718eb 100644 --- a/ui/app/first-time/disclaimer.js +++ b/ui/app/first-time/disclaimer.js @@ -62,9 +62,11 @@ DisclaimerScreen.prototype.render = function () { h('div.markdown', { onScroll: (e) => { var object = e.currentTarget - if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) { - var button = document.getElementById('agree') + var button = document.getElementById('agree') + if ((object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) && button.disabled) { button.disabled = false + button.innerHTML = 'I Agree' + console.log("YAHALLO") button.addEventListener('click', () => this.props.dispatch(actions.agreeToDisclaimer())) } }, @@ -89,7 +91,7 @@ DisclaimerScreen.prototype.render = function () { style: { marginTop: '18px' }, disabled: true, onClick: () => this.props.dispatch(actions.agreeToDisclaimer()), - }, 'I Agree'), + }, 'Scroll to Enable'), ]) ) }