Moved Javascript, added SCSS and CSS files for a basic look.

Signed-off-by: Rick Hays <rhays@haysgang.com>
This commit is contained in:
2019-09-25 16:31:54 -05:00
parent 1178328186
commit 1c2488c808
7 changed files with 297 additions and 85 deletions

37
js/system.js Normal file
View File

@@ -0,0 +1,37 @@
let value_error = false; // Flag if Lat/Lon values are out of range.
let latitude_low = 38.0;
let latitude_high = 40.0;
let longitude_low = -96.0;
let longitude_high = -94.0;
function submitForm()
{
// Clear values
value_error = false;
$("#latitude_error").html('');
$("#longitude_error").html('');
// Set Vars
let nLatitude = $("#latitude").val();
let nLongitude = $("#longitude").val();
if ((!$.isNumeric(nLatitude)) || (!inRange(nLatitude,latitude_low,latitude_high)))
{
$("#latitude_error").html('Please enter a value between ' + latitude_low + ' and ' + latitude_high);
value_error = true;
}
if ((!$.isNumeric(nLongitude)) || (!inRange(nLongitude,longitude_low,longitude_high)))
{
$("#longitude_error").html('Please enter a value between ' + longitude_low + ' and ' + longitude_high);
value_error = true;
}
// if Lat or Lon values are out of range return to form.
if (value_error) { return; }
alert('Submit Form');
}

23
js/utils.js Normal file
View File

@@ -0,0 +1,23 @@
/*
* UTILS.JS - Basic functions for tasks
* 2019-09-25
* Rick Hays
*
*/
/*
* inRange - Tests to see if a Number is within a value range.
* @ nVal - Number - Number to test
* @ nLow - Lowest value in range
* @ nHigh - Highest value in range
*
* @ return - True/False if value is in range.
*/
function inRange(nVal, nLow, nHigh)
{
nVal = Number(nVal);
nLow = Number(nLow);
nHigh = Number(nHigh);
return (nVal >= nLow) && (nVal <= nHigh);
}