greenlock.html/js/app.js

33 lines
913 B
JavaScript
Raw Normal View History

2018-05-01 00:03:12 +00:00
(function () {
'use strict';
2018-05-01 08:15:41 +00:00
var $qs = function (s) { return window.document.querySelector(s); };
2018-07-26 21:12:33 +00:00
$qs('.js-javascript-warning').hidden = true;
2018-05-04 20:26:06 +00:00
var apiUrl = 'https://acme-{{env}}.api.letsencrypt.org/directory';
2019-05-22 08:45:19 +00:00
2018-05-04 20:26:06 +00:00
function updateApiType() {
var formData = new FormData($qs("#js-acme-form"));
2018-05-01 08:15:41 +00:00
console.log('ACME api type radio:');
2018-05-01 08:15:41 +00:00
var value = formData.get("acme-api-type");
$qs('#js-acme-api-url').value = apiUrl.replace(/{{env}}/g, value);
2018-05-04 23:59:05 +00:00
}
2019-05-22 08:45:19 +00:00
$qs('#js-acme-form').addEventListener('change', updateApiType);
2019-05-22 08:45:19 +00:00
//$qs('#js-acme-form').addEventListener('submit', prettyRedirect);
2018-05-04 23:59:05 +00:00
updateApiType();
try {
document.fonts.load().then(function() {
$qs('body').classList.add("js-app-ready");
2019-05-22 08:45:19 +00:00
}).catch(function(e) {
$qs('body').classList.add("js-app-ready");
});
} catch(e) {
setTimeout(function() {$qs('body').classList.add("js-app-ready");}, 200);
2018-05-01 08:15:41 +00:00
}
2018-05-01 00:03:12 +00:00
}());