Current time: 07-23-2014, 11:56 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Result filtering
04-06-2009, 03:19 AM
Post: #1
Result filtering
(thread migrated from sourceforge forum - originally posted 8/16/2008)

Hi Pat,

Here's a simple jquery results filter which, if implemented, may be of benifit to other users:

Style:

Code:
fieldset {border:0 solid}
.even {background:#f7f7f7}


XHTML:

Code:
<form id="filter" action="#" onsubmit="filter(); return false;">
<fieldset>
<label for="filterTerm">Show only result URIs containing text:</label>
<input id="filterTerm" value="websemantics" type="text" />
<input id="submit" value="Filter" type="submit" />
<p id="results">Note filtering a large data set will take time.<br />
Narrow reports first: <a href="/testlog/1/">1 Day</a>, <a href="/testlog/7/">7 Days</a>, <a href="/testlog/30/">30 Days</a>, <a href="/testlog/182/">6 Months</a>, <a href="/testlog/365/">1 Year</a>.</p>
</fieldset>
</form>

J

Code:
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
/*<![CDATA[*/

function filter(){
var txt=$('#filterTerm').val(), total=0, count=0;
$('.url').each(function(){
total++;
if ($(this).text().match(txt)){
count++;
}else{
$(this).parent().remove();
}
})

$('#results').html('Showing <strong>'+count+'</strong> results from <strong>'+total+'</strong> entries.');
$('tbody tr:even').addClass('even');
$('#submit').val('Filter results further');
}

/*]]>*/
</script>

mike
Visit this user's website Find all posts by this user
Quote this message in a reply
04-06-2009, 03:19 AM
Post: #2
RE: Result filtering
Sorry for the delay, wasn't ignoring your suggestion (and thanks for the code).

I figured it would be a bit cleaner to implement the filtering on the back-end and just pushed the code so feel free to give it a whirl. One of the benefits of doing it on the back-end (besides the speed) is that you end up with urls that you can bookmark if you just want to see the results from your properties.

-Pat
Visit this user's website Find all posts by this user
Quote this message in a reply
04-06-2009, 03:19 AM
Post: #3
RE: Result filtering
Hi Pat,

Came to use the tool today and noticed the filtering, thanks dude that makes my life a little simpler.

Sorry to say but there appears to be an issue with 6 month / 1 year filtering.
Selecting 1 year seems to only produce 6 months of results?


Mike
Visit this user's website Find all posts by this user
Quote this message in a reply
04-06-2009, 03:20 AM
Post: #4
RE: Result filtering
The 1 year filtering works. I expect whatever you were looking for just wasn't tested that far back. The site only came online in February and if you do a 1 year filter for http://www.yahoo.com you will see tests going back that far:

http://www.webpagetest.org/testlog.php?d....yahoo.com

Thanks,

-Pat
Visit this user's website Find all posts by this user
Quote this message in a reply
04-06-2009, 03:20 AM
Post: #5
RE: Result filtering
Sorry Pat,

I could've sworn I started testing earlier than listed.
Well that proves one immediate benefit of the filtering.


Nice one.

Mike
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)