diff --git a/legacy/fediverso-script.js b/legacy/fediverso-script.js new file mode 100644 index 0000000..c6aa37f --- /dev/null +++ b/legacy/fediverso-script.js @@ -0,0 +1,23 @@ +// ⚠️ LEGACY FILE - NON PIÙ UTILIZZATO +// Questo file è mantenuto solo per riferimento storico. +// Il JavaScript è ora integrato direttamente in fediverso-box.php + +document.addEventListener('DOMContentLoaded', function () { + var form = document.getElementById('fediFollowForm'); + if (!form) return; + form.onsubmit = function (e) { + e.preventDefault(); + var input = document.getElementById('fediUserInput').value.trim().toLowerCase(); + + // Permetti solo il dominio dell'istanza, es: mastodon.uno + var match = input.match(/^[a-z0-9.-]+\.[a-z]{2,}$/i); + if (!match) { + alert('Inserisci solo il dominio della tua istanza Mastodon (es: mastodon.uno)'); + return false; + } + + var url = 'https://' + input + '/authorize_interaction?uri=emanuelegori@emanuelegori.uno'; + window.open(url, '_blank'); + return false; + }; +}); \ No newline at end of file