Skip to content

Commit

Permalink
Rearranged global variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gtwy committed May 22, 2019
1 parent 45bcc0f commit ba561f2
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions wwwdata/optotype.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
/* jshint undef: true, strict: true, esversion: 6 */
/* globals $, document, jQuery, alert, console, window, setTimeout */

// Cookie functions. Taken from https://www.quirksmode.org/js/cookies.html

// Global Variables with default values
var fullScreen = false; // Track if window is in full screen mode
var qMenu = false; // Track if the menu is open
var optoMirror = false; // Track if optotype is mirrored
var optoIndex = 3; // Track currently displayed optotype size. Defaults to 20/20. Corresponds with "index" in optoRatios
var optoSize = 8.7500; // Height of 20/20 font in mm at 20 feet. Calculation by Dr. Christopher Carver, O.D.
var pxSize = 0.2740; // Dimensions of a single pixel on the screen in mm
var losDft = 20.0; // Line-of-sight in whole feet.
var losDin = 0.0; // Line-of-sight inches that extend beyond last whole foot.


// Functions to simplify cookies. (Source: https://www.quirksmode.org/js/cookies.html)
function setCookie(name,value,days) {
'use strict';

Expand Down Expand Up @@ -34,17 +46,7 @@ function eraseCookie(name) {
}


// Global Variables with default values
var fullScreen = false; // Track if window is in full screen mode
var qMenu = false; // Track if the menu is open
var optoMirror = false; // Track if optotype is mirrored
var optoIndex = 3; // Track currently displayed optotype size. Defaults to 20/20. Corresponds with "index" in optoRatios
var optoSize = 8.7500; // Height of 20/20 font in mm at 20 feet. Calculation by Dr. Christopher Carver, O.D.
var pxSize = 0.2740; // Dimensions of a single pixel on the screen in mm
var losDft = 20.0; // Line-of-sight in whole feet.
var losDin = 0.0; // Line-of-sight inches that extend beyond last whole foot.

// Check cookies. Replace default values if cookies exist.
// Checks for existing cookies. Replace default values if cookies exist.
if (getCookie('losDft')) {
losDft = parseFloat(getCookie('losDft'));
}
Expand All @@ -65,6 +67,7 @@ if (getCookie('optoMirror') === 'true') {
// Calculate line of sight distance by adding losDft + losDin
var losD = losDft + (losDin / 12);


// List of all available optotype sizes and their corresponding ratio
var optoRatios = [{
index: 1,
Expand Down

0 comments on commit ba561f2

Please sign in to comment.