From 27ae2aeb488de6aeff1654c28399e6315b231570 Mon Sep 17 00:00:00 2001 From: John Shaver Date: Thu, 13 Sep 2018 00:39:33 -0700 Subject: [PATCH] Fixed disabled button --- lib/extensions/admin/login/css/main.css | 2 +- lib/extensions/admin/login/js/app.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/extensions/admin/login/css/main.css b/lib/extensions/admin/login/css/main.css index 69414f2..cf705ec 100644 --- a/lib/extensions/admin/login/css/main.css +++ b/lib/extensions/admin/login/css/main.css @@ -85,7 +85,7 @@ button { margin: 1em 0; } -button[disabled=true] { +button:disabled { background-color: #d9d9d9; } diff --git a/lib/extensions/admin/login/js/app.js b/lib/extensions/admin/login/js/app.js index fdd4537..9751129 100644 --- a/lib/extensions/admin/login/js/app.js +++ b/lib/extensions/admin/login/js/app.js @@ -129,6 +129,20 @@ function init() { console.log(pair); submitCode(pair); }); + + var formElements = document.querySelector('.js-submit').elements; + for(var i = 0; i < formElements.length; ++i) { + var tosCheck = document.querySelector('[name=telebit-agree]'); + var leCheck = document.querySelector('[name=letsencrypt-agree]'); + var pairCodeInput = document.querySelector('[name=pair-code]'); + formElements[i].addEventListener('input', function(ev) { + if(tosCheck.checked && leCheck.checked && pairCodeInput.value.length) { + document.querySelector('.js-submit button').disabled = false; + } else { + document.querySelector('.js-submit button').disabled = true; + } + }); + }; } window.fetch('https://' + location.hostname + '/_apis/telebit.cloud/index.json', {