| | |
| | | scroll_speed: 20, |
| | | save_state: false, |
| | | keyboard: true, |
| | | tabexit: true, |
| | | check_droptarget: function(node) { return !node.virtual; } |
| | | }, p || {}); |
| | | |
| | |
| | | this.get_item = get_item; |
| | | this.get_node = get_node; |
| | | this.get_selection = get_selection; |
| | | this.is_search = is_search; |
| | | this.reset_search = reset_search; |
| | | |
| | | /////// startup code (constructor) |
| | | |
| | |
| | | var li, sli; |
| | | if (!node.virtual && !node.deleted && String(node.text).toLowerCase().indexOf(q) >= 0 && hits.indexOf(node.id) < 0) { |
| | | li = id2dom(node.id); |
| | | |
| | | // skip already filtered nodes |
| | | if (li.data('filtered')) |
| | | return; |
| | | |
| | | sli = $('<li>') |
| | | .attr('id', li.attr('id') + '--xsR') |
| | | .attr('class', li.attr('class')) |
| | | .addClass('searchresult__') |
| | | .append(li.children().first().clone(true, true)) |
| | | // append all elements like links and inputs, but not sub-trees |
| | | .append(li.children(':not(div.treetoggle,ul)').clone(true, true)) |
| | | .appendTo(container); |
| | | hits.push(node.id); |
| | | } |
| | |
| | | searchfield.val(''); |
| | | |
| | | $(container).children('li.searchresult__').remove(); |
| | | $(container).children('li').show(); |
| | | $(container).children('li').filter(function() { return !$(this).data('filtered'); }).show(); |
| | | |
| | | search_active = false; |
| | | |
| | |
| | | |
| | | if (selection) |
| | | select(selection); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | function is_search() |
| | | { |
| | | return search_active; |
| | | } |
| | | |
| | | /** |
| | |
| | | var target = e.target || {}, |
| | | keyCode = rcube_event.get_keycode(e); |
| | | |
| | | if (!has_focus || target.nodeName == 'INPUT' || target.nodeName == 'TEXTAREA' || target.nodeName == 'SELECT') |
| | | if (!has_focus || target.nodeName == 'INPUT' && keyCode != 38 && keyCode != 40 || target.nodeName == 'TEXTAREA' || target.nodeName == 'SELECT') |
| | | return true; |
| | | |
| | | switch (keyCode) { |
| | |
| | | return false; |
| | | |
| | | case 9: // Tab |
| | | if (p.keyboard) { |
| | | if (p.keyboard && p.tabexit) { |
| | | // jump to last/first item to move focus away from the treelist widget by tab |
| | | var limit = rcube_event.get_modifier(e) == SHIFT_KEY ? 'first' : 'last'; |
| | | focus_noscroll(container.find('li[role=treeitem]:has(a)')[limit]().find('a:'+limit)); |