Skip to content

Commit 0d9391a

Browse files
authored
Add agreement checkboxes (#58)
1 parent cb887c9 commit 0d9391a

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

static/index.html

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@
138138
color: #949494;
139139
}
140140

141+
.agreements {
142+
text-align: left;
143+
margin-top: 25px;
144+
line-height: 1.4em;
145+
color: #555;
146+
font-size: 14px;
147+
}
148+
141149
.queued {
142150
display: flex;
143151
flex-direction: column;
@@ -220,8 +228,16 @@
220228
<div>Waiting until more tokens are available</div>
221229
</div>
222230
</div>
231+
<div id="agreements" class="agreements">
232+
<input type="checkbox" id="agreement1" name="agreement1">
233+
<label for="agreement1"> I acknowledge that this faucet is <u><b class="bold">only used for testing</b></u>.</label><br>
234+
<input type="checkbox" id="agreement2" name="agreement2">
235+
<label for="agreement2"> I acknowledge that there are <u><b class="bold">no incentives</b></u> to using this faucet.</label><br>
236+
<input type="checkbox" id="agreement3" name="agreement3">
237+
<label for="agreement3"> I agree not to spam this faucet, and know that I will be blocked if I do.</label><br>
238+
</div>
223239
<div id="response-failure"></div>
224-
<input type="submit" value="Give me Ether" class="button" />
240+
<input type="submit" disabled="true" value="Give me Test Ether" class="button" />
225241
</form>
226242
<div id="response">
227243
<h2 class="response-title">Test Ether sent to the wallet</h2>
@@ -243,6 +259,17 @@ <h2 class="response-title">Test Ether sent to the wallet</h2>
243259
}
244260
}
245261

262+
let agreements = document.getElementById('agreements');
263+
function hasAgreed() {
264+
let inputs = agreements.getElementsByTagName('input');
265+
let inputsList = Array.prototype.slice.call(inputs);
266+
return inputsList.every(i => i.checked);
267+
}
268+
269+
agreements.onchange = function() {
270+
form.querySelector("input[type=submit]").disabled = !hasAgreed();
271+
};
272+
246273
function hasCaptcha() {
247274
return !!document.getElementsByClassName("captcha-container")[0];
248275
}
@@ -260,7 +287,7 @@ <h2 class="response-title">Test Ether sent to the wallet</h2>
260287
document.getElementsByClassName("captcha-container")[0].classList.remove("hidden");
261288
}
262289
document.getElementsByClassName("queued")[0].classList.add("hidden");
263-
form.querySelector("input[type=submit]").disabled = false;
290+
form.querySelector("input[type=submit]").disabled = !hasAgreed();
264291
}
265292

266293
function give_me_coins(form) {

0 commit comments

Comments
 (0)