treconomics_project/static/javascripts/search_helpers.js
/*
A helper function to enable or disable interaction with the user interface.
If enableInterface is set to true, the interface can be interacted with.
Otherwise, form fields and buttons are disabled, as well as document hit links.
*/
A helper function to enable or disable interaction with the user interface.
If enableInterface is set to true, the interface can be interacted with.
Otherwise, form fields and buttons are disabled, as well as document hit links.
A helper function to enable or disable interaction with the user interface . If enableInterface is set to true the interface can be interacted with . Otherwise form fields and buttons are disabled as well as document hit links .
function changeInteractionStatus(enableInterface, useBox) {
    var delay_results = parseInt($('#delay_results').val());
    var delay_docview = parseInt($('#delay_docview').val());
    if (enableInterface) {
        INTERFACE_ENABLED = true;
        $('*').css('cursor', 'auto');
        $('#search-button').removeAttr('disabled');
        $('#search-button').attr('value', 'Search');
        $('#search-button').css('background-color', '#EEEEEE');
        $('#search-button').css('color', '#666666');
        $('#search-button').css('cursor', 'pointer');
        $('.searchbox, .smallsearchbox').removeAttr('disabled');
        $('#query').css('background', 'none');
        $('.navButton').removeAttr('disabled');
        $('.navButton').css('cursor', 'pointer');
        bindResultHovering();
    }
    else {
        INTERFACE_ENABLED = false;
        $('*').css('cursor', 'progress');
        if (useBox) {
            $('#full-grey-out').css('display', 'block');
        }
        else {
            $('#search-button').attr('value', 'Loading...');
            $('#query').css('background', 'url(\'/static/images/spinner.gif\')');
            $('#query').css('background-repeat', 'no-repeat');
            $('#query').css('background-position', 'right');
            $('.navButton').attr('disabled', 'disabled');
            $('.search_result').unbind();
            if ($('.searchbox').hasClass('ui-autocomplete-input')) {
                $('.searchbox').autocomplete('close');
            }
            if ($('.smallsearchbox').hasClass('ui-autocomplete-input')) {
                $('.smallsearchbox').autocomplete('close');
            }
            $('.searchbox, .smallsearchbox').blur();
        }
    }
}
function changeInteractionStatus ( enableInterface , useBox ) { var delay_results = parseInt ( $ ( '#delay_results' ) . val ( ) ) ; var delay_docview = parseInt ( $ ( '#delay_docview' ) . val ( ) ) ; if ( enableInterface ) { INTERFACE_ENABLED = true ; $ ( '*' ) . css ( 'cursor' , 'auto' ) ; $ ( '#search-button' ) . removeAttr ( 'disabled' ) ; $ ( '#search-button' ) . attr ( 'value' , 'Search' ) ; $ ( '#search-button' ) . css ( 'background-color' , '#EEEEEE' ) ; $ ( '#search-button' ) . css ( 'color' , '#666666' ) ; $ ( '#search-button' ) . css ( 'cursor' , 'pointer' ) ; $ ( '.searchbox, .smallsearchbox' ) . removeAttr ( 'disabled' ) ; $ ( '#query' ) . css ( 'background' , 'none' ) ; $ ( '.navButton' ) . removeAttr ( 'disabled' ) ; $ ( '.navButton' ) . css ( 'cursor' , 'pointer' ) ; bindResultHovering ( ) ; } else { INTERFACE_ENABLED = false ; $ ( '*' ) . css ( 'cursor' , 'progress' ) ; if ( useBox ) { $ ( '#full-grey-out' ) . css ( 'display' , 'block' ) ; } else { $ ( '#search-button' ) . attr ( 'value' , 'Loading...' ) ; $ ( '#query' ) . css ( 'background' , 'url(\'/static/images/spinner.gif\')' ) ; $ ( '#query' ) . css ( 'background-repeat' , 'no-repeat' ) ; $ ( '#query' ) . css ( 'background-position' , 'right' ) ; $ ( '.navButton' ) . attr ( 'disabled' , 'disabled' ) ; $ ( '.search_result' ) . unbind ( ) ; if ( $ ( '.searchbox' ) . hasClass ( 'ui-autocomplete-input' ) ) { $ ( '.searchbox' ) . autocomplete ( 'close' ) ; } if ( $ ( '.smallsearchbox' ) . hasClass ( 'ui-autocomplete-input' ) ) { $ ( '.smallsearchbox' ) . autocomplete ( 'close' ) ; } $ ( '.searchbox, .smallsearchbox' ) . blur ( ) ; } } }
A helper function to enable or disable interaction with the user interface.
A helper function to enable or disable interaction with the user interface .
// Turn off the progress cursor // Turn on the search button // Enable the query field(s) // Remove the spinner from the first query field // Enable the previous/next buttons // Rebind hover events // Turn on the progress cursor // Turn off the search button //$('#search-button').attr('disabled', 'disabled'); //$('#search-button').css('background-color', '#8B3A3A'); //$('#search-button').css('color', 'white'); // Add the spinner to the first query field // Disable the previous/next buttons //$('.navButton').css('background-color', '#8B3A3A'); //$('.navButton').css('color', 'white'); // Remove hover bindings // Hide any autocomplete suggestion boxes