function textFilter()

in api-docs/0.6/lib/index.js [113:159]


function textFilter() {
    scheduler.clear("filter");
    scheduler.add("filter", function() {
        var query = $("#textfilter input").attr("value")
        var queryRegExp;
        if (query.toLowerCase() != query) {
            // Regexp that matches CamelCase subbits: "BiSe" is
            // "[a-z]*Bi[a-z]*Se" and matches "BitSet", "ABitSet", ...
            queryRegExp = new RegExp(query.replace(/([A-Z])/g,"[a-z]*$1"));
        }
        else { // if query is all lower case make a normal case insensitive search
            queryRegExp = new RegExp(query, "i");
        }
        scheduler.addForAll("filter", domCache.packs, function(pack0) {
            var pack = $(pack0);
            $("> ol.templates > li", pack).each(function(){
                var item = $(this).attr("title");
                if (item == "" || queryRegExp.test(item)) {
                    $(this).show();
                    $(this).removeClass("hide");
                }
                else {
                    $(this).addClass("hide");
                    $(this).hide();
                }
            });
            if ($("> ol > li:not(.hide)", pack).length > 0) {
                pack.show();
                pack.removeClass("hide");
            }
            else {
                pack.addClass("hide");
                pack.hide();
            }
            if ($("> ol.templates > li:not(.hide)", pack).length > 0) {
                $("> h3", pack).show();
                $("> .packhide", pack).show();
                $("> .packfocus", pack).show();
            }
            else {
                $("> h3", pack).hide();
                $("> .packhide", pack).hide();
                $("> .packfocus", pack).hide();
            }
        });
    });
}