mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 11:51:27 -08:00
28 lines
No EOL
766 B
JavaScript
28 lines
No EOL
766 B
JavaScript
// fires after DOM is ready for manipulation
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
setupCommunityNameInput();
|
|
});
|
|
|
|
|
|
// fires after all resources have loaded, including stylesheets and js files
|
|
window.addEventListener("load", function () {
|
|
|
|
});
|
|
|
|
|
|
function setupCommunityNameInput() {
|
|
var communityNameInput = document.getElementById('community_name');
|
|
|
|
if (communityNameInput) {
|
|
communityNameInput.addEventListener('keyup', function() {
|
|
var urlInput = document.getElementById('url');
|
|
urlInput.value = titleToURL(communityNameInput.value);
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function titleToURL(title) {
|
|
// Convert the title to lowercase and replace spaces with hyphens
|
|
return title.toLowerCase().replace(/\s+/g, '-');
|
|
} |