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

View file

@ -31,27 +31,27 @@
var urlParams = new URLSearchParams(window.location.search).toString();
$('#action-load-users').on('click', function() {
var me = $(this);
var page = me.attr('page');
let me = $(this);
let page = me.attr('page');
if (!page) {
page = '1';
}
var newPage = Number(page) + 1;
let newPage = Number(page) + 1;
me.attr('page', newPage + '');
var loaded = Number(me.attr('loaded'));
var pageSize = Number(me.attr('pageSize'));
var userCount = Number(me.attr('userCount'));
var userMax = Number(me.attr('userMax'));
let loaded = Number(me.attr('loaded'));
let pageSize = Number(me.attr('pageSize'));
let userCount = Number(me.attr('userCount'));
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) {
if (data === '') {
me.remove();
return;
}
var container = $('#people-container');
let container = $('#people-container');
container.append(data);
loaded += pageSize;

View file

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

View file

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

View file

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