Optimize remote follow script performance

This commit is contained in:
Craftplacer 2020-07-24 10:39:46 +02:00
parent a68d01de85
commit ae563a614f
1 changed files with 18 additions and 12 deletions

View File

@ -1,15 +1,21 @@
const form = document.getElementById("followForm");
form.addEventListener("submit", function (e) {
e.preventDefault();
var urlField = document.getElementById("instanceUrl");
var url = document.createElement('a');
url.href = urlField.value;
function initializeForm() {
const form = document.getElementById("followForm");
var followUrl = "https://" + url.hostname + "/ostatus_subscribe?acct=https://enigmatic.observer/users/Husky";
form.addEventListener("submit", function (e) {
e.preventDefault();
var urlField = document.getElementById("instanceUrl");
var url = document.createElement('a');
url.href = urlField.value;
window.location = followUrl;
});
var followUrl = "https://" + url.hostname + "/ostatus_subscribe?acct=https://enigmatic.observer/users/Husky";
const followButton = document.getElementById("followButton");
followButton.disabled = false;
window.location = followUrl;
});
// we enable the button to indicate that the form is working and accepts input.
const followButton = document.getElementById("followButton");
followButton.disabled = false;
}
document.addEventListener("DOMContentLoaded", initializeForm);