src/search/FileFilters.js
function _handleDeleteFilter(e) {
        // Remove the filter set from the preferences and
        // clear the active filter set index from view state.
        var filterSets        = PreferencesManager.get("fileFilters") || [],
            activeFilterIndex = PreferencesManager.getViewState("activeFileFilter"),
            filterIndex       = $(e.target).parent().data("index") - FIRST_FILTER_INDEX;

        // Don't let the click bubble upward.
        e.stopPropagation();

        filterSets.splice(filterIndex, 1);
        PreferencesManager.set("fileFilters", filterSets);

        if (activeFilterIndex === filterIndex) {
            // Removing the active filter, so clear the active filter
            // both in the view state.
            setActiveFilter(null);
        } else if (activeFilterIndex > filterIndex) {
            // Adjust the active filter index after the removal of a filter set before it.
            --activeFilterIndex;
            setActiveFilter(filterSets[activeFilterIndex], activeFilterIndex);
        }

        _updatePicker();
        _doPopulate();
        _picker.refresh();
    }
function _handleDeleteFilter(e) {
        // Remove the filter set from the preferences and
        // clear the active filter set index from view state.
        var filterSets        = PreferencesManager.get("fileFilters") || [],
            activeFilterIndex = PreferencesManager.getViewState("activeFileFilter"),
            filterIndex       = $(e.target).parent().data("index") - FIRST_FILTER_INDEX;

        // Don't let the click bubble upward.
        e.stopPropagation();

        filterSets.splice(filterIndex, 1);
        PreferencesManager.set("fileFilters", filterSets);

        if (activeFilterIndex === filterIndex) {
            // Removing the active filter, so clear the active filter
            // both in the view state.
            setActiveFilter(null);
        } else if (activeFilterIndex > filterIndex) {
            // Adjust the active filter index after the removal of a filter set before it.
            --activeFilterIndex;
            setActiveFilter(filterSets[activeFilterIndex], activeFilterIndex);
        }

        _updatePicker();
        _doPopulate();
        _picker.refresh();
    }
function _handleDeleteFilter ( e ) { // Remove the filter set from the preferences and // clear the active filter set index from view state. var filterSets = PreferencesManager . get ( "fileFilters" ) || [ ] , activeFilterIndex = PreferencesManager . getViewState ( "activeFileFilter" ) , filterIndex = $ ( e . target ) . parent ( ) . data ( "index" ) - FIRST_FILTER_INDEX ; // Don't let the click bubble upward. e . stopPropagation ( ) ; filterSets . splice ( filterIndex , 1 ) ; PreferencesManager . set ( "fileFilters" , filterSets ) ; if ( activeFilterIndex === filterIndex ) { // Removing the active filter, so clear the active filter // both in the view state. setActiveFilter ( null ) ; } else if ( activeFilterIndex > filterIndex ) { // Adjust the active filter index after the removal of a filter set before it. -- activeFilterIndex ; setActiveFilter ( filterSets [ activeFilterIndex ] , activeFilterIndex ) ; } _updatePicker ( ) ; _doPopulate ( ) ; _picker . refresh ( ) ; }
Remove the target item from the filter dropdown list and update dropdown button
and dropdown list UI.
@param {!Event} e Mouse events
Remove the target item from the filter dropdown list and update dropdown button and dropdown list UI .