Changeset - 26c3e4708f58
[Not reviewed]
default
0 4 0
Takumi IINO - 11 years ago 2014-11-29 08:25:13
trot.thunder@gmail.com
javascripts: pass jQuery object to q_filter
4 files changed with 14 insertions and 16 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -559,19 +559,19 @@ var _close_tooltip = function(e){
 
 * @param display_element function that takes current node from nodes and
 
 *    does hide or show based on the node
 
 */
 
var q_filter = function(target, nodes, display_element){
 
    var nodes = nodes;
 
var q_filter = function(target, $nodes, display_element) {
 
    var $nodes = $nodes;
 
    var $q_filter_field = $('#' + target);
 
    var F = YAHOO.namespace(target);
 

	
 
    $q_filter_field.keyup(function(e){
 
    $q_filter_field.keyup(function (e) {
 
        clearTimeout(F.filterTimeout);
 
        F.filterTimeout = setTimeout(F.updateFilter, 600);
 
    });
 

	
 
    F.filterTimeout = null;
 

	
 
    F.updateFilter  = function() {
 
    F.updateFilter = function () {
 
        // Reset timeout
 
        F.filterTimeout = null;
 

	
 
@@ -579,23 +579,21 @@ var q_filter = function(target, nodes, d
 

	
 
        var req = $q_filter_field.val().toLowerCase();
 

	
 
        var l = nodes.length;
 
        var i;
 
        var showing = 0;
 

	
 
        for (i=0; i<l; i++ ){
 
            var n = nodes[i];
 
            var target_element = display_element(n)
 
            if(req && n.innerHTML.toLowerCase().indexOf(req) == -1){
 
        $nodes.each(function () {
 
            var n = this;
 
            var target_element = display_element(n);
 
            if (req && n.innerHTML.toLowerCase().indexOf(req) == -1) {
 
                $(target_element).hide();
 
            }
 
            else{
 
                $(target_element).show();
 
                showing += 1;
 
            }
 
        }
 
        });
 

	
 
        $('#repo_count').html(showing); /* FIXME: don't hardcode */
 
        $('#repo_count').html(showing);
 
        /* FIXME: don't hardcode */
 
    }
 
};
 

	
kallithea/templates/bookmarks/bookmarks.html
Show inline comments
 
@@ -91,7 +91,7 @@ myDataTable.subscribe('postRenderEvent',
 
    var func = function(node){
 
        return node.parentNode.parentNode.parentNode.parentNode.parentNode;
 
    }
 
    q_filter('q_filter_bookmarks',YUQ('div.table tr td .logbooks .booktag a'),func);
 
    q_filter('q_filter_bookmarks',$('div.table tr td .logbooks .booktag a'),func);
 
});
 

	
 
</script>
kallithea/templates/branches/branches.html
Show inline comments
 
@@ -91,7 +91,7 @@ myDataTable.subscribe('postRenderEvent',
 
    var func = function(node){
 
        return node.parentNode.parentNode.parentNode.parentNode.parentNode;
 
    }
 
    q_filter('q_filter_branches',YUQ('div.table tr td .logtags .branchtag a'),func);
 
    q_filter('q_filter_branches',$('div.table tr td .logtags .branchtag a'),func);
 
});
 

	
 
</script>
kallithea/templates/tags/tags.html
Show inline comments
 
@@ -91,7 +91,7 @@ myDataTable.subscribe('postRenderEvent',
 
    var func = function(node){
 
        return node.parentNode.parentNode.parentNode.parentNode.parentNode;
 
    }
 
    q_filter('q_filter_tags',YUQ('div.table tr td .logtags .tagtag a'),func);
 
    q_filter('q_filter_tags',$('div.table tr td .logtags .tagtag a'),func);
 
});
 

	
 
</script>
0 comments (0 inline, 0 general)