Rescoped vars to lets

master
Keith Irwin 2018-03-09 02:26:24 +00:00
parent 952c271f7d
commit d4e1f5f726
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
6 changed files with 13 additions and 13 deletions

View File

@ -179,7 +179,7 @@ app.post('/csp-violation', (req, res) => {
// Catch-all for 404s
app.use((req, res, next) => {
if (!res.headersSent) {
var err = new Error(`Not found: ${req.url}`)
let err = new Error(`Not found: ${req.url}`)
err.status = 404
next(err)
}

View File

@ -1,7 +1,7 @@
'use strict'
/* global $ */
var validEmail, validMessage
let validEmail, validMessage
// Validate email addresses
function validateEmail (email) {

View File

@ -3,8 +3,8 @@
// Push footer to bottom on pages with little content
function setFooter () {
var $windowHeight = $(window).height()
var $footerBottom = $('footer').offset().top + $('footer').height()
const $windowHeight = $(window).height()
const $footerBottom = $('footer').offset().top + $('footer').height()
if ($windowHeight > $footerBottom) {
$('footer').css('margin-top', $windowHeight - $footerBottom)
}

View File

@ -3,11 +3,11 @@
// Variables
var map, marker, elevator, newLoc
let map, marker, elevator, newLoc
const mapElem = document.getElementById('map')
const socket = io('//' + window.location.hostname)
const IDLE_TIMEOUT = 300 // 5 minutes in seconds
var _idleSecondsCounter = 0
let _idleSecondsCounter = 0
// Idle timeout listeners
function resetIdleSecondsCounter () {
@ -76,7 +76,7 @@ $(function () {
toggleMaps(mapuser.last)
// Controls
var wpid, newloc
let wpid, newloc
// Set location
$('#set-loc').click(function () {
@ -89,7 +89,7 @@ $(function () {
// Success callback
function (pos) {
var newloc = {
let newloc = {
ts: Date.now(),
tok: token,
usr: userid,

View File

@ -48,7 +48,7 @@ $(function () {
$('#password-help').show()
// Check first password
var zxcvbnResult = zxcvbn($('#p1').val())
let zxcvbnResult = zxcvbn($('#p1').val())
// Less than an hour
if (zxcvbnResult.crack_times_seconds.online_no_throttling_10_per_second < 3600) {

View File

@ -18,7 +18,7 @@ function replaceFromEndpoint (type, selector, cb) {
// On page load
$(function () {
var slugNotUnique, emailNotUnique
let slugNotUnique, emailNotUnique
// Set timezone in password change link
$('#password').attr('href', '/account/password?tz=' + new Date().getTimezoneOffset())
@ -37,7 +37,7 @@ $(function () {
basicCheck(function () { validateUniqueness(input) })
function basicCheck (cb) {
var checkedCount = 0
let checkedCount = 0
// Check slug
if (!$('#slug-input').val()) {
@ -74,7 +74,7 @@ $(function () {
function validateUniqueness (input) {
function recheckBasic () {
if (
$('#email-help').is(':visible') &&
$('#email-help').is(':visible') &&
$('#email-help').text().substring(0, 25) !== 'Unable to confirm unique '
) {
$('#submit-group .main')
@ -113,7 +113,7 @@ $(function () {
// Is unique
200: function () {
$('#' + input + '-help').hide()
if (input === 'slug') slugNotUnique = false
if (input === 'slug') slugNotUnique = false
else if (input === 'email') emailNotUnique = false
recheckBasic()
},