WebPagetest Forums

Full Version: Result filtering
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(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
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
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
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
Sorry Pat,

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


Nice one.

Mike
Reference URL's