huskyapp.dev/scripts/remote-follow.js

21 lines
674 B
JavaScript

function initializeForm() {
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;
var followUrl = "https://" + url.hostname + "/ostatus_subscribe?acct=https://enigmatic.observer/users/Husky";
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);