// Generated by CoffeeScript 1.9.3
(function() {
  var $, filter_list;

  $ = jQuery;

  filter_list = function(val) {
    var rex;
    rex = new RegExp(val, "i");
    $(".searchable li").hide();
    $(".searchable li").parent().parent('.list_hide_segment').hide();
    $(".searchable li").filter(function() {
      return rex.test($(this).text());
    }).show();
    return $(".searchable li").filter(function() {
      return rex.test($(this).text());
    }).parent().parent().show();
  };

  $("input.filter-list").on("keyup", function(e) {
    var ev;
    if (e.keyCode === 27) {
      $(e.currentTarget).val("");
      ev = $.Event("keyup");
      ev.keyCode = 13;
      $(e.currentTarget).trigger(ev);
      return e.currentTarget.blur();
    } else {
      return filter_list($(this).val());
    }
  });

  $("input.filter-list").ready(function() {
    var elem, val;
    elem = $("input.filter-list");
    elem.focus();
    val = elem.val();
    filter_list(val);
    return elem.val('').val(val);
  });

}).call(this);
