treconomics_project/static/javascripts/search_helpers.js
/*
Bind hovers over search result elements.
Logs the event with an AJAX call for hovering in and a call for hovering out.
*/
Bind hovers over search result elements.
Logs the event with an AJAX call for hovering in and a call for hovering out.
Bind hovers over search result elements . Logs the event with an AJAX call for hovering in and a call for hovering out .
function bindResultHovering() {
    $('.search_result').hover(
        function(event) {
            var parent = $(event.target).closest('div[class="search_result"]');
            var trecID = $(parent[0]).attr('id');
            var whooshID = $(parent[0]).attr('whooshid');
            var rank = $(parent[0]).attr('rank');
            var page = $(parent[0]).attr('page');
            $.ajax({
                url: '/treconomics/hover/',
                data: {'status': 'in', 'trecID': trecID, 'whooshID': whooshID, 'rank': rank, 'page': page}
            }).fail(function(data) {
                var responseData = $.parseJSON(data.responseText);
            });
        },
        function(event) {
            var parent = $(event.target).closest('div[class="search_result"]');
            var trecID = $(parent[0]).attr('id');
            var whooshID = $(parent[0]).attr('whooshid');
            var rank = $(parent[0]).attr('rank');
            var page = $(parent[0]).attr('page');
            $.ajax({
                url: '/treconomics/hover/',
                data: {'status': 'out', 'trecID': trecID, 'whooshID': whooshID, 'rank': rank, 'page': page}
            }).fail(function(data) {
                var responseData = $.parseJSON(data.responseText);
            });
    });
}
function bindResultHovering ( ) { $ ( '.search_result' ) . hover ( function ( event ) { var parent = $ ( event . target ) . closest ( 'div[class="search_result"]' ) ; var trecID = $ ( parent [ 0 ] ) . attr ( 'id' ) ; var whooshID = $ ( parent [ 0 ] ) . attr ( 'whooshid' ) ; var rank = $ ( parent [ 0 ] ) . attr ( 'rank' ) ; var page = $ ( parent [ 0 ] ) . attr ( 'page' ) ; $ . ajax ( { url : '/treconomics/hover/' , data : { 'status' : 'in' , 'trecID' : trecID , 'whooshID' : whooshID , 'rank' : rank , 'page' : page } } ) . fail ( function ( data ) { var responseData = $ . parseJSON ( data . responseText ) ; } ) ; } , function ( event ) { var parent = $ ( event . target ) . closest ( 'div[class="search_result"]' ) ; var trecID = $ ( parent [ 0 ] ) . attr ( 'id' ) ; var whooshID = $ ( parent [ 0 ] ) . attr ( 'whooshid' ) ; var rank = $ ( parent [ 0 ] ) . attr ( 'rank' ) ; var page = $ ( parent [ 0 ] ) . attr ( 'page' ) ; $ . ajax ( { url : '/treconomics/hover/' , data : { 'status' : 'out' , 'trecID' : trecID , 'whooshID' : whooshID , 'rank' : rank , 'page' : page } } ) . fail ( function ( data ) { var responseData = $ . parseJSON ( data . responseText ) ; } ) ; } ) ; }
Bind hovers over search result elements.
Bind hovers over search result elements .
//                if ('timeout' in responseData) { //                    if (!timeoutFlag) { //                        //alert("Your time for this exercise has expired. We will now redirect you to the next step."); //                        window.location = APP_ROOT + 'next/'; //                    } //                    timeoutFlag = true; //                } // //                if ('timeout' in responseData) { //                    if (!timeoutFlag) { //                        //alert("Your time for this exercise has expired. We will now redirect you to the next step."); //                        window.location = APP_ROOT + 'next/'; //                    } //                    timeoutFlag = true; //                }