PDA

View Full Version : Keyword search using IE8



rosegarden
May 17, 2012, 03:37 AM
Anyone face problem when using keyword search with IE8?

It is not able to display correctly as the keyword highlight the URL

Viktor
May 17, 2012, 01:03 PM
Hello Desmond Lim,

Yes I found this error

Please go to ftp:libs>>javascript>>flynax.lib.js

find method with name highlightSRGrid at line ~841 and in this method find code:


$('#listings div.list div.item td.fields>span,#listings table.table div.item td.fields td.value').each(function(){
var value = trim($(this).html());
var href = false;
if ( value.indexOf('<a') >= 0 )
{
var matches = value.match(link_pattern);
if ( matches[2] )
{
value = trim(matches[2]);
href = matches[1];
}
}

//value = value.replace(/(<([^>]+)>)/ig,"");
value = value.replace(pattern, '<span class="ks_highlight">$1</span>');
value = href ? '<a '+href+'>'+value+'</a>' : value;

$(this).html(value);

});

and replace to :


$('#listings div.list div.item td.fields>span,#listings table.table div.item td.fields td.value').each(function(){
var value = trim($(this).html());
var href = false;

if ( value.indexOf('href=') >= 0 )
{
value = $(this).find('a').html();
href = $(this).find('a').attr('href');
}

//value = value.replace(/(<([^>]+)>)/gi,"");

value = value.replace(pattern, '<span class="ks_highlight">$1</span>');
value = href ? '<a href="'+href+'">'+value+'</a>' : value;

$(this).html(value);
});

rosegarden
May 17, 2012, 04:27 PM
thanks got it resolved

rosegarden
June 1, 2012, 10:30 AM
I thought this seem to work until i found out that now that all the text links are not clickable

rosegarden
June 1, 2012, 10:40 AM
If you scroll further down, there is ...

Please advise if this need to edit as well?

================================================== =====================================




$('table.listing_details td.details table.table td.value').each(function(){
var value = trim($(this).html());
var href = false;
if ( value.indexOf('<a') >= 0 )
{
var matches = value.match(link_pattern);
if ( matches[2] )
{
value = trim(matches[2]);
href = matches[1];
}
}
value = value.replace(pattern, '<span class="ks_highlight">$1</span>');
value = href ? '<a '+href+'>'+value+'</a>' : value;
$(this).html(value);
});

John
July 26, 2012, 04:48 AM
Hello guys,
Here the updated highlightSRGrid javascript function code:


/**
* highlight search results in grid
**/
this.highlightSRGrid = function(query){
if ( !query )
return;

query = trim(query);
var repeat = new RegExp('(\\s)\\1+', 'gm');
query = query.replace(repeat, ' ');
query = query.split(' ');

var pattern = '';
for (var i=0; i<query.length; i++)
{
if ( query[i].length > 2 )
{
pattern += query[i]+'|'
}
}
pattern = rtrim(pattern, '|');

var pattern = new RegExp('('+pattern+')', 'gi');
var link_pattern = new RegExp('<a([^>]*)>(.*)</a>');

$('#listings div.list div.item td.fields>span,#listings table.table div.item td.fields td.value').each(function(){
var value = trim($(this).html());
var href = false;
if ( $(this).find('a').length > 0 )
{
value = trim($(this).find('a').html());
href = $(this).find('a').attr('href');
}

//value = value.replace(/(<([^>]+)>)/ig,"");
value = value.replace(pattern, '<span class="ks_highlight">$1</span>');
value = href ? '<a href="'+href+'">'+value+'</a>' : value;

$(this).html(value);
});
};


Also this fix has been applied to Flynax 4.1 version.

John