$(function() {
  var pageToFetch = 2;

  $(".more").click(function() {
    $(this).addClass("loading");
    $.get("/home/mock_set", {page: pageToFetch}, function(data) {
      $(".more").removeClass("loading");
      if (data.trim().length > 0) {
        $(data).insertBefore('.more');
      }
      if (pageToFetch === TOTAL_PAGES) {
        $(".more").hide();
      }
      pageToFetch++;
    });
  });

  $('#show_all_projects').click(function(evt) {
    evt.preventDefault();
    $('#all_projects').show();
    $('#show_all_projects').hide();
  });

  $('.project_filter').keyup(function() {
    var projects = $('.project_list li');
    var filter = $.trim($(this).val());
    projects.show();
    if (filter) {
      filter = new RegExp(filter ,'i');
      projects
        .filter(function() { return !filter.test($(this).text()); })
        .hide();
    }
  });
});

@@ -30,16 +30,43 @@
 tch = 2;
+%0A  var prevQueryLength = 0;
 %0A%0A  $(%22.
@@ -624,16 +624,17 @@
     var 
+$
 projects
@@ -703,28 +703,8 @@
 ));%0A
-    projects.show();
 %0A   
@@ -730,16 +730,22 @@
   filter
+Regexp
  = new R
@@ -770,16 +770,17 @@
 ;%0A      
+$
 projects
@@ -780,16 +780,44 @@
 rojects%0A
+        .filter(':visible')%0A
         
@@ -855,28 +855,36 @@
 lter
+Regexp
 .test(
-$(
 this
-)
 .text
-()
+Content
 ); %7D
@@ -902,21 +902,295 @@
 hide();%0A
-    %7D
+%0A      if (filter.length %3C= prevQueryLength) %7B%0A        $projects%0A          .filter(':hidden')%0A          .filter(function() %7B return filterRegexp.test(this.textContent); %7D)%0A          .show();%0A      %7D%0A    %7D else %7B%0A      $projects.show();%0A    %7D%0A%0A    prevQueryLength = filter.length;
 %0A  %7D);%0A%7D

Improve mockr project search speed