diff --git a/frontend/src/js/controllers/account-controller.js b/frontend/src/js/controllers/account-controller.js index b24ac3cf8..88a77a5ef 100644 --- a/frontend/src/js/controllers/account-controller.js +++ b/frontend/src/js/controllers/account-controller.js @@ -555,7 +555,7 @@ export async function addPasswordAuth(email, password) { return Notifications.add("Could not reauthenticate: " + e.message, -1); } } - var credential = firebase.auth.EmailAuthProvider.credential(email, password); + let credential = firebase.auth.EmailAuthProvider.credential(email, password); firebase .auth() .currentUser.linkWithCredential(credential) diff --git a/frontend/src/js/controllers/chart-controller.js b/frontend/src/js/controllers/chart-controller.js index 540233958..a671159db 100644 --- a/frontend/src/js/controllers/chart-controller.js +++ b/frontend/src/js/controllers/chart-controller.js @@ -40,13 +40,13 @@ export let result = new Chart($("#wpmChart"), { type: "scatter", pointStyle: "crossRot", radius: function (context) { - var index = context.dataIndex; - var value = context.dataset.data[index]; + let index = context.dataIndex; + let value = context.dataset.data[index]; return value <= 0 ? 0 : 3; }, pointHoverRadius: function (context) { - var index = context.dataIndex; - var value = context.dataset.data[index]; + let index = context.dataIndex; + let value = context.dataset.data[index]; return value <= 0 ? 0 : 5; }, }, @@ -487,13 +487,13 @@ export let miniResult = new Chart($(".pageAccount #miniResultChart"), { type: "scatter", pointStyle: "crossRot", radius: function (context) { - var index = context.dataIndex; - var value = context.dataset.data[index]; + let index = context.dataIndex; + let value = context.dataset.data[index]; return value <= 0 ? 0 : 3; }, pointHoverRadius: function (context) { - var index = context.dataIndex; - var value = context.dataset.data[index]; + let index = context.dataIndex; + let value = context.dataset.data[index]; return value <= 0 ? 0 : 5; }, }, diff --git a/frontend/src/js/controllers/input-controller.js b/frontend/src/js/controllers/input-controller.js index 0d9df23a2..98d4294b7 100644 --- a/frontend/src/js/controllers/input-controller.js +++ b/frontend/src/js/controllers/input-controller.js @@ -587,8 +587,8 @@ function handleTab(event) { let area = $("#customTextPopup .textarea")[0]; - var start = area.selectionStart; - var end = area.selectionEnd; + let start = area.selectionStart; + let end = area.selectionEnd; // set textarea value to: text before caret + tab + text after caret area.value = diff --git a/frontend/src/js/controllers/route-controller.js b/frontend/src/js/controllers/route-controller.js index c125d3219..8cc175d36 100644 --- a/frontend/src/js/controllers/route-controller.js +++ b/frontend/src/js/controllers/route-controller.js @@ -25,7 +25,7 @@ export function handleInitialPageClasses(pathname) { } (function (history) { - var pushState = history.pushState; + let pushState = history.pushState; history.pushState = function (state) { if (Config.funbox === "memory" && state !== "/") { Funbox.resetMemoryTimer(); diff --git a/frontend/src/js/controllers/theme-controller.js b/frontend/src/js/controllers/theme-controller.js index c5429b116..3f10bcc8a 100644 --- a/frontend/src/js/controllers/theme-controller.js +++ b/frontend/src/js/controllers/theme-controller.js @@ -35,7 +35,7 @@ function updateFavicon(size, curveSize) { bgcolor = "#111"; maincolor = "#eee"; } - var canvas = document.createElement("canvas"); + let canvas = document.createElement("canvas"); canvas.width = size; canvas.height = size; let ctx = canvas.getContext("2d"); @@ -159,7 +159,7 @@ export function clearPreview() { } export function randomizeTheme() { - var randomList; + let randomList; Misc.getThemesList().then((themes) => { if (Config.randomTheme === "fav" && Config.favThemes.length > 0) { randomList = Config.favThemes; diff --git a/frontend/src/js/db.js b/frontend/src/js/db.js index 0c0e92e69..4f97987e0 100644 --- a/frontend/src/js/db.js +++ b/frontend/src/js/db.js @@ -314,7 +314,7 @@ export async function getUserAverageWpm10( let retval = 0; if (dbSnapshot == null) return retval; - var dbSnapshotValid = await getUserResults(); + let dbSnapshotValid = await getUserResults(); if (dbSnapshotValid === false) { return retval; } diff --git a/frontend/src/js/elements/keymap.js b/frontend/src/js/elements/keymap.js index f0f5d42e9..0ad717455 100644 --- a/frontend/src/js/elements/keymap.js +++ b/frontend/src/js/elements/keymap.js @@ -192,14 +192,14 @@ export function refreshKeys(layout) { $(".keymap .r4 .keymap-key.first").addClass("hidden-key"); } - var toReplace = lts.keys.slice(1, 48); - var count = 0; + let toReplace = lts.keys.slice(1, 48); + let count = 0; // let repeatB = false; $(".keymap .keymap-key .letter") .map(function () { if (count < toReplace.length) { - var key = toReplace[count].charAt(0); + let key = toReplace[count].charAt(0); this.innerHTML = key; switch (key) { diff --git a/frontend/src/js/settings/theme-picker.js b/frontend/src/js/settings/theme-picker.js index c5aadfc91..360a64a9a 100644 --- a/frontend/src/js/settings/theme-picker.js +++ b/frontend/src/js/settings/theme-picker.js @@ -193,7 +193,7 @@ export function updateActiveTab() { $(".pageSettings .section.themes .tabs .button").click((e) => { $(".pageSettings .section.themes .tabs .button").removeClass("active"); - var $target = $(e.currentTarget); + let $target = $(e.currentTarget); $target.addClass("active"); setCustomInputs(); if ($target.attr("tab") == "preset") { diff --git a/frontend/src/js/test/poetry.js b/frontend/src/js/test/poetry.js index 4fe4640f4..802a0f0c8 100644 --- a/frontend/src/js/test/poetry.js +++ b/frontend/src/js/test/poetry.js @@ -12,11 +12,11 @@ export class Poem { } cleanUpText() { - var count = 0; - var scrubbedWords = []; - for (var i = 0; i < this.words.length; i++) { + let count = 0; + let scrubbedWords = []; + for (let i = 0; i < this.words.length; i++) { let scrubbed = ""; - for (var j = 0; j < this.words[i].length; j++) { + for (let j = 0; j < this.words[i].length; j++) { if (!bannedChars.includes(this.words[i][j])) scrubbed += this.words[i][j]; } @@ -36,7 +36,7 @@ export class Poem { export async function getPoem() { return new Promise((res, rej) => { console.log("Getting poem"); - var poemReq = new XMLHttpRequest(); + let poemReq = new XMLHttpRequest(); poemReq.onload = () => { if (poemReq.readyState == 4) { if (poemReq.status == 200) { diff --git a/frontend/src/js/test/test-logic.js b/frontend/src/js/test/test-logic.js index 8ea9a4bda..fc1f1accd 100644 --- a/frontend/src/js/test/test-logic.js +++ b/frontend/src/js/test/test-logic.js @@ -1043,7 +1043,7 @@ export async function addWord() { } } -var retrySaving = { +let retrySaving = { completedEvent: null, canRetry: false, }; @@ -1067,7 +1067,7 @@ export function retrySavingResult() { Notifications.add("Retrying to save..."); - var { completedEvent } = retrySaving; + let { completedEvent } = retrySaving; axiosInstance .post("/results/add", { diff --git a/frontend/src/js/test/test-ui.js b/frontend/src/js/test/test-ui.js index 42e79d6b0..ab2d79004 100644 --- a/frontend/src/js/test/test-ui.js +++ b/frontend/src/js/test/test-ui.js @@ -231,12 +231,12 @@ export async function screenshot() { } $(".pageTest .buttons").addClass("hidden"); let src = $("#middle"); - var sourceX = src.position().left; /*X position from div#target*/ - var sourceY = src.position().top; /*Y position from div#target*/ - var sourceWidth = src.outerWidth( + let sourceX = src.position().left; /*X position from div#target*/ + let sourceY = src.position().top; /*Y position from div#target*/ + let sourceWidth = src.outerWidth( true ); /*clientWidth/offsetWidth from div#target*/ - var sourceHeight = src.outerHeight( + let sourceHeight = src.outerHeight( true ); /*clientHeight/offsetHeight from div#target*/ $("#notificationCenter").addClass("hidden"); diff --git a/frontend/src/js/test/wikipedia.js b/frontend/src/js/test/wikipedia.js index b2d92bee3..ee5316cd8 100644 --- a/frontend/src/js/test/wikipedia.js +++ b/frontend/src/js/test/wikipedia.js @@ -48,9 +48,9 @@ export async function getSection(language) { urlTLD = await getTLD(currentLanguageGroup); const randomPostURL = `https://${urlTLD}.wikipedia.org/api/rest_v1/page/random/summary`; - var sectionObj = {}; - var randomPostReq = await fetch(randomPostURL); - var pageid = 0; + let sectionObj = {}; + let randomPostReq = await fetch(randomPostURL); + let pageid = 0; if (randomPostReq.status == 200) { let postObj = await randomPostReq.json(); @@ -67,7 +67,7 @@ export async function getSection(language) { const sectionURL = `https://${urlTLD}.wikipedia.org/w/api.php?action=query&format=json&pageids=${pageid}&prop=extracts&exintro=true&origin=*`; - var sectionReq = new XMLHttpRequest(); + let sectionReq = new XMLHttpRequest(); sectionReq.onload = () => { if (sectionReq.readyState == 4) { if (sectionReq.status == 200) {