Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/redux-fr.../redux-co.../assets/js/vendor
File: jquery.alphanum.js
// jscs:disable
[0] Fix | Delete
// jshint ignore: start
[1] Fix | Delete
[2] Fix | Delete
/********************************************************************
[3] Fix | Delete
* Limit the characters that may be entered in a text field
[4] Fix | Delete
* Common options: alphanumeric, alphabetic or numeric
[5] Fix | Delete
* Kevin Sheedy, 2012
[6] Fix | Delete
* http://github.com/KevinSheedy/jquery.alphanum
[7] Fix | Delete
*********************************************************************/
[8] Fix | Delete
[9] Fix | Delete
(function( $ ) {
[10] Fix | Delete
// API ///////////////////////////////////////////////////////////////////
[11] Fix | Delete
$.fn.alphanum = function( settings ) {
[12] Fix | Delete
[13] Fix | Delete
var combinedSettings = getCombinedSettingsAlphaNum( settings );
[14] Fix | Delete
[15] Fix | Delete
var $collection = this;
[16] Fix | Delete
[17] Fix | Delete
setupEventHandlers( $collection, trimAlphaNum, combinedSettings );
[18] Fix | Delete
[19] Fix | Delete
return this;
[20] Fix | Delete
};
[21] Fix | Delete
[22] Fix | Delete
$.fn.alpha = function( settings ) {
[23] Fix | Delete
[24] Fix | Delete
var defaultAlphaSettings = getCombinedSettingsAlphaNum( 'alpha' );
[25] Fix | Delete
var combinedSettings = getCombinedSettingsAlphaNum( settings, defaultAlphaSettings );
[26] Fix | Delete
[27] Fix | Delete
var $collection = this;
[28] Fix | Delete
[29] Fix | Delete
setupEventHandlers( $collection, trimAlphaNum, combinedSettings );
[30] Fix | Delete
[31] Fix | Delete
return this;
[32] Fix | Delete
};
[33] Fix | Delete
[34] Fix | Delete
$.fn.numeric = function( settings ) {
[35] Fix | Delete
[36] Fix | Delete
var combinedSettings = getCombinedSettingsNum( settings );
[37] Fix | Delete
var $collection = this;
[38] Fix | Delete
[39] Fix | Delete
setupEventHandlers( $collection, trimNum, combinedSettings );
[40] Fix | Delete
[41] Fix | Delete
$collection.on(
[42] Fix | Delete
'blur',
[43] Fix | Delete
function() {
[44] Fix | Delete
numericField_Blur( this, settings );
[45] Fix | Delete
}
[46] Fix | Delete
);
[47] Fix | Delete
[48] Fix | Delete
return this;
[49] Fix | Delete
};
[50] Fix | Delete
[51] Fix | Delete
// End of API /////////////////////////////////////////////////////////////
[52] Fix | Delete
[53] Fix | Delete
// Start Settings ////////////////////////////////////////////////////////
[54] Fix | Delete
[55] Fix | Delete
var DEFAULT_SETTINGS_ALPHANUM = {
[56] Fix | Delete
allow: '', // Allow extra characters
[57] Fix | Delete
disallow: '', // Disallow extra characters
[58] Fix | Delete
allowSpace: true, // Allow the space character
[59] Fix | Delete
allowNumeric: true, // Allow digits 0-9
[60] Fix | Delete
allowUpper: true, // Allow upper case characters
[61] Fix | Delete
allowLower: true, // Allow lower case characters
[62] Fix | Delete
allowCaseless: true, // Allow characters that don't have both upper & lower variants - eg Arabic or Chinese
[63] Fix | Delete
allowLatin: true, // a-z A-Z
[64] Fix | Delete
allowOtherCharSets: true, // eg �, �, Arabic, Chinese etc
[65] Fix | Delete
maxLength: NaN // eg Max Length
[66] Fix | Delete
};
[67] Fix | Delete
[68] Fix | Delete
var DEFAULT_SETTINGS_NUM = {
[69] Fix | Delete
allowPlus: false, // Allow the + sign
[70] Fix | Delete
allowMinus: true, // Allow the - sign
[71] Fix | Delete
allowThouSep: true, // Allow the thousands separator, default is the comma eg 12,000
[72] Fix | Delete
allowDecSep: true, // Allow the decimal separator, default is the fullstop eg 3.141
[73] Fix | Delete
allowLeadingSpaces: false, maxDigits: NaN, // The max number of digits
[74] Fix | Delete
maxDecimalPlaces: NaN, // The max number of decimal places
[75] Fix | Delete
maxPreDecimalPlaces: NaN, // The max number digits before the decimal point
[76] Fix | Delete
max: NaN, // The max numeric value allowed
[77] Fix | Delete
min: NaN // The min numeric value allowed
[78] Fix | Delete
};
[79] Fix | Delete
[80] Fix | Delete
// Some pre-defined groups of settings for convenience
[81] Fix | Delete
var CONVENIENCE_SETTINGS_ALPHANUM = {
[82] Fix | Delete
'alpha': {
[83] Fix | Delete
allowNumeric: false
[84] Fix | Delete
}, 'upper': {
[85] Fix | Delete
allowNumeric: false, allowUpper: true, allowLower: false, allowCaseless: true
[86] Fix | Delete
}, 'lower': {
[87] Fix | Delete
allowNumeric: false, allowUpper: false, allowLower: true, allowCaseless: true
[88] Fix | Delete
}
[89] Fix | Delete
};
[90] Fix | Delete
[91] Fix | Delete
// Some pre-defined groups of settings for convenience
[92] Fix | Delete
var CONVENIENCE_SETTINGS_NUMERIC = {
[93] Fix | Delete
'integer': {
[94] Fix | Delete
allowPlus: false, allowMinus: true, allowThouSep: false, allowDecSep: false
[95] Fix | Delete
}, 'positiveInteger': {
[96] Fix | Delete
allowPlus: false, allowMinus: false, allowThouSep: false, allowDecSep: false
[97] Fix | Delete
}
[98] Fix | Delete
};
[99] Fix | Delete
[100] Fix | Delete
var BLACKLIST = getBlacklistAscii() + getBlacklistNonAscii();
[101] Fix | Delete
var THOU_SEP = ',';
[102] Fix | Delete
var DEC_SEP = '.';
[103] Fix | Delete
var DIGITS = getDigitsMap();
[104] Fix | Delete
var LATIN_CHARS = getLatinCharsSet();
[105] Fix | Delete
[106] Fix | Delete
// Return the blacklisted special chars that are encodable using 7-bit ascii
[107] Fix | Delete
function getBlacklistAscii() {
[108] Fix | Delete
var blacklist = '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.-_';
[109] Fix | Delete
blacklist += ' '; // 'Space' is on the blacklist but can be enabled using the 'allowSpace' config entry
[110] Fix | Delete
return blacklist;
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
// Return the blacklisted special chars that are NOT encodable using 7-bit ascii
[114] Fix | Delete
// We want this .js file to be encoded using 7-bit ascii so it can reach the widest possible audience
[115] Fix | Delete
// Higher order chars must be escaped eg "\xAC"
[116] Fix | Delete
// Not too worried about comments containing higher order characters for now (let's wait and see if it becomes a problem)
[117] Fix | Delete
function getBlacklistNonAscii() {
[118] Fix | Delete
var blacklist = '\xAC' // �
[119] Fix | Delete
+ '\u20AC' // �
[120] Fix | Delete
+ '\xA3' // �
[121] Fix | Delete
+ '\xA6' // �
[122] Fix | Delete
;
[123] Fix | Delete
return blacklist;
[124] Fix | Delete
}
[125] Fix | Delete
[126] Fix | Delete
// End Settings ////////////////////////////////////////////////////////
[127] Fix | Delete
[128] Fix | Delete
// Implementation details go here ////////////////////////////////////////////////////////
[129] Fix | Delete
[130] Fix | Delete
function setupEventHandlers( $textboxes, trimFunction, settings ) {
[131] Fix | Delete
[132] Fix | Delete
$textboxes.each( function() {
[133] Fix | Delete
[134] Fix | Delete
var $textbox = $( this );
[135] Fix | Delete
[136] Fix | Delete
$textbox.on( 'keyup change paste', function( e ) {
[137] Fix | Delete
[138] Fix | Delete
var pastedText = '';
[139] Fix | Delete
[140] Fix | Delete
if ( e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData ) pastedText = e.originalEvent.clipboardData.getData(
[141] Fix | Delete
'text/plain' );
[142] Fix | Delete
[143] Fix | Delete
// setTimeout is necessary for handling the 'paste' event
[144] Fix | Delete
setTimeout( function() {
[145] Fix | Delete
trimTextbox( $textbox, trimFunction, settings, pastedText );
[146] Fix | Delete
}, 0 );
[147] Fix | Delete
} );
[148] Fix | Delete
[149] Fix | Delete
$textbox.on( 'keypress', function( e ) {
[150] Fix | Delete
[151] Fix | Delete
// Determine which key is pressed.
[152] Fix | Delete
// If it's a control key, then allow the event's default action to occur eg backspace, tab
[153] Fix | Delete
var charCode = !e.charCode ? e.which : e.charCode;
[154] Fix | Delete
if ( isControlKey( charCode ) || e.ctrlKey || e.metaKey ) // cmd on MacOS
[155] Fix | Delete
return;
[156] Fix | Delete
[157] Fix | Delete
var newChar = String.fromCharCode( charCode );
[158] Fix | Delete
[159] Fix | Delete
// Determine if some text was selected / highlighted when the key was pressed
[160] Fix | Delete
var selectionObject = $textbox.selection();
[161] Fix | Delete
var start = selectionObject.start;
[162] Fix | Delete
var end = selectionObject.end;
[163] Fix | Delete
[164] Fix | Delete
var textBeforeKeypress = $textbox.val();
[165] Fix | Delete
[166] Fix | Delete
// The new char may be inserted:
[167] Fix | Delete
// 1) At the start
[168] Fix | Delete
// 2) In the middle
[169] Fix | Delete
// 3) At the end
[170] Fix | Delete
// 4) User highlights some text and then presses a key which would replace the highlighted text
[171] Fix | Delete
//
[172] Fix | Delete
// Here we build the string that would result after the keypress.
[173] Fix | Delete
// If the resulting string is invalid, we cancel the event.
[174] Fix | Delete
// Unfortunately, it isn't enough to just check if the new char is valid because some chars
[175] Fix | Delete
// are position sensitive eg the decimal point '.'' or the minus sign '-'' are only valid in certain positions.
[176] Fix | Delete
var potentialTextAfterKeypress = textBeforeKeypress.substring( 0, start ) + newChar + textBeforeKeypress.substring( end );
[177] Fix | Delete
var validatedText = trimFunction( potentialTextAfterKeypress, settings );
[178] Fix | Delete
[179] Fix | Delete
// If the keypress would cause the textbox to contain invalid characters, then cancel the keypress event
[180] Fix | Delete
if ( validatedText != potentialTextAfterKeypress ) e.preventDefault();
[181] Fix | Delete
} );
[182] Fix | Delete
} );
[183] Fix | Delete
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
// Ensure the text is a valid number when focus leaves the textbox
[187] Fix | Delete
// This catches the case where a user enters '-' or '.' without entering any digits
[188] Fix | Delete
function numericField_Blur( inputBox, settings ) {
[189] Fix | Delete
var fieldValueNumeric = parseFloat( $( inputBox ).val() );
[190] Fix | Delete
var $inputBox = $( inputBox );
[191] Fix | Delete
[192] Fix | Delete
if ( isNaN( fieldValueNumeric ) ) {
[193] Fix | Delete
$inputBox.val( '' );
[194] Fix | Delete
return;
[195] Fix | Delete
}
[196] Fix | Delete
[197] Fix | Delete
if ( isNumeric( settings.min ) && fieldValueNumeric < settings.min ) $inputBox.val( '' );
[198] Fix | Delete
[199] Fix | Delete
if ( isNumeric( settings.max ) && fieldValueNumeric > settings.max ) $inputBox.val( '' );
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
function isNumeric( value ) {
[203] Fix | Delete
return !isNaN( value );
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
function isControlKey( charCode ) {
[207] Fix | Delete
[208] Fix | Delete
if ( charCode >= 32 ) return false;
[209] Fix | Delete
if ( charCode == 10 ) return false;
[210] Fix | Delete
if ( charCode == 13 ) return false;
[211] Fix | Delete
[212] Fix | Delete
return true;
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
// One way to prevent a character being entered is to cancel the keypress event.
[216] Fix | Delete
// However, this gets messy when you have to deal with things like copy paste which isn't a keypress.
[217] Fix | Delete
// Which event gets fired first, keypress or keyup? What about IE6 etc etc?
[218] Fix | Delete
// Instead, it's easier to allow the 'bad' character to be entered and then to delete it immediately after.
[219] Fix | Delete
[220] Fix | Delete
function trimTextbox( $textBox, trimFunction, settings, pastedText ) {
[221] Fix | Delete
[222] Fix | Delete
var inputString = $textBox.val();
[223] Fix | Delete
[224] Fix | Delete
if ( inputString == '' && pastedText.length > 0 ) inputString = pastedText;
[225] Fix | Delete
[226] Fix | Delete
var outputString = trimFunction( inputString, settings );
[227] Fix | Delete
[228] Fix | Delete
if ( inputString == outputString ) return;
[229] Fix | Delete
[230] Fix | Delete
var caretPos = $textBox.alphanum_caret();
[231] Fix | Delete
[232] Fix | Delete
$textBox.val( outputString );
[233] Fix | Delete
[234] Fix | Delete
//Reset the caret position
[235] Fix | Delete
if ( inputString.length == (outputString.length + 1) ) $textBox.alphanum_caret( caretPos - 1 ); else $textBox.alphanum_caret( caretPos );
[236] Fix | Delete
}
[237] Fix | Delete
[238] Fix | Delete
function getCombinedSettingsAlphaNum( settings, defaultSettings ) {
[239] Fix | Delete
if ( typeof defaultSettings == 'undefined' ) defaultSettings = DEFAULT_SETTINGS_ALPHANUM;
[240] Fix | Delete
var userSettings, combinedSettings = {};
[241] Fix | Delete
if ( typeof settings === 'string' ) userSettings = CONVENIENCE_SETTINGS_ALPHANUM[settings]; else if ( typeof settings == 'undefined' ) userSettings = {}; else userSettings = settings;
[242] Fix | Delete
[243] Fix | Delete
$.extend( combinedSettings, defaultSettings, userSettings );
[244] Fix | Delete
[245] Fix | Delete
if ( typeof combinedSettings.blacklist == 'undefined' ) combinedSettings.blacklistSet = getBlacklistSet(
[246] Fix | Delete
combinedSettings.allow, combinedSettings.disallow );
[247] Fix | Delete
[248] Fix | Delete
return combinedSettings;
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
function getCombinedSettingsNum( settings ) {
[252] Fix | Delete
var userSettings, combinedSettings = {};
[253] Fix | Delete
if ( typeof settings === 'string' ) userSettings = CONVENIENCE_SETTINGS_NUMERIC[settings]; else if ( typeof settings == 'undefined' ) userSettings = {}; else userSettings = settings;
[254] Fix | Delete
[255] Fix | Delete
$.extend( combinedSettings, DEFAULT_SETTINGS_NUM, userSettings );
[256] Fix | Delete
[257] Fix | Delete
return combinedSettings;
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
// This is the heart of the algorithm
[261] Fix | Delete
function alphanum_allowChar( validatedStringFragment, Char, settings ) {
[262] Fix | Delete
[263] Fix | Delete
if ( settings.maxLength && validatedStringFragment.length >= settings.maxLength ) return false;
[264] Fix | Delete
[265] Fix | Delete
if ( settings.allow.indexOf( Char ) >= 0 ) return true;
[266] Fix | Delete
[267] Fix | Delete
if ( settings.allowSpace && (Char == ' ') ) return true;
[268] Fix | Delete
[269] Fix | Delete
if ( settings.blacklistSet.contains( Char ) ) return false;
[270] Fix | Delete
[271] Fix | Delete
if ( !settings.allowNumeric && DIGITS[Char] ) return false;
[272] Fix | Delete
[273] Fix | Delete
if ( !settings.allowUpper && isUpper( Char ) ) return false;
[274] Fix | Delete
[275] Fix | Delete
if ( !settings.allowLower && isLower( Char ) ) return false;
[276] Fix | Delete
[277] Fix | Delete
if ( !settings.allowCaseless && isCaseless( Char ) ) return false;
[278] Fix | Delete
[279] Fix | Delete
if ( !settings.allowLatin && LATIN_CHARS.contains( Char ) ) return false;
[280] Fix | Delete
[281] Fix | Delete
if ( !settings.allowOtherCharSets ) {
[282] Fix | Delete
if ( DIGITS[Char] || LATIN_CHARS.contains( Char ) ) return true; else return false;
[283] Fix | Delete
}
[284] Fix | Delete
[285] Fix | Delete
return true;
[286] Fix | Delete
}
[287] Fix | Delete
[288] Fix | Delete
function numeric_allowChar( validatedStringFragment, Char, settings ) {
[289] Fix | Delete
[290] Fix | Delete
if ( DIGITS[Char] ) {
[291] Fix | Delete
[292] Fix | Delete
if ( isMaxDigitsReached( validatedStringFragment, settings ) ) return false;
[293] Fix | Delete
[294] Fix | Delete
if ( isMaxPreDecimalsReached( validatedStringFragment, settings ) ) return false;
[295] Fix | Delete
[296] Fix | Delete
if ( isMaxDecimalsReached( validatedStringFragment, settings ) ) return false;
[297] Fix | Delete
[298] Fix | Delete
if ( isGreaterThanMax( validatedStringFragment + Char, settings ) ) return false;
[299] Fix | Delete
[300] Fix | Delete
if ( isLessThanMin( validatedStringFragment + Char, settings ) ) return false;
[301] Fix | Delete
[302] Fix | Delete
return true;
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
if ( settings.allowPlus && Char == '+' && validatedStringFragment == '' ) return true;
[306] Fix | Delete
[307] Fix | Delete
if ( settings.allowMinus && Char == '-' && validatedStringFragment == '' ) return true;
[308] Fix | Delete
[309] Fix | Delete
if ( Char == THOU_SEP && settings.allowThouSep && allowThouSep( validatedStringFragment, Char ) ) return true;
[310] Fix | Delete
[311] Fix | Delete
if ( Char == DEC_SEP ) {
[312] Fix | Delete
// Only one decimal separator allowed
[313] Fix | Delete
if ( validatedStringFragment.indexOf( DEC_SEP ) >= 0 ) return false;
[314] Fix | Delete
if ( settings.allowDecSep ) return true;
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
return false;
[318] Fix | Delete
}
[319] Fix | Delete
[320] Fix | Delete
function countDigits( string ) {
[321] Fix | Delete
[322] Fix | Delete
// Error handling, nulls etc
[323] Fix | Delete
string = string + '';
[324] Fix | Delete
[325] Fix | Delete
// Count the digits
[326] Fix | Delete
return string.replace( /[^0-9]/g, '' ).length;
[327] Fix | Delete
}
[328] Fix | Delete
[329] Fix | Delete
function isMaxDigitsReached( string, settings ) {
[330] Fix | Delete
[331] Fix | Delete
var maxDigits = settings.maxDigits;
[332] Fix | Delete
[333] Fix | Delete
if ( maxDigits == '' || isNaN( maxDigits ) ) return false; // In this case, there is no maximum
[334] Fix | Delete
[335] Fix | Delete
var numDigits = countDigits( string );
[336] Fix | Delete
[337] Fix | Delete
if ( numDigits >= maxDigits ) return true;
[338] Fix | Delete
[339] Fix | Delete
return false;
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
function isMaxDecimalsReached( string, settings ) {
[343] Fix | Delete
[344] Fix | Delete
var maxDecimalPlaces = settings.maxDecimalPlaces;
[345] Fix | Delete
[346] Fix | Delete
if ( maxDecimalPlaces == '' || isNaN( maxDecimalPlaces ) ) return false; // In this case, there is no maximum
[347] Fix | Delete
[348] Fix | Delete
var indexOfDecimalPoint = string.indexOf( DEC_SEP );
[349] Fix | Delete
[350] Fix | Delete
if ( indexOfDecimalPoint == -1 ) return false;
[351] Fix | Delete
[352] Fix | Delete
var decimalSubstring = string.substring( indexOfDecimalPoint );
[353] Fix | Delete
var numDecimals = countDigits( decimalSubstring );
[354] Fix | Delete
[355] Fix | Delete
if ( numDecimals >= maxDecimalPlaces ) return true;
[356] Fix | Delete
[357] Fix | Delete
return false;
[358] Fix | Delete
}
[359] Fix | Delete
[360] Fix | Delete
function isMaxPreDecimalsReached( string, settings ) {
[361] Fix | Delete
[362] Fix | Delete
var maxPreDecimalPlaces = settings.maxPreDecimalPlaces;
[363] Fix | Delete
[364] Fix | Delete
if ( maxPreDecimalPlaces == '' || isNaN( maxPreDecimalPlaces ) ) return false; // In this case, there is no maximum
[365] Fix | Delete
[366] Fix | Delete
var indexOfDecimalPoint = string.indexOf( DEC_SEP );
[367] Fix | Delete
[368] Fix | Delete
if ( indexOfDecimalPoint >= 0 ) return false;
[369] Fix | Delete
[370] Fix | Delete
var numPreDecimalDigits = countDigits( string );
[371] Fix | Delete
[372] Fix | Delete
if ( numPreDecimalDigits >= maxPreDecimalPlaces ) return true;
[373] Fix | Delete
[374] Fix | Delete
return false;
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
function isGreaterThanMax( numericString, settings ) {
[378] Fix | Delete
[379] Fix | Delete
if ( !settings.max || settings.max < 0 ) return false;
[380] Fix | Delete
[381] Fix | Delete
var outputNumber = parseFloat( numericString );
[382] Fix | Delete
if ( outputNumber > settings.max ) return true;
[383] Fix | Delete
[384] Fix | Delete
return false;
[385] Fix | Delete
}
[386] Fix | Delete
[387] Fix | Delete
function isLessThanMin( numericString, settings ) {
[388] Fix | Delete
[389] Fix | Delete
if ( !settings.min || settings.min > 0 ) return false;
[390] Fix | Delete
[391] Fix | Delete
var outputNumber = parseFloat( numericString );
[392] Fix | Delete
if ( outputNumber < settings.min ) return true;
[393] Fix | Delete
[394] Fix | Delete
return false;
[395] Fix | Delete
}
[396] Fix | Delete
[397] Fix | Delete
/********************************
[398] Fix | Delete
* Trims a string according to the settings provided
[399] Fix | Delete
********************************/
[400] Fix | Delete
function trimAlphaNum( inputString, settings ) {
[401] Fix | Delete
[402] Fix | Delete
if ( typeof inputString != 'string' ) return inputString;
[403] Fix | Delete
[404] Fix | Delete
var inChars = inputString.split( '' );
[405] Fix | Delete
var outChars = [];
[406] Fix | Delete
var i = 0;
[407] Fix | Delete
var Char;
[408] Fix | Delete
[409] Fix | Delete
for ( i = 0; i < inChars.length; i++ ) {
[410] Fix | Delete
Char = inChars[i];
[411] Fix | Delete
var validatedStringFragment = outChars.join( '' );
[412] Fix | Delete
if ( alphanum_allowChar( validatedStringFragment, Char, settings ) ) outChars.push( Char );
[413] Fix | Delete
}
[414] Fix | Delete
[415] Fix | Delete
return outChars.join( '' );
[416] Fix | Delete
}
[417] Fix | Delete
[418] Fix | Delete
function trimNum( inputString, settings ) {
[419] Fix | Delete
if ( typeof inputString != 'string' ) return inputString;
[420] Fix | Delete
[421] Fix | Delete
var inChars = inputString.split( '' );
[422] Fix | Delete
var outChars = [];
[423] Fix | Delete
var i = 0;
[424] Fix | Delete
var Char;
[425] Fix | Delete
[426] Fix | Delete
for ( i = 0; i < inChars.length; i++ ) {
[427] Fix | Delete
Char = inChars[i];
[428] Fix | Delete
var validatedStringFragment = outChars.join( '' );
[429] Fix | Delete
if ( numeric_allowChar( validatedStringFragment, Char, settings ) ) outChars.push( Char );
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
return outChars.join( '' );
[433] Fix | Delete
}
[434] Fix | Delete
[435] Fix | Delete
function removeUpperCase( inputString ) {
[436] Fix | Delete
var charArray = inputString.split( '' );
[437] Fix | Delete
var i = 0;
[438] Fix | Delete
var outputArray = [];
[439] Fix | Delete
var Char;
[440] Fix | Delete
[441] Fix | Delete
for ( i = 0; i < charArray.length; i++ ) {
[442] Fix | Delete
Char = charArray[i];
[443] Fix | Delete
}
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
function removeLowerCase( inputString ) {
[447] Fix | Delete
[448] Fix | Delete
}
[449] Fix | Delete
[450] Fix | Delete
function isUpper( Char ) {
[451] Fix | Delete
var upper = Char.toUpperCase();
[452] Fix | Delete
var lower = Char.toLowerCase();
[453] Fix | Delete
[454] Fix | Delete
if ( (Char == upper) && (upper != lower) ) return true; else return false;
[455] Fix | Delete
}
[456] Fix | Delete
[457] Fix | Delete
function isLower( Char ) {
[458] Fix | Delete
var upper = Char.toUpperCase();
[459] Fix | Delete
var lower = Char.toLowerCase();
[460] Fix | Delete
[461] Fix | Delete
if ( (Char == lower) && (upper != lower) ) return true; else return false;
[462] Fix | Delete
}
[463] Fix | Delete
[464] Fix | Delete
function isCaseless( Char ) {
[465] Fix | Delete
if ( Char.toUpperCase() == Char.toLowerCase() ) return true; else return false;
[466] Fix | Delete
}
[467] Fix | Delete
[468] Fix | Delete
function getBlacklistSet( allow, disallow ) {
[469] Fix | Delete
[470] Fix | Delete
var setOfBadChars = new Set( BLACKLIST + disallow );
[471] Fix | Delete
var setOfGoodChars = new Set( allow );
[472] Fix | Delete
[473] Fix | Delete
var blacklistSet = setOfBadChars.subtract( setOfGoodChars );
[474] Fix | Delete
[475] Fix | Delete
return blacklistSet;
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
function getDigitsMap() {
[479] Fix | Delete
var array = '0123456789'.split( '' );
[480] Fix | Delete
var map = {};
[481] Fix | Delete
var i = 0;
[482] Fix | Delete
var digit;
[483] Fix | Delete
[484] Fix | Delete
for ( i = 0; i < array.length; i++ ) {
[485] Fix | Delete
digit = array[i];
[486] Fix | Delete
map[digit] = true;
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
return map;
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
function getLatinCharsSet() {
[493] Fix | Delete
var lower = 'abcdefghijklmnopqrstuvwxyz';
[494] Fix | Delete
var upper = lower.toUpperCase();
[495] Fix | Delete
var azAZ = new Set( lower + upper );
[496] Fix | Delete
[497] Fix | Delete
return azAZ;
[498] Fix | Delete
}
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function