Rescoped vars to lets
parent
952c271f7d
commit
d4e1f5f726
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
/* global $ */
|
||||
|
||||
var validEmail, validMessage
|
||||
let validEmail, validMessage
|
||||
|
||||
// Validate email addresses
|
||||
function validateEmail (email) {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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()
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue