Peak Memory: [0-9\.]+ MB\<\/div\>/, "");
// try{eval(extraJavascript);} catch(e) {}
// result = possibleJSON;
// }
// }
}
// Execute any type of custom function
if(A.isDefined(o.customFunc)) {
o.customFunc(result);
}
// Unset the formId variable as we shouldn't need it again.
A.formId = "";
$loading.fadeOut(200);
}, (o.isJson ? 'json' : 'html'));
A.xhrLog.push(xhr);
// If A.tempName() was called before this call, it will now be reset.
A.refreshName();
},
// This is the wrapper function that is used for the push function. The push function is the actual function that accesses edit.php
set :
function(func, data, customFunc) {
var formValues = A.setValues(data), formId = A.formId;
A.callObj = {
name : A.name,
func : func,
values : formValues,
formId : formId,
customFunc : customFunc
};
A.push();
},
// Will get the main tab and hide any open lb after the edit is complete.
setAndGetTab :
function(func, data, tabValue) {
var formValues = A.setValues(data), formId = A.formId;
A.callObj = {
name : A.name,
func : func,
values : formValues,
formId : formId,
customFunc : function() { A.getTab('tab_'+A.name, tabValue); A.hideLb(); }
};
A.push();
},
setAndGetHTML :
function(func, data, viewFunc, viewValue, viewDiv, viewCustomFunc) {
var formValues = A.setValues(data), formId = A.formId;
A.callObj = {
name : A.name,
func : func,
values : formValues,
formId : formId,
customFunc : function() { A.getHTML(viewFunc, viewValue, viewDiv, viewCustomFunc); A.hideLb(); }
};
A.push();
},
/**
* DEPRECATED. DO NOT USE ANYMORE! Either use A.set or A.setJson
*/
setResponse :
function(func, data, customFunc) {
A.skipNotify = true;
var formValues = A.setValues(data), formId = A.formId;
formValues += '&is_json_request=1';
A.callObj = {
name : A.name,
func : func,
values : formValues,
formId : formId,
isResponse : true,
customFunc : customFunc
};
A.push();
},
setJson :
function(func, value, customFunc) {
A.skipNotify = true;
var formValues = A.setValues(value), formId = A.formId;
formValues += '&is_json_request=1';
A.callObj = {
name : A.name,
func : func,
values : formValues,
formId : formId,
isResponse : true,
customFunc : customFunc,
isJson : true
};
A.push();
},
// idString is a comma/hyphen delimited string of the ids needed to be converted into a url string.
/*
addValues :
function(idString) {
var string = '', $obj;
var ids = A.hasComma(idString) ? idString.split(',') : idString.split('-');
for(var i = 0; i < ids.length; ++i) {
$obj = $('#' + ids[i]);
string += $obj.name + '=' encodeURIComponent($obj.val());
}
A.extraValues += string;
},
*/
// Sets the name permanantly until changed by another setName() or a tab is clicked.
setName :
function(name) {
A.name = name;
},
// Sets the name to be something for one ajax call (get or push). Afterwards it is reset to the previous main name that was set.
setTempName :
function(tempName) {
A.tempName = A.name;
A.name = tempName;
},
// Sets directory for one ajax call that needs to be used if it's going to something specific (like to the /jobs/view.php), you would use setTempDir('/jobs/');
setTempDir :
function(tempDir) {
A.tempDir = tempDir;
},
/**
* Sets the name while the LB is open. Once it closes, it reverts to what it was previously
* @param {string} tempName - ex: "jobListings"
* @since 11/5/15
* @author Austin
*/
setLbName :
function(tempName) {
A.lbTempName = A.name;
A.name = tempName;
},
/**
* Sets the name while the LB is open. Once it closes, it reverts to what it was previously
* @param {string} tempName - ex: "/jobs/"
* @since 11/5/15
* @author Austin
*/
setLbTempDir :
function(tempDir) {
A.lbTempDir = tempDir;
},
refreshName :
function() {
if(A.tempName) {
A.name = A.tempName;
A.tempName = '';
}
if(A.tempDir) {
A.tempDir = '';
}
},
// Popup that shows up when something is clicked, also called lightbox
showLb :
function(isFluid) {
var $lb = $('#lb-direct-wrapper');
var scrollTop = 0;
var left = 0;
var centerVertically = false;
var newStyle = false;
//left = (document.documentElement.clientWidth-490)/2;
scrollTop = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : window.pageYOffset;
//If IE 8
if(scrollTop == undefined) scrollTop = 0;
switch(isFluid){
case 'tiny-center':
lbwidth = '20%';
centerVertically = true;
newStyle = true;
break;
case true:
case 1:
case '1':
lbwidth = 'auto';
break;
default:
lbwidth = 975;
break;
}
if(!newStyle){
$lb.css({'width': lbwidth, 'min-width': 975});
left = (document.documentElement.clientWidth-490) / 2;
} else {
$lb.css('width', lbwidth);
left = ($(window).width() - $lb.width()) / 2;
}
if(centerVertically){
voffset = ($(window).height() - $lb.height()) / 2;
} else voffset = 30;
// lbbg is the large dark background area that appears when the lightbox comes up
$('#lbbg').show().css({width : document.documentElement.clientWidth + 0, height : document.documentElement.clientHeight + 0, left : '0px', top : '0px'})
// lb is the lightbox itself
$lb.show().css({top : (scrollTop + voffset) + 'px', left : (left + 10) + 'px'});
// lbx is the red x in the top right corner or the lightbox
$('#lbx').show().css({top : (scrollTop + 35) + 'px', left : (left) + 'px', width : lbwidth, minWidth : 975});
$lb.find('.lb-close').on('click', function() { A.hideLb(); });
},
// Hides the lightbox.
hideLb :
function() {
if(A.lbTempName.length > 0) {
A.name = A.lbTempName;
A.lbTempName = '';
}
if(A.lbTempDir.length > 0)
A.lbTempDir = "";
A.shutdownEditor();
$('#lb-direct-wrapper').hide();
$('#lb').html('');
$('#lbx').hide();
$('#lbbg').hide();
V.clearErrors();
},
attachParam :
function(param, value) {
A.params[param] = value;
},
detachParam :
function(param) {
delete A.params[param];
},
paramToString :
function() {
var i, str = '';
for(i in A.params) {
str += '&' + i + '=' + A.params[i];
}
return str;
},
attachPostParam :
function(param, value) {
A.postParams[param] = value;
},
detachPostParam :
function(param) {
delete A.postParams[param];
},
postParamToString :
function() {
var i, str = '';
for(i in A.postParams) {
str += '&' + i + '=' + A.postParams[i];
}
return str;
},
// Initializes the Wysiwyg Editor. The editor textarea must have a class of "editor"
initEditor :
function() {
var id, $t;
if(typeof(tinyMCE) == 'undefined')
return;
var cmd = tinyMCE.majorVersion == 4 ? 'mceAddEditor' : 'mceAddControl';
$('textarea.editor').each(function() {
$t = $(this);
id = $t.attr('id');
if(typeof(tinyMCE.editors[id]) == 'undefined') {
tinyMCE.execCommand(cmd, false, id);
}
});
},
submitEditor :
function() {
var id, $t;
$('textarea.editor').each(function() {
$t = $(this);
id = $t.attr('id');
if(typeof(tinyMCE.editors[id]) != 'undefined') {
$('#' + id).val(tinyMCE.get(id).getContent());
}
});
},
shutdownEditor :
function() {
var tinymceCheck = false, tinymceInstances;
try {
if(tinyMCE.get().length) {
tinymceCheck = true;
}
} catch(e) {}
if(tinymceCheck) {
tinymceInstances = tinyMCE.editors;
var cmd = tinyMCE.majorVersion == 4 ? 'mceRemoveEditor' : 'mceRemoveControl';
for(var i = (tinymceInstances.length - 1); i >= 0; --i) {
tinyMCE.execCommand(cmd, false, tinymceInstances[i]['id']);
}
}
},
parseValues :
function(value) {
return A.setValues(value);
/*
var formValues = '';
// If this is an object, it'll need to be parsed as an encoded URL
if(A.isObject(value)) {
formValues = $.param(value);
// If it is one single value, just attach it to the "v" param
} else if(typeof(value) != 'undefined') {
formValues = 'v=' + value;
}
return formValues;
*/
},
setValues :
function(data) {
var formValues;
// If this is an string, we'll assume it's a form id
if(A.isString(data) && /[a-z]+/i.test(data) && data.indexOf('&') == -1) {
// Save data from wysiwyg editors
A.submitEditor();
formValues = $('#' + data).serialize();
A.formId = data;
// Data can also be a key : value object
} else if(A.isObject(data)) {
formValues = $.param(data);
// If it's a custom url string
} else if(A.isString(data) && data.indexOf('&') != -1) {
formValues = data;
// If it's only an int, we'll assume that it's an id and assign it to v
} else if(/[^a-z]+/i.test(data)) {
formValues = 'v=' + data;
// If there's an & we'll assume that they are trying to manually format the url parameters
} else if(A.isString(data) && data.indexOf('&') != -1) {
formValues = data;
}
return formValues;
},
// To run this properly, you need to define some text in span tags. The value is defined by the html within the tag
// class: editText,
// data-func: the func to run,
// data-id: the unique id assigned to the element.
editText :
function() {
var image = 'pencil.png';
$('span.editText').css({cursor: 'pointer'}).on('click', function() {
var $span = $(this),
newVal = $span.html().replace(/\
/gi, ''),
dateCheck = new Date(newVal.replace(/-/g,'/')),
$input = $(document.createElement('input')),
$button = $(document.createElement('input')),
oValues = $.parseJSON($span.attr('data-json')),
id = oValues.id;
$input.attr('type', 'text').css('width', $span.outerWidth()).val(newVal).attr('id', 'editText-' + id);
$button.attr('type', 'button').val('Update').click(function() {
oValues.value = $('#editText-' + id).val();
A.set($span.attr('data-func'), oValues, function() {
$span.show().html($input.val()).append('
');
$input.remove();
$button.remove();
});
});
$span.hide();
// Make sure there is only one instance of the inputs
if(!$span.parent().find('input').length) {
$span.parent().append($input).append($button);
// if the date seems like it's a valid date (DD-MMM-YYYY)
if($span.hasClass('date'))
$input.simpleDatepicker({format : 'd-M-Y'}).css('width', '100px');
}
// Only append one image to each field
}).each(function() {
var $span = $(this);
if(!$span.find('img').length)
$span.append('
');
});
},
addError :
function(msg) {
try { console.log(msg); } catch(e) {}
},
isDefined :
function(data) {
return typeof(data) != 'undefined';
},
isString :
function(data) {
return typeof(data) == 'string';
},
isInt :
function(data) {
return typeof(data) == 'number';
},
isObject :
function(data) {
return typeof(data) == 'object';
},
isFunction :
function(data) {
return typeof(data) == 'function';
},
hasComma :
function(string) {
return string.indexOf(',') != -1;
},
setLargeGetParam:
function(paramName, valueString) {
A.largeParam[paramName] = valueString;
},
getLargeGetParam:
function(paramName) {
return A.largeParam[paramName];
},
/*
*
* Misc functions
*
*/
// This is used in the autocomplete plugin we have. This will bold the letters that we are searching for.
highlightResult : function(value, data) {
var q = $('#autocomplete').val().toLowerCase();
q = q.split('');
var location, newValue, finalValue = '', lastLocation, done = new Array();
var playValue = value.toLowerCase();
for(var i = 0; i < q.length; i++) {
//if(!$.inArray(value.indexOf(q[i]), done)) {
// location = value.indexOf(q[i]);
//} else {
location = playValue.indexOf(q[i], lastLocation + 1);
//}
if(i == 0) {
if(location == 0) {
newValue = '' + value.slice(0, 1) + '';
} else {
newValue = value.slice(0, location) + '' + value.slice(location, location + 1) + '';
}
} else {
//if(lastLocation == (location - 1)) {
// newValue = '' + value.slice(location, location + 1) + '';
//} else {
newValue = value.slice(lastLocation + 1, location) + '' + value.slice(location, location + 1) + '';
//}
}
lastLocation = location;
finalValue += newValue;
done.push(location);
}
finalValue += value.slice(lastLocation + 1);
return finalValue;
},
addFieldToUrl :
function(parameter, value) {
try {
var searchQuery = window.location.search,
questionMark = window.location.href.indexOf('?') == -1 ? '?' : '',
nameQuery = parameter + '=' + value,
nameRegex = new RegExp(parameter + "\=([a-z0-9\_\+\%]*)", "i");
if(window.location.search.indexOf(parameter + '=') != -1)
window.history.replaceState(parameter,parameter,searchQuery.replace(nameRegex, nameQuery));
else
window.history.replaceState(parameter,parameter,searchQuery + questionMark + (questionMark == '' ? '&' : '') + nameQuery);
} catch(e) {}
},
removeFieldFromUrl :
function(parameter) {
try {
var searchQuery = window.location.search,
nameRegex = new RegExp('&?' + parameter + "\=([a-z0-9\_\+\%]*)", "i");
if(window.location.search.indexOf(parameter + '=') != -1)
window.history.replaceState(parameter,parameter,searchQuery.replace(nameRegex, ""));
} catch(e) {}
},
generateUniqueID : function() {
if(!window.funID)
window.funID = Math.round(Math.random() * 100);
var funID = window.funID;
var d = performance.now();
var uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (d + Math.random()*16)%16 | 0;
d = Math.floor(d/16);
return (c=='x' ? r : (r&0x7|0x8)).toString(16);
});
uuid = uuid.slice(0, parseInt('-' + funID.length)) + funID;
return uuid;
},
killAllActiveAjaxRequests : function() {
$.each(A.xhrLog, function(index, xhr) {
if(xhr) {
xhr.abort();
}
});
}
};
// Generates microsecond timestamp used to generate the unique_id
(function(a){a.performance=a.performance||{};performance.now=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||Date.now||function(){return(new Date).getTime()}})(window);
var F = {
validate :
function(formId) {
// Thanks to jquery 2.0.3, it freaks out on the $fields var below if there's no formId
if(typeof(formId) == 'undefined' || !formId || formId == '')
return true;
var failed, showAlert = false, alertText = '', field = '', color = '', afterText = '', check = '';
// SSN and DOB alerts
var ssn_dob = false;
var skip_ssn_dob = false;
var $fields = typeof(formId) == 'string' ? $('#'+formId+' .v') : formId;
$fields.each(function() {
// if it is a multiple select, make sure that all the fields are automatically selected before putting them through the check.
if($(this).prop('tagName') == 'SELECT' && ($(this).attr('multiple') == 'multiple' || $(this).attr('multiple') == '')) {
$(this).find('option').attr('selected','selected');
}
failed = false;
switch($(this).val()) {
case undefined:
case false:
case null:
case "":
case " ":
failed = true;
break;
case 0:
case '0':
if(!$(this).hasClass('zeroValue'))
failed = true;
break;
default:
break;
}
field = '';
// If the input needs to be validated for email
if($(this).hasClass('email') && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test($(this).val()) === false) {
field = 'email';
alertText += "\nThis does not appear to be a valid email address. Please verify the email address and try again. (Red)\n";
failed = true;
}
// If the input needs to be validated for digits
if($(this).hasClass('digit') && /[^0-9]+/.test($(this).val()) === true) {
field = 'digit';
alertText += "\nThis field must be a digit with no other characters or spaces. Please verify and try again. (Blue)\n";
failed = true;
}
// If the input needs to be validated for ASCII valid characters
if($(this).hasClass('ascii') && /[^\x20-\x7f\x0A\x0D\t]+/.test($(this).val()) === true) {
field = 'char';
alertText += "\nThere are unusual characters in this field. You may have tried to copy and paste the text in this field. Try typing the field out by hand and attempt again. (Yellow)\n";
failed = true;
}
// If the input needs to be validated for letters, numbers, and the characters _ - . No spaces (ideally for a username)
if($(this).hasClass('filename') && /[^\w\-\.]+/.test($(this).val()) === true) {
field = 'filename';
alertText += "\nThere should only be letters, numbers, and the characters _ - . in this field. No spaces or other characters are allowed. (Red)\n";
failed = true;
}
// If the input needs to be validated for a subdomain. (Same as filename, just no period)
if($(this).hasClass('subdomain') && /[^\w\-]+/.test($(this).val()) === true) {
field = 'subdomain';
alertText += "\nThere should only be letters, numbers, and the characters _ and - in this field. No spaces or other characters are allowed. (Red)\n";
failed = true;
}
// If the input needs to be validated for decimals (as in currency)
if($(this).hasClass('currency') && /[0-9]+\.[0-9]{2}/.test($(this).val()) === false) {
field = 'currency';
alertText += "\nThis field must be in the standard format for currency, e.g. 10.00.\n";
failed = true;
}
// Check for errors in possible HTML tags in additional/screening question text
if((formId == 'add_screening_question' || formId == 'edit_screening_question') && this.id == "question"){
if(!F.validateHtmlTags($(this).val())){
alertText += "\nYou have some HTML errors in your question text. Make sure your tags are closed and properly nested.\n";
failed = true;
}
}
afterText = '';
// If the input failed
if(failed) {
switch(field) {
case 'email':
color = '#FFD1DD';
afterText = 'Invalid Email';
break;
case 'digit':
color = '#B6C7FE';
afterText = 'Only Digits';
break;
case 'char':
color = '#FEFF8F';
afterText = 'Invalid Characters';
break;
case 'filename':
color = '#FFD1DD';
afterText = 'Only A-Z, 0-9, _, -, . allowed';
break;
case 'subdomain':
color = '#FFD1DD';
afterText = 'Only A-Z, 0-9, _, -, . allowed';
break;
case 'currency':
color = '#FFD1DD';
afterText = 'Only currency format. Ex: (10.00)';
break;
default:
color = '#FFD1DD';
afterText = '';
break;
}
$(this).css({border : '2px solid ' + color});
if(!$(this).parent().find('span').length)
$(this).after('' + afterText + '');
if($(this).parent().find('img').length)
$(this).parent().find('img[src*="priceQuote"]').remove();
showAlert = true;
} else {
$(this).css({border:'2px solid #38BE51'});
//if(!$(this).parent().find('img[src*="priceQuote"]').length)
// $(this).after('
');
if($(this).parent().find('span').length)
$(this).parent().find('span[class!="noValidate"]').remove();
}
// SSN and DOB checks
check = $(this).val();
if(typeof(check) === "string" && this.id == 'question')
ssn_dob = F.checkSSNandDOBVerbiage(check);
});
if(showAlert) {
if(typeof(formId) == 'string')
alert('The highlighted fields need to be completed before you can proceed' + "\n" + alertText);
return false;
} else {
// SSN and DOB checks
if( $('select[name=type_id]').val() == '11' || $('input[name=type_id]').val() == '11') {
skip_ssn_dob = true;
}
if( !skip_ssn_dob && ssn_dob == true && (formId == 'add_screening_question' || formId == 'edit_screening_question') ) {
alert('The collection of an applicant\'s social security number or date of birth is not allowed in this area. SSN and DOB data will be removed if collected. Please contact support if you have any questions and to learn how you can help in our efforts to improve the security of your applicant\'s personal information.');
ajax('ssnDobBreach', 'email', $('input[name=screening_question_id]').val());
if( !$('input[name=screening_question_id]').length )
$('input[name="flagged"]').val('1')
return false;
} else if( typeof(check) === "string") {
//if the question was set to "Last 4 SSN digits, we just need to check for DOB"
if ( F.checkDOBVerbiage(check) == false && skip_ssn_dob && (formId == 'add_screening_question' || formId == 'edit_screening_question')){
return true;
} else
if( F.checkSSNandDOBVerbiage(check) == true && (formId == 'add_screening_question' || formId == 'edit_screening_question') ) {
alert('The collection of an applicant\'s date of birth is not allowed in this area. DOB data will be removed if collected. Please contact support if you have any questions and to learn how you can help in our efforts to improve the security of your applicant\'s personal information.');
ajax('ssnDobBreach', 'email', $('input[name=screening_question_id]').val());
if( !$('input[name=screening_question_id]').length )
$('input[name="flagged"]').val('1')
return false;
} else {
return true;
}
} else {
return true;
}
}
},
getStates :
function(countryId, includeEmpty, emptyTopOptionText) {
includeEmpty = typeof(includeEmpty) == 'undefined' ? 1 : includeEmpty ? 1 : 0;
var text = typeof(emptyTopOptionText) == 'undefined' ? '' : emptyTopOptionText;
$.get('/includes/states.php', 'country_id=' + countryId + '&empty_top_option=' + includeEmpty + '&empty_top_option_text=' + text, function(data) {
$('#state_id option').remove();
$('#state_id').html(data);
});
},
getTimezones :
function(countryId, includeEmpty, emptyTopOptionText) {
includeEmpty = typeof(includeEmpty) == 'undefined' ? 1 : includeEmpty ? 1 : 0;
var text = typeof(emptyTopOptionText) == 'undefined' ? '' : emptyTopOptionText;
$.get('/includes/states.php', 'country_id=' + countryId + '&empty_top_option=' + includeEmpty + '&empty_top_option_text=' + text + '&type=time_zones', function(data) {
$('#time_zone_id option').remove();
$('#time_zone_id').html(data);
});
},
moveOptions :
function (theSelFromId, theSelToId) {
$('#' + theSelFromId + ' option').each(function() {
if($(this).is(':selected') && $(this).prop('disabled') == false) {
$('#' + theSelToId).append($(this));
}
});
},
moveOptionsCategorized :
function (theSelFromId, theSelToId) {
$('#' + theSelFromId + ' option').each(function(){
if($(this).is(':selected') && $(this).prop('disabled') == false){
var o_class = $(this).attr('class');
if($('#' + theSelToId + ' option.' + o_class).length){
$('#' + theSelToId + ' option.' + o_class +':last').after($(this));
} else{
$('#' + theSelToId).append($(this));
}
}
});
},
highSchoolCheck :
function(hsValue) {
//If they are not doing from/to
if($('#years_attended').length) {
var $years = $('#years_attended');
var yearsVal = $years.val() != 'N/A' ? $years.val() : '';
if(hsValue == '1')
$years.attr('disabled', 'disabled').addClass('disabled').val('N/A');
else
$years.removeAttr('disabled').val(yearsVal).removeClass('disabled');
} else { // from/to
var $yearsFrom = $('#years_attended_from');
var $yearsTo = $('#years_attended_to');
var fromVal = $yearsFrom.val() != 'N/A' ? $yearsFrom.val() : '';
var toVal = $yearsTo.val() != 'N/A' ? $yearsTo.val() : '';
if(hsValue == '1') {
$yearsFrom.attr('disabled', 'disabled').val('N/A').addClass('disabled');
$yearsTo.attr('disabled', 'disabled').val('N/A').addClass('disabled');
} else {
$yearsFrom.removeAttr('disabled').val(fromVal).removeClass('disabled');
$yearsTo.removeAttr('disabled').val(toVal).removeClass('disabled');
}
}
//If Major is enabled
if($('#major').length) {
var $major = $('#major');
var val = $major.val() != 'N/A' ? $major.val() : '';
if(hsValue == '1')
$major.attr('disabled', 'disabled').val('N/A').addClass('disabled');
else
$major.removeAttr('disabled').val(val).removeClass('disabled');
}
//If Degree is enabled
if($('#degree').length) {
var $degree = $('#degree');
var val = $degree.val() != 'N/A' ? $degree.val() : '';
if(hsValue == '1')
$degree.attr('disabled', 'disabled').val('N/A').addClass('disabled');
else
$degree.removeAttr('disabled').val(val).removeClass('disabled');
}
},
handlePaste :
function (e) {
var t = e.target ? e.target : e.srcElement;
if(!$(t).data("EventListenerSet")) {
//get length of field before paste
var keyup = function(){
$(this).data("lastLength",$(this).val().length);
};
$(t).data("lastLength", $(t).val().length);
//catch paste event
var paste = function(){
$(this).data("paste",1); //Opera 11.11+
};
//process modified data, if paste occured
var func = function(){
if($(this).data("paste")){
var strTagStrippedText = this.value;
strTagStrippedText = strTagStrippedText.replace(/<\/p>/g, "\r\n\r\n");
strTagStrippedText = strTagStrippedText.replace(/
/g, "\r\n");
strTagStrippedText = strTagStrippedText.replace(/<\/?[^>]+(>|$)/g, "");
strTagStrippedText = strTagStrippedText.replace(/&[l|r]+dquo;/g, '"');
strTagStrippedText = strTagStrippedText.replace(/&[l|r]+squo;/g, "'");
strTagStrippedText = strTagStrippedText.replace(/…/g, "...");
strTagStrippedText = strTagStrippedText.replace(/&[n|m]+squo;/g, "'");
strTagStrippedText = strTagStrippedText.replace(/•/g, "\r\n");
// Search and destroy weird characters through converting to URL encoded versions.
strTagStrippedText = encodeURIComponent(strTagStrippedText);
// Double Curly Quotes
strTagStrippedText = strTagStrippedText.replace(/(\%E2\%80\%9C|\%E2\%80\%9D)/g, '"');
// Single Curly Quotes
strTagStrippedText = strTagStrippedText.replace(/(\%E2\%80\%98|\%E2\%80\%99)/g, "'");
// Ellipsis
strTagStrippedText = strTagStrippedText.replace(/\%E2\%80\%A6/g, "...");
// Emdash
strTagStrippedText = strTagStrippedText.replace(/\%E2\%80\%93/g, " - ");
// Bullet
strTagStrippedText = strTagStrippedText.replace(/\%E2\%80\%A2/g, " - ");
strTagStrippedText = decodeURIComponent(strTagStrippedText);
var strAmpStrippedText = strTagStrippedText.replace(/&[a-z]+;/g, " ");
strAmpStrippedText = strAmpStrippedText.replace(/[^\x20-\x7f\x0A\x0D]+/g, "");
strAmpStrippedText = strAmpStrippedText.replace(" ", " ");
while(true) {
if(strAmpStrippedText[0] == "\n" || strAmpStrippedText[0] == "\r" || strAmpStrippedText[0] == " ") {
strAmpStrippedText = strAmpStrippedText.substring(1);
} else {
break;
}
}
$(this).data("paste",0);
this.value = strAmpStrippedText;
$(t).data("lastLength", $(t).val().length);
}
};
if(window.addEventListener) {
t.addEventListener('keyup', keyup, false);
t.addEventListener('paste', paste, false);
t.addEventListener('input', func, false);
} else{ //IE
t.attachEvent('onkeyup', function() {keyup.call(t);});
t.attachEvent('onpaste', function() {paste.call(t);});
t.attachEvent('onpropertychange', function() {func.call(t);});
}
$(t).data("EventListenerSet",1);
}
},
validateHtmlTags :
function (text){
var tagRegex = /<(\/?\w+)[\sA-Z0-9\'\"\.\,\/=;\:\?\&\%\@+\-_]*>/gi;
var questionText = text.toLowerCase();
var searchingFor = [];
function checkHtmlTags(){
var result = tagRegex.exec(questionText);
//If regex finds nothing
if(result === null){
return searchingFor.length === 0;
// If an opening tag is found
}else if(result[1].charAt(0) !== '/'){
//Self closing tags that might possibly be used. There are others that exist, but they shouldn't be putting them in here.
if(result[1] !== 'br' && result[1] !== 'hr' && result[1] !== 'img')
searchingFor.push('/'+result[1]);
return checkHtmlTags();
// If a closing tag is found
} else if(result[1].charAt(0) === '/'){
if(searchingFor[searchingFor.length-1] === result[1]){
searchingFor.pop();
return checkHtmlTags();
}else
return false;
}
}
return checkHtmlTags();
},
checkSSNandDOBVerbiage :
function(check) {
if( check.toLowerCase().search(/\bssn\b/) > -1 ||
check.toLowerCase().search(/\bss#\b/) > -1 ||
check.toLowerCase().search(/\bss\b/) > -1 ||
check.toLowerCase().search(/\bssn#\b/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(security( *|_*))(number))/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(security))/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(card( *|_*))(#))/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(card( *|_*))(number))/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(security( *|_*))(card))/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(security( *|_*))(card( *|_*))(#))/) > -1 ||
check.toLowerCase().search(/\b((ss( *|_*))(card))\b/) > -1 ||
check.toLowerCase().search(/\b((ss( *|_*))(number))\b/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(number))/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(card))/) > -1 ||
check.toLowerCase().search(/((social( *|_*))(security))/) > -1 ||
check.toLowerCase().search(/((date( *|_*))(of( *|_*))(birth))/) > -1 ||
check.toLowerCase().search(/\b((d( *|_*))(0( *|_*))(b))\b/) > -1 ||
check.toLowerCase().search(/((birth( *|_*))(date))/) > -1 ||
check.toLowerCase().search(/((birth( *|_*))(day))/) > -1 ||
check.toLowerCase().search('mm/dd/yyyy') > -1 ||
check.toLowerCase().search('mm/dd/yy') > -1 ||
check.toLowerCase().indexOf('mm-dd-yyyy') > -1 ||
check.toLowerCase().search('mm-dd-yy') > -1 ||
check.toLowerCase().search(/\b([x0-9]{3}-[x0-9]{2}-[x0-9]{4})\b/) > -1 ||
check.toLowerCase().search(/\b([x0-9]{3} [x0-9]{2} [x0-9]{4})\b/) > -1) {
return true;
} else {
check = check.replace(/\s+/g, '');
if( check.toLowerCase().search('socialcard') > -1 ||
check.toLowerCase().search('socialcardnumber') > -1 ||
check.toLowerCase().search('socialsecuritycard') > -1 ||
check.toLowerCase().search('socialnumber') > -1 ||
check.toLowerCase().search('socialsecuritynumber') > -1 ||
check.toLowerCase().search('dateofbirth') > -1 ||
check.toLowerCase().search('birthday') > -1 ) {
return true;
} else {
return false;
}
}
},
checkDOBVerbiage :
function(check) {
if( check.toLowerCase().search(/((date( *|_*))(of( *|_*))(birth))/) > -1 ||
check.toLowerCase().search(/\b((d( *|_*))(0( *|_*))(b))\b/) > -1 ||
check.toLowerCase().search(/((birth( *|_*))(date))/) > -1 ||
check.toLowerCase().search(/((birth( *|_*))(day))/) > -1 ||
check.toLowerCase().search('mm/dd/yyyy') > -1 ||
check.toLowerCase().search('mm/dd/yy') > -1 ||
check.toLowerCase().indexOf('mm-dd-yyyy') > -1 ||
check.toLowerCase().search('mm-dd-yy') > -1) {
return true;
} else {
check = check.replace(/\s+/g, '');
if( check.toLowerCase().search('dateofbirth') > -1 ||
check.toLowerCase().search('birthday') > -1 ) {
return true;
} else {
return false;
}
}
}
};
// New Validation System. Use a class of "required" to validate the input
var V = {
//errorId : 'error',
isForm: false,
//$e : {},
init :
function($div) {
var $base = A.isDefined($div) ? $div : $(document);
$base.find('form.validate :input').each(function() {
var $t = $(this);
if($t.prop('tagName') == 'SELECT') {
$t.on('change', function() {
V.field($t);
}).on('blur', function() {
V.field($t);
});
} else if($t.prop('type') == 'checkbox' || $t.prop('type') == 'radio') {
$t.on('click', function() {
V.field($t);
});
// Set it so all check boxes will be 0 or 1 when clicked on
if($t.prop('type') == 'checkbox' && $t.get(0).onclick == null)
$t.on('click', function() { if(this.value == '1') this.value = '0'; else this.value = '1'; });
} else {
$t.on('blur', function() {
V.field($t);
});
}
if($t.data('maxlength')) {
var maxlength = $t.data('maxlength');
$t.prop('maxlength', maxlength + 1);
}
});
$('form.validate.onsubmit').on('submit', function() {
// no-conflict: for times when you have multiple forms on the page and their validity depends on naught but their individual results from V.form
if($(this).hasClass('no-conflict'))
$('.sticky.formError:eq(0)').remove();
if(!V.form($(this)))
return false;
});
/*
var $error = $('#' + V.errorId);
var $ul = $(document.createElement('ul')).addClass('error-list');
if($error.length) {
$error.append($ul);
V.$e = $error;
}
*/
},
form :
function(formId) {
// Thanks to jquery 2.0.3, it freaks out on the $fields var below if there's no formId
if(typeof(formId) == 'undefined' || !formId || formId == '')
return true;
var failed = false, errorText = 'Please complete all required fields to proceed.';
var $fields = typeof(formId) == 'string' ? $('#' + formId + ' :input') : formId.find(':input');
V.isForm = true;
var groups = [];
$fields.each(function() {
$t = $(this);
// Make sure that the input is visible. We don't need to validate what the user can't see.
if($t.closest('dd').length > 0) {
$is_visible = $t.closest('dd').is(':visible');
} else {
$is_visible = $t.is(':visible');
}
// Check if the field is part of a group and, if ti is, only validate the group
if($t.closest('div.check-group').length && $t.hasClass('required') && $is_visible) {
// Make sure each group is only validated once
if($.inArray($t.attr('name'), groups) == -1) {
groups.push($t.attr('name'));
if(!V.field($t.closest('fieldset'))) {
failed = true;
}
}
} else if($is_visible) {
if(!V.field($t)) {
failed = true;
}
} else if($t.attr('id') === 'sig_output' && $t.hasClass('required') && !$is_visible) {
// Applicants shouldn't bypass the signature on the applicant statement(disclosure). eform-approval also uses it but not required.
if(!V.field($t)) {
failed = true;
}
}
});
//if(failed || V.$e.find('li').length) {
if(failed) {
//if(V.$e.find('li').length)
//V.$e.fadeIn();
V.isForm = false;
V.addError(errorText, '', true);
return false;
} else {
//if(!V.$e.find('li').length)
// V.$e.fadeOut();
V.isForm = false;
V.removeError(errorText);
if(typeof formId == 'object' && formId.hasClass('no-conflict'))
return true;
// Make sure there are no lingering errors like duplicate check
if($('.sticky.formError:eq(0)').html() == '' || !$('.sticky.formError:eq(0)').length)
return true;
}
},
field :
function(element) {
var failed = false, addAlertText = [], removeAlertText = [], i = 0,
$parentForm, $this, $div, customText = '',
emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
phoneRegex = /[^0-9\(\)\-\+\. ]+|^[^\d]*$/,
placeholderText;
if(element.jquery)
$this = $(element);
else
$this = element;
// Just for radios/checkboxes
$div = $this.closest('div.check-group');
// If only validating a single field, make sure that it isn't part of a group
if($div.length && $this.hasClass('required'))
$this = $this.closest('fieldset');
// if it is a multiple select, make sure that all the fields are automatically selected before putting them through the check.
if($this.prop('tagName') == 'SELECT' && !$this.hasClass('SumoSelectBox') && ($this.attr('multiple') == 'multiple' || $this.attr('multiple') == '')) {
$this.find('option').prop('selected',true);
}
// Handle checkboxes and radios
if(($this.prop('type') == 'checkbox' || $this.prop('type') == 'radio')) {
switch($this.prop('name')) {
case 'sex_type':
customText = 'You must choose a Sex/Gender';
break;
case 'ethnic_type':
customText = 'You must choose an Ethnicity';
break;
case 'vet':
customText = 'You must choose a VET100 Classification';
break;
case 'veta':
customText = 'You must choose a VET100A Classification';
break;
case 'is_vet_2014':
customText = 'You must choose a Veteran Classification';
break;
case 'is_disabled':
customText = 'You must choose a Disability Classification';
break;
}
if(($div.find(':input').hasClass('required') || $div.find(':input').hasClass('v')) && !$div.find(':input:checked').length) {
if(customText != '')
V.addFieldError(customText, true, $this);
else if(A.isDefined($this.data('question-number')) && $this.data('question-number') != '')
addAlertText.push("Fix Question #" + $this.data('question-number')+" is missing.");
else if(A.isDefined($this.data('question-title')) && $this.data('question-title') != '')
addAlertText.push($this.data('question-title')+" is missing.");
else if(A.isDefined($this.attr('placeholder')) && $this.attr('placeholder') != '' && !A.isDefined($this.data('question-title'))) {
placeholderText = $this.attr('placeholder');
placeholderText = placeholderText.replace('*', '');
addAlertText.push(placeholderText+" is missing.");
}
failed = true;
} else {
if(customText != '')
V.removeFieldError($this);
else if(A.isDefined($this.data('question-number')) && $this.data('question-number') != '')
removeAlertText.push("Fix Question #" + $this.data('question-number'));
else if(A.isDefined($this.data('question-title')) && $this.data('question-title') != '')
removeAlertText.push($this.data('question-title'));
else if(A.isDefined($this.attr('placeholder')) && $this.attr('placeholder') != '' && !A.isDefined($this.data('question-title'))) {
placeholderText = $this.attr('placeholder');
placeholderText = placeholderText.replace('*', '');
removeAlertText.push(placeholderText+" is missing.");
}
}
// For jointly required checkboxes
} else if($this.prop('tagName') == 'FIELDSET') {
if(!$this.find('input:checked').length) {
addAlertText.push("You must select at least one option.");
failed = true;
} else removeAlertText.push("You must select at least one option.");
// Set this to the first child, that is an input, so that the addFieldError method can select it by name
$this = $this.find("input:first");
// all other form inputs
} else {
if($this.hasClass('required') || $this.hasClass('v')) {
switch($this.val()) {
case undefined:
case false:
case null:
case "":
case " ":
failed = true;
break;
case 0:
case '0':
if(!$this.hasClass('zeroValue') && $this.prop('tagName') == 'SELECT')
failed = true;
break;
default:
if(!A.supportsPlaceholders && $this.attr('placeholder') == $this.val())
failed = true;
break;
}
}
if(A.isDefined($this.data('question-number')) && $this.data('question-number') != '') {
if(failed) {
addAlertText.push("Fix Question #" + $this.data('question-number'));
} else {
removeAlertText.push("Fix Question #" + $this.data('question-number'));
}
}
if(A.isDefined($this.data('question-title')) && $this.data('question-title') != '') {
if(failed) {
addAlertText.push($this.data('question-title')+" is missing.");
} else {
removeAlertText.push($this.data('question-title')+" is missing.");
}
}
if(A.isDefined($this.attr('placeholder')) && $this.attr('placeholder') != '' && !A.isDefined($this.data('question-title'))) {
if(failed) {
placeholderText = $this.attr('placeholder');
placeholderText = placeholderText.replace('*', '');
addAlertText.push(placeholderText+" is missing.");
} else {
placeholderText = $this.attr('placeholder');
placeholderText = placeholderText.replace('*', '');
removeAlertText.push(placeholderText+" is missing.");
}
}
if($this.prop('tagName') == 'SELECT') {
if(failed) {
placeholderText = $("#"+$this.attr('id')+" option:selected").text();
placeholderText = placeholderText.replace('*', '');
placeholderText = placeholderText == '' ? 'Preference' : placeholderText;
addAlertText.push(placeholderText+" is missing.");
} else {
placeholderText = $("#"+$this.attr('id')+" option:selected").text();
placeholderText = placeholderText.replace('*', '');
placeholderText = placeholderText == '' ? 'Preference' : placeholderText;
removeAlertText.push(placeholderText+" is missing.");
}
}
$parentForm = $this.closest('form');
var $email = $parentForm.find('input[name="email"]'),
$emailConfirm = $parentForm.find('input[name="email_confirm"]');
if(!failed && $this.val() != "") {
switch($this.prop('name')) {
case 'email':
case 'email_confirm':
case 'email_address':
case 'supervisor_email':
if(emailRegex.test($this.val()) === false) {
failed = true;
addAlertText.push("Invalid email address.");
} else {
removeAlertText.push("Invalid email address.");
}
// Check for validation issues with confirming emails.
if($email.length && $emailConfirm.length) {
var emailConfirmText = "The email addresses you have entered do not match. Please make sure that both email addresses match before proceeding.";
if($emailConfirm.val().length > 0 && $email.val().length > 0 && $email.val().toLowerCase() != $emailConfirm.val().toLowerCase()) {
failed = true;
addAlertText.push(emailConfirmText);
} else {
removeAlertText.push(emailConfirmText);
}
}
break;
case 'password':
case 'password_confirm':
var $password = $parentForm.find('input[name="password"]');
var $passwordConfirm = $parentForm.find('input[name="password_confirm"]');
var passwordConfirmText = "The passwords you have entered do not match. Please make sure that both passwords match before proceeding.";
if($passwordConfirm.length && $password.val().length > 0 && $passwordConfirm.val().length > 0 && $password.val() != $passwordConfirm.val()) {
failed = true;
addAlertText.push(passwordConfirmText);
} else {
removeAlertText.push(passwordConfirmText);
}
break;
case 'contact_number':
case 'phone_number':
case 'supervisor_phone':
case 'phone':
if(phoneRegex.test($this.val()) === true) {
failed = true;
addAlertText.push("Field must be a valid phone number");
} else {
removeAlertText.push("Field must be a valid phone number");
}
var $country = $parentForm.find('select[name="country_id"]');
if($this.val().length < 7 && $country.val() == 226 ){
failed = true;
addAlertText.push("The phone number must be at least 7 digits long");
}
else{
removeAlertText.push("The phone number must be at least 7 digits long");
}
break;
case 'zip':
case 'zip_code':
case 'job_board_zip':
var $country = $parentForm.find('select[name="country_id"]');
if($this.val().length < 5 && $country.val() == 226 ){
failed = true;
addAlertText.push("The zip/postal code must be at least 5 digits long");
}
else{
removeAlertText.push("The zip/postal code must be at least 5 digits long");
}
break;
default:
// If the input needs to be validated for digits
if($this.hasClass('digit')) {
if(/[^0-9]+/.test($this.val()) === true) {
addAlertText.push("Field must be a digit with no other characters or spaces.");
failed = true;
} else {
removeAlertText.push("Field must be a digit with no other characters or spaces.");
}
// If the input needs to be validated for ASCII valid characters
} if($this.hasClass('ascii')) {
if(/[^\x20-\x7f\x0A\x0D]+/.test($this.val()) === true) {
addAlertText.push("There are unusual characters in a field. You may have tried to copy and paste the text in this field. Try typing the field out by hand and attempt again.");
failed = true;
} else {
removeAlertText.push("There are unusual characters in a field. You may have tried to copy and paste the text in this field. Try typing the field out by hand and attempt again.");
}
// If the input needs to be validated for letters, numbers, and the characters _ - . No spaces (ideally for a username)
} if($this.hasClass('filename')) {
if(/[^\w\-\.]+/.test($this.val()) === true) {
addAlertText.push("Field should only have letters, numbers, and the characters _ - . . No spaces or other characters are allowed.");
failed = true;
} else {
removeAlertText.push("Field should only have letters, numbers, and the characters _ - . . No spaces or other characters are allowed.");
}
// If the input needs to be validated for a subdomain. (Same as filename, just no period)
} if($this.hasClass('subdomain')) {
if(/[^\w\-]+/.test($this.val()) === true) {
addAlertText.push("Field should only be letters, numbers, and the characters _ and - . No spaces or other characters are allowed.");
failed = true;
} else {
removeAlertText.push("Field should only be letters, numbers, and the characters _ and - . No spaces or other characters are allowed.");
}
// If the input needs to be validated for decimals (as in currency)
} if($this.hasClass('currency')) {
if(/[0-9]+\.[0-9]{2}/.test($this.val()) === false) {
addAlertText.push("Field must be in standard currency format, e.g. 10.00.");
failed = true;
} else {
removeAlertText.push("Field must be in standard currency format, e.g. 10.00.");
}
}
break;
}
}
if(!failed && $this.data('maxlength') > 0) {
var maxLength = $this.data('maxlength'),
characters = $this.val().length;
if(characters > maxLength) {
addAlertText.push('You have exceeded the maximum allowed characters. Maximum: ' + maxLength);
failed = true;
} else
removeAlertText.push('You have exceeded the maximum allowed characters. Maximum: ' + maxLength);
}
} // end if form inputs
// Add Errors....
for(i in addAlertText) {
V.addFieldError(addAlertText[i], true, $this);
}
// Remove Errors....
for(i in removeAlertText) {
V.removeFieldError($this);
}
// If the input failed
if(failed) {
if($this.prop('type') == 'checkbox' || $this.prop('type') == 'radio') {
$div.find('img').remove();
$div.addClass('check-validationFailed');
checkboxID = ($this.attr('id'));
checkboxText = ($this.attr('iferrText'));
if($("#error-"+checkboxID).length < 1 && checkboxText)
$("Error: "+checkboxText+"
").insertAfter($div);
//$div.removeClass('check-validated');
//$div.append('
');
} else if ($this.hasClass('SumoSelectBox')) {
$this.siblings('p.SelectBox')
.attr('aria-invalid', 'true')
.addClass('validationFailed')
.removeClass('validated');
}
$this.attr('aria-invalid', 'true');
$this.addClass('validationFailed');
$this.removeClass('validated');
return false;
} else {
if($this.prop('type') == 'checkbox' || $this.prop('type') == 'radio') {
$div.find('img').remove();
$div.removeClass('check-validationFailed');
//$div.removeClass('check-validated');
checkboxID = ($this.attr('id'));
$("#error-"+checkboxID).remove();
$div.append('
');
} else if ($this.hasClass('SumoSelectBox')) {
$this.siblings('p.SelectBox')
.attr('aria-invalid', 'false')
.removeClass('validationFailed')
.addClass('validated');
}
$this.attr('aria-invalid', 'false');
$this.removeClass('validationFailed');
$this.addClass('validated');
switch($this.prop('name')) {
case 'email':
case 'email_confirm':
if($email.val() && $emailConfirm.length) {
$email.removeClass('validationFailed');
$email.addClass('validated');
}
if($emailConfirm.val()) {
$emailConfirm.removeClass('validationFailed');
$emailConfirm.addClass('validated');
}
break;
}
return true;
}
},
addError :
function(message, force, prepend) {
var e = $('.sticky.formError:eq(0)'), eul = e.find('ul'), found = false, canClose, cleanedMessage = message.replace(/<.+>/g, '');
if(e.length) {
eul.find('li').each(function(index) {
//This doublecheck nonsense is to account for the possibility of google translate
if($(this).data('orig-text').indexOf(cleanedMessage) != -1 || $(this).html().indexOf(message) != -1) {
found = true;
return;
}
});
if(!found) {
if(prepend)
eul.prepend('' + message + '');
else
eul.append('' + message + '');
//if(!V.isForm && e.is(':hidden'))
// e.fadeIn();
}
} else if(!V.isForm || force == true) {
canClose = A.isMobile ? true : false;
e = N.add('', { forceStatus : 'error', canClose : canClose, uniqueClass: 'formError'});
}
},
removeError :
function(message, force) {
var e = $('.sticky.formError:eq(0)'), eul = e.find('ul'), found = false, liIndex, eId, cleanedMessage = message.replace(/<.+>/g, '');
eul.find('li').each(function(index) {
//This doublecheck nonsense is to account for the possibility of google translate
if($(this).data('orig-text').indexOf(cleanedMessage) != -1 || $(this).html().indexOf(message) != -1) {
found = true;
liIndex = index;
return;
}
});
if(found) {
if((!V.isForm || force == true) && e.is(':visible')) {
if(eul.find('li').length == 1) {
e.empty();
eId = e.prop('id');
eId = eId.match(/[0-9]+/);
N.close(eId);
//e.fadeOut(function() {
// eul.html('');
//});
} else {
eul.find('li:eq(' + liIndex + ')').remove();
}
}
}
},
addFieldError :
function(message, force, element, useIdInsteadOfName) {
useIdInsteadOfName = typeof useIdInsteadOfName === 'undefined' ? false : useIdInsteadOfName;
setTimeout(function() {
var id = $(element).attr('name');
if(!id || useIdInsteadOfName)
id = $(element).attr('id');
id = id.replace("[]", "");
if(!$("#error_"+id).length) {
var cleanedMessage = message.replace(/<.+>/g, '');
var error_message = "Error: "+cleanedMessage+"
";
var error = $(""+error_message+"
");
if( $('.errors_div').length )
$('.errors_div').append(error_message);
// Handle Checkboxes and Radio Buttons
if((element.prop('type') == 'checkbox' || element.prop('type') == 'radio')) {
var div = element.closest('fieldset');
error.insertAfter(div);
// Handle the signature in the applicant statement
} else if(element.prop('name') == 'output') {
var div = element.closest('.sigWrapper');
error.insertAfter(div);
} else
error.insertAfter(element);
}
}, 150);
},
removeFieldError :
function(element, useIdInsteadOfName) {
useIdInsteadOfName = typeof useIdInsteadOfName === 'undefined' ? false : useIdInsteadOfName;
var id = $(element).attr('name');
if(!id || useIdInsteadOfName)
id = $(element).attr('id');
// if it's empty for some reason
if(!id)
return;
id = id.replace("[]", "");
$("#error_"+id).remove();
$("#message_"+id).remove();
if(id == 'email_confirm' && $("#error_email:contains('do not match')"))
$("#error_email").remove();
},
clearErrors :
function() {
$('.sticky.formError:eq(0)').fadeOut(function () {
$(this).remove();
});
},
duplicate :
function(func, $field) {
A.getJson(func, {field : $field.prop('name'), value : $field.val() }, function(result) {
if(result) {
if(result.failed) {
V.addError(result.message);
} else {
V.removeError(result.message);
}
}
});
},
checkRequestUri :
// ATS-43375 : Fix Cross-Site Scripting Vulnerabilities
function (request_uri) {
var found_cnt = 0;
var prohibited_terms = ["window.", "location.", ".length", ".html(",
".remove(", "contains(", "encodeURI(", "substring(", "charat(", "split(",
"cookie.", "indexof(", "atob(", "btoa(", "onload", "onerror", "$.ajax",
"$.get", "$.post", "