nl_tokens: gets a click event handler for either scope filter buttons or kind filter buttons .
pl_tokens: function getFilterClickHandler ( filter ) { var isKind = filter === 'kind' ; var has = isKind ? sbSearch . hasKind : sbSearch . hasScope ; var add = isKind ? sbSearch . addKind : sbSearch . addScope ; var remove = isKind ? sbSearch . removeKind : sbSearch . removeScope ; return function ( event ) { var btn = $ ( this ) ; // get scope or kind value from the data- attribute. // e.g. data-scope="instance" or data-kind="method" var value = ( btn . attr ( 'data-' + filter ) || '*' ) . toLowerCase ( ) ; // if we already have this filter, we'll remove it if ( has . call ( sbSearch , value ) ) { remove . call ( sbSearch , value ) ; } else if ( event . shiftKey ) { // if shift is pressed, we'll add it (multiple filters, no // duplicates) add . call ( sbSearch , value ) ; } else { // otherwise, we'll set it as the only filter (replace with // previous) sbSearch [ filter ] = [ value ] ; } var strSearch ; if ( $txtSearch ) { sbSearch . parseKeywords ( $txtSearch . val ( ) ) ; strSearch = sbSearch . toString ( ) ; $txtSearch . val ( strSearch ) . <mask> ( ) ; if ( $btnClean ) $btnClean . show ( ) ; } else { sbSearch . keywords = [ ] ; strSearch = sbSearch . toString ( ) ; } filterSidebarNodes ( strSearch ) ; } ; }