mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-19 03:56:17 +08:00
replaced vars with lets
This commit is contained in:
parent
e0b6e4a954
commit
a31d73a2b3
12 changed files with 34 additions and 34 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
},
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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") {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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", {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue