Last active
August 31, 2018 20:05
-
-
Save emiranda04/b72a154bb1ef6a78ec0d19ff4849d268 to your computer and use it in GitHub Desktop.
Javascript file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
jQuery(document).ready(function(){ | |
cfSettings(); | |
}); | |
var socialSecurity = '#field67408164', | |
previousButton = '.fsPreviousButton', | |
nextButton = '.fsNextButton', | |
college1 = '#field67408214', | |
college2 = '#field67408222', | |
college3 = '#field67408230', | |
college4 = '#field67408238', | |
college5 = '#field67408246', | |
college6 = '#field67408254'; | |
function collegeList() { | |
return college1 + ', ' + college2 + ', ' + college3 + ', ' + college4 + ', ' + college5 + ', ' + college6; | |
} | |
function cfSettings() { | |
cfSetLogo(); | |
cfSetSections(); | |
cfSetNextNavButton(); | |
cfSetNavBar(); | |
cfSocialSecurity(); | |
} | |
function cfSetLogo() { | |
$('#fsCell68055274').css('margin-top', '-50px'); | |
} | |
function cfSetSections() { | |
$('.fsSectionHeader').attr('style', 'background-color: #00205C !important; padding: 10px; border-radius: 3px !important;'); | |
$('h2').css('color', 'white'); | |
} | |
function cfSetNavBar() { | |
$('div.fsProgressBar').css('background-color', '#4CAF50').css('border-radius', '5px 0 0 5px'); | |
$('div.fsProgressBarContainer').attr('style', 'background-color: #A40329 !important; height: 25px; border-radius: 5px !important;'); | |
$('div.fsProgressText').css('color', 'white').css('font-size', '12px').css('margin-top', '-19px'); | |
} | |
function cfSocialSecurity() { | |
$(socialSecurity).attr('maxlength','11'); | |
} | |
$(document).on("click", nextButton, function (event) { | |
cfSetPreviousNavButton(); | |
}); | |
$(document).on("click", previousButton, function (event) { | |
cfSetNextNavButton(); | |
}); | |
function cfSetPreviousNavButton() { | |
$(previousButton).attr('style', 'background-color: #A40329 !important; width:90px; border-radius: 3px !important; height: 40px;'); | |
} | |
function cfSetNextNavButton() { | |
$(nextButton).attr('style', 'background-color: #A40329 !important; width:90px; border-radius: 3px !important; height: 40px;'); | |
} | |
// Colleges. | |
$(document).on("keyup", collegeList(), function (event) { | |
// Reset text box if user types College of Central Florida. | |
var id = $(this).attr('id'), | |
text = $(this).val().toLowerCase().replace(/ /g,''), | |
rejectWord = 'collegeofcentralflorida'; | |
if (text == rejectWord) { | |
$('#' + id).val(''); | |
} | |
}); | |
// SocialSecurity. | |
$(document).on("keydown", socialSecurity, function (e) { | |
var key = e.keyCode; | |
if (!isAllowed(key)) { | |
e.preventDefault(); | |
} | |
}).on("keyup", socialSecurity, function (e) { | |
var info = $(this).val(); | |
$(this).val(info.replace(/^(\d{3})(\d{2})(\d{4})+$/, "$1-$2-$3")); | |
}); | |
function isAllowed(value) { | |
// Checks if characters are allowed for social security. | |
// Replace with regex. | |
var allowed = [8, 45, 48, 49, 50, 51, 52, 50, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 109, 189]; | |
return allowed.indexOf(value) > -1; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated code