Skip to content

Commit

Permalink
site: js: Use let when introducing new variables
Browse files Browse the repository at this point in the history
In strict mode, directly assigning to a variable is forbidden. Use let
(or const) instead.

Signed-off-by: Sean Anderson <[email protected]>
  • Loading branch information
Forty-Bot committed May 30, 2024
1 parent eba4a9c commit f89c6bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions trends/site/static/js/dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ var date_formatter = new Intl.DateTimeFormat('und', {dateStyle: 'medium'});
var datetime_formatter = new Intl.DateTimeFormat('und', {dateStyle: 'medium', timeStyle: 'short'});

document.addEventListener('DOMContentLoaded', () => {
for (date of document.getElementsByClassName("datetime"))
for (let date of document.getElementsByClassName("datetime"))
date.textContent = datetime_formatter.format(
new Date(date.getAttribute('timestamp') * 1000));

for (date of document.getElementsByClassName("date"))
for (let date of document.getElementsByClassName("date"))
date.textContent = date_formatter.format(
new Date(date.getAttribute('timestamp') * 1000));
});
Expand Down
2 changes: 1 addition & 1 deletion trends/site/static/js/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function render_option(data, escape) {
}

document.addEventListener('DOMContentLoaded', () => {
input = document.getElementById('players_input');
let input = document.getElementById('players_input');
if (input != null) {
new TomSelect(document.getElementById('players_input'), {
plugins: ['remove_button'],
Expand Down
4 changes: 2 additions & 2 deletions trends/site/static/js/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function cell_value(row, column) {
let i = 0;
let cell;
for (let td of row.children) {
cs = colspan(td) || 1;
let cs = colspan(td) || 1;
if (column >= i && column < i + cs) {
cell = td;
break;
Expand Down Expand Up @@ -74,7 +74,7 @@ function sort_rows(rows, insert, column, asc, reverse) {

function register_sort(table, header) {
let column = 0;
for (th of header.parentNode.children) {
for (const th of header.parentNode.children) {
if (th === header) {
break;
}
Expand Down

0 comments on commit f89c6bd

Please sign in to comment.