$(document).ready(function(){function e(t,s,a){$(t).on("click",'button[type="submit"]',{passive:!0},function(e){e.preventDefault();e=$(s).val();$.ajax({url:"includes/post_settings.php",method:"POST",data:{formId:t,newValue:e},success:function(e){$(t)[0].reset(),$(t).find(".form-control").removeClass("is-invalid"),$(t).find(".invalid-feedback").hide(),$(".success-message").text(a),$(".toast").toast("show"),$(t).closest(".modal").modal("hide"),setTimeout(function(){location.reload()},1500)},error:function(){alert("An error occurred while updating the setting.")}})})}e("#editUsernameForm","#newUsername","Username updated successfully."),e("#editNameForm","#newName","Name updated successfully."),e("#editAvatarForm","#newAvatar","Avatar updated successfully."),e("#editPasswordForm","#newPassword","Password updated successfully."),e("#editConfigurationForm","#enableNotifications","Configuration updated successfully."),e("#editEndpointForm","#newEndpoint","Endpoint updated successfully."),e("#editCSSForm","#newCSS","Custom CSS updated successfully."),e("#editJSForm","#newJS","Custom JavaScript updated successfully.")});