Skip to content

Commit

Permalink
🔤 BASE #267 formatando
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Jun 6, 2022
1 parent 72d26bd commit 322a9e0
Showing 1 changed file with 18 additions and 42 deletions.
60 changes: 18 additions & 42 deletions base/js/jquery/jquery.autocomplete.dylan.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,43 +385,33 @@ jQuery.autocomplete = function(input, options) {
//{
//qlc = q.toLowerCase();
//}
if(options.removeMask)
{
if(options.removeMask){
q = q.replace(/[^0-9]/g,'');
}
var data = options.cacheLength ? loadFromCache(q) : null;
// recieve the cached data
if (data)
{
if (data){
//alert('Tem data');
//alert( data );
receiveData(q, data);
// if an AJAX url has been supplied, try loading the data now
}
else if( (typeof options.url == "string") && (options.url.length > 0) )
{
} else if( (typeof options.url == "string") && (options.url.length > 0) ) {
//alert('Não tem data, vou buscar novamente no banco');
jQuery.get(makeUrl(q), function(data) {
if( data )
{
if( data ) {
//alert( data );
data = parseData(data);
addToCache(q, data);
receiveData(q, data);
}
else
{
} else {
alert(options.messageNotFound);
if( options.clearOnNotFound )
{
if( options.clearOnNotFound ) {
input.value='';
}
}
});
// if there's been no data found, remove the loading class
}
else
{
} else {
//alert(msgNenhumaOpcao);
alert(options.messageNotFound);
$input.removeClass(options.loadingClass);
Expand All @@ -432,38 +422,28 @@ jQuery.autocomplete = function(input, options) {
function makeUrl(q) {
var url;
// eugenio - alteração para detectar ?q ou &q
if( options.url.indexOf('?')== -1 )
{
if( options.url.indexOf('?')== -1 ){
url = options.url + "?q=" + encodeURI(q);
}
else
{
} else {
url = options.url + "&q=" + encodeURI(q);
}
// eugenio - adaptação feita para ler os valores atuais dos campos do formulário que farão parte do filtro
for( key in options.extraParams)
{
if( key.indexOf('_w_') == 0 )
{
for( key in options.extraParams){
if( key.indexOf('_w_') == 0 ){
var campoForm = key.replace('_w_','');
var aCampoForm = campoForm.split('|');
if( !aCampoForm[1] )
{
if( !aCampoForm[1] ){
aCampoForm[1] = aCampoForm[0];
}
if( fwGetObj )
{
if( fwGetObj ){
campoForm = fwGetObj( aCampoForm[0] );
if( campoForm )
{
if( campoForm ){
options.extraParams[key] = campoForm.value;
}
}

}
}
for (var i in options.extraParams)
{
for (var i in options.extraParams){
url += "&" + i + "=" + encodeURI(options.extraParams[i]);
}
return url;
Expand All @@ -478,21 +458,17 @@ extraParams:{"tablePackageFunction":"TESTE.PKG_TESTE.SEL_MUNICIPIO","searchField
if (!q) return null;

var qlc = q;
if ( !options.matchCase )
{
if ( !options.matchCase ){
qlc = q.toLowerCase();
}
if (cache.data[qlc])
return cache.data[qlc];
if (options.matchSubset) {
for (var i = q.length - 1; i >= options.minChars; i--) {
var qs = q.substr(0, i);
if ( !options.matchCase )
{
if ( !options.matchCase ){
var c = cache.data[qs.toLowerCase()];
}
else
{
} else {
var c = cache.data[qs];
}
if (c) {
Expand Down

0 comments on commit 322a9e0

Please sign in to comment.