58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
var $qs = function (s) { return window.document.querySelector(s); };
|
|
var $qsa = function (s) { return window.document.querySelectorAll(s); };
|
|
var info = {};
|
|
var steps = {};
|
|
var i = 1;
|
|
|
|
//$qs('.js-acme-directory-url').value = 'https://acme-v02.api.letsencrypt.org/directory';
|
|
$qs('.js-acme-directory-url').value = 'https://acme-staging-v02.api.letsencrypt.org/directory';
|
|
|
|
function hideForms() {
|
|
$qsa('.js-acme-form').forEach(function (el) {
|
|
el.hidden = true;
|
|
});
|
|
}
|
|
|
|
$qs('.js-acme-form-domains').addEventListener('submit', function (ev) {
|
|
ev.preventDefault();
|
|
info.identifiers = $qs('.js-acme-domains').value.split(/,/g).map(function (hostname) {
|
|
return { type: 'dns', value: hostname.trim() };
|
|
});
|
|
|
|
return BACME.directory($qs('.js-acme-directory-url').value).then(function () {
|
|
i += 1;
|
|
steps[i]();
|
|
});
|
|
});
|
|
|
|
steps[1] = function () {
|
|
hideForms();
|
|
$qs('.js-acme-form-domains').hidden = false;
|
|
};
|
|
|
|
steps[2] = function () {
|
|
hideForms();
|
|
$qs('.js-acme-form-account').hidden = false;
|
|
};
|
|
|
|
steps[3] = function () {
|
|
hideForms();
|
|
$qs('.js-acme-form-challenges').hidden = false;
|
|
};
|
|
|
|
steps[4] = function () {
|
|
hideForms();
|
|
$qs('.js-acme-form-poll').hidden = false;
|
|
}
|
|
|
|
steps[5] = function () {
|
|
hideForms();
|
|
$qs('.js-acme-form-download').hidden = false;
|
|
}
|
|
|
|
steps[1]();
|
|
}());
|