remove var

This commit is contained in:
Freya Murphy 2024-04-03 11:35:13 -04:00
parent a50b7cd3bc
commit ddfe92fee4
Signed by: freya
GPG key ID: 744AB800E383AE52
5 changed files with 40 additions and 40 deletions

View file

@ -48,8 +48,8 @@
</div> </div>
<script> <script>
var onLogin = function(data) { const onLogin = function(data) {
var jwt = data.token; let jwt = data.token;
$.ajax({ $.ajax({
url: '/auth/update', url: '/auth/update',
@ -66,13 +66,13 @@
$('#action-login').on('submit', function(e) { $('#action-login').on('submit', function(e) {
e.preventDefault(); e.preventDefault();
var username = $('#login-username').val(); let username = $('#login-username').val();
var password = $('#login-password').val(); let password = $('#login-password').val();
$.ajax({ $.ajax({
url: '/api/rpc/login', url: '/api/rpc/login',
method: 'POST', method: 'POST',
data: JSON.stringify({ username: username, password: password }), data: JSON.stringify({ username, password }),
success: onLogin success: onLogin
}); });
}); });

View file

@ -31,27 +31,27 @@
var urlParams = new URLSearchParams(window.location.search).toString(); var urlParams = new URLSearchParams(window.location.search).toString();
$('#action-load-users').on('click', function() { $('#action-load-users').on('click', function() {
var me = $(this); let me = $(this);
var page = me.attr('page'); let page = me.attr('page');
if (!page) { if (!page) {
page = '1'; page = '1';
} }
var newPage = Number(page) + 1; let newPage = Number(page) + 1;
me.attr('page', newPage + ''); me.attr('page', newPage + '');
var loaded = Number(me.attr('loaded')); let loaded = Number(me.attr('loaded'));
var pageSize = Number(me.attr('pageSize')); let pageSize = Number(me.attr('pageSize'));
var userCount = Number(me.attr('userCount')); let userCount = Number(me.attr('userCount'));
var userMax = Number(me.attr('userMax')); let userMax = Number(me.attr('userMax'));
var url = '/people/people?page=' + page + '&max=' + userMax + '&' + urlParams; let url = '/people/people?page=' + page + '&max=' + userMax + '&' + urlParams;
$.get(url, function (data) { $.get(url, function (data) {
if (data === '') { if (data === '') {
me.remove(); me.remove();
return; return;
} }
var container = $('#people-container'); let container = $('#people-container');
container.append(data); container.append(data);
loaded += pageSize; loaded += pageSize;

View file

@ -1,5 +1,5 @@
<?php /* Copyright (c) 2024 Freya Murphy */ ?> <?php /* Copyright (c) 2024 Freya Murphy */ ?>
<?php /* vi: syntax=php */ ?> <?php /* vim: syntax=php */ ?>
<?php <?php
$self = $this->main->user(); $self = $this->main->user();
$this->view('header_empty', $data); $this->view('header_empty', $data);
@ -55,7 +55,7 @@
</div> </div>
<script> <script>
$('#action-hamburger').on('click', function() { $('#action-hamburger').on('click', function() {
var menu = $('.nav-center'); let menu = $('.nav-center');
menu.toggleClass('visible'); menu.toggleClass('visible');
}); });
</script> </script>

View file

@ -31,18 +31,18 @@
<script> <script>
$('#new-post-form').submit(function(e) { $('#new-post-form').submit(function(e) {
e.preventDefault(); e.preventDefault();
var content = $('#new-post-content').val(); let content = $('#new-post-content').val();
var me = $(this); let me = $(this);
var getPost = function(data) { const getPost = function(data) {
if (data) { if (data) {
$('#post-container').prepend(data); $('#post-container').prepend(data);
} }
me.closest('.modal-container').remove(); me.closest('.modal-container').remove();
} }
var onPost = function(data) { const onPost = function(data) {
var id = data[0].id; let id = data[0].id;
$.get({ $.get({
url: '/_util/post/post?id=' + id, url: '/_util/post/post?id=' + id,
success: getPost success: getPost
@ -52,7 +52,7 @@
$.ajax({ $.ajax({
url: '/api/post', url: '/api/post',
method: 'POST', method: 'POST',
data: JSON.stringify({ content: content }), data: JSON.stringify({ content }),
success: onPost success: onPost
}); });
}); });

View file

@ -133,28 +133,28 @@
$('#register-form').submit(function(e) { $('#register-form').submit(function(e) {
e.preventDefault(); e.preventDefault();
var form = event.target; let form = event.target;
var formFields = form.elements; let formFields = form.elements;
var first_name = formFields.first_name.value.trim(); let first_name = formFields.first_name.value.trim();
var last_name = formFields.last_name.value.trim(); let last_name = formFields.last_name.value.trim();
var username = formFields.username.value.trim(); let username = formFields.username.value.trim();
var password = formFields.password.value.trim(); let password = formFields.password.value.trim();
var email = formFields.email.value.trim(); let email = formFields.email.value.trim();
var birth_date = formFields.birth_date.value.trim(); let birth_date = formFields.birth_date.value.trim();
var gender = formFields.gender.value.trim(); let gender = formFields.gender.value.trim();
if(birth_date === '') { if(birth_date === '') {
errorToast('toast_date_empty'); errorToast('toast_date_empty');
return; return;
} }
var onSuccess = function() { const onSuccess = function() {
$.ajax({ $.ajax({
url: '/api/rpc/login', url: '/api/rpc/login',
method: 'POST', method: 'POST',
data: JSON.stringify({ data: JSON.stringify({
username: username, password: password username, password
}), }),
success: onLogin success: onLogin
}); });
@ -164,13 +164,13 @@
url: '/api/user', url: '/api/user',
method: 'POST', method: 'POST',
data: JSON.stringify({ data: JSON.stringify({
first_name: first_name, first_name,
last_name: last_name, last_name,
username: username, username,
password: password, password,
email: email, email,
birth_date: birth_date, birth_date,
gender: gender gender,
}), }),
success: onSuccess success: onSuccess
}); });