<commit_before>$(document).ready(function() {
    
    // Add clickhandler for navbar navigation
    $('.load-content').click(function(e) {        
            e.preventDefault();
    
            // Clear the view and stop the ajax calls
            $('#alert-navigation').hide();
            $.ajaxQ.abortAll();
            
            $this = $(this);
            if ( $this.hasClass('load-venues') ) {
                // Load venues
                loadVenues( $this.attr('href') );
            } else {
                // Load non-venue content
                loadingDisplay(false, true);
                $('#loadmorevenues').hide();
                $.get("/", function(r){
                    $('#venues').html(r); 
                    $('#loading').hide();
                });
            }
    });
    
    // Add clickhandler for the explore search
    $('#btn-explore-search').click(function(e){
        e.preventDefault();          
        $location = $("#input-explore-location");
        $query = $("#input-explore-query");
        params = {
            geolocation: $location.val() ? $location.val() : $location.attr('placeholder'),
            query: $query.val() ? $query.val() : $query.attr('placeholder')
        };
        loadVenues("explore/", params);
    });
       
    // Add clickhandler for the load more venues button
    $('#loadmorevenues-button').click(function(){ 
        loadVenues( $(this).data("current-url"), $(this).data("params") );
    });
      
    // Add clickhandler to the filter so it gets updates
    $(".wheelchair-filter-checkbox").click( updateFilter );
    
    // Activate the helping tooltips (for filter)
    $("[rel='tooltip']").tooltip();
       
    // Add clickhandler for the update button in the modal
    $('#node-update-send').click(function(){
        updateWheelmapNode( $(this).data('wheelmapId'),
                            $('#form-update-status input:checked').val(),
                            $(this).data('$refererDiv'));
    });
    
    // Removing the success/error alert when closed in the modal
    $('#editwheelmap').on('hidden', function () {
        $('#alert-edit-node').removeClass('alert-success alert-error').hide();        
    })
       
    
    // Keeping track of the ajax calls to abort them
    // From: http://stackoverflow.com/a/11612641/1462065
    $.ajaxQ = (function(){
      var id = 0, Q = {};

      $(document).ajaxSend(function(e, jqx){
        jqx._id = ++id;
        Q[jqx._id] = jqx;
      });
      $(document).ajaxComplete(function(e, jqx){
        delete Q[jqx._id];
      });

      return {
        abortAll: function(){
          var r = [];
          $.each(Q, function(i, jqx){
            r.push(jqx._id);
            jqx.abort();
          });
          return r;
        }
      };

    })();
    
});

var updateWheelmapNode = function(wheelmapId,  wheelchairStatus, $refererdiv) {
        $alert = $('#alert-edit-node');<commit_msg>Modified ajax abort code<commit_after>$(document).ready(function() {
    
    // Add clickhandler for navbar navigation
    $('.load-content').click(function(e) {        
            e.preventDefault();
    
            // Clear the view and stop the ajax calls
            $('#alert-navigation').hide();
            $.ajaxQ.abortAll();
            
            $this = $(this);
            if ( $this.hasClass('load-venues') ) {
                // Load venues
                loadVenues( $this.attr('href') );
            } else {
                // Load non-venue content
                loadingDisplay(false, true);
                $('#loadmorevenues').hide();
                $.get("/", function(r){
                    $('#venues').html(r); 
                    $('#loading').hide();
                });
            }
    });
    
    // Add clickhandler for the explore search
    $('#btn-explore-search').click(function(e){
        e.preventDefault();          
        $location = $("#input-explore-location");
        $query = $("#input-explore-query");
        params = {
            geolocation: $location.val() ? $location.val() : $location.attr('placeholder'),
            query: $query.val() ? $query.val() : $query.attr('placeholder')
        };
        loadVenues("explore/", params);
    });
       
    // Add clickhandler for the load more venues button
    $('#loadmorevenues-button').click(function(){ 
        loadVenues( $(this).data("current-url"), $(this).data("params") );
    });
      
    // Add clickhandler to the filter so it gets updates
    $(".wheelchair-filter-checkbox").click( updateFilter );
    
    // Activate the helping tooltips (for filter)
    $("[rel='tooltip']").tooltip();
       
    // Add clickhandler for the update button in the modal
    $('#node-update-send').click(function(){
        updateWheelmapNode( $(this).data('wheelmapId'),
                            $('#form-update-status input:checked').val(),
                            $(this).data('$refererDiv'));
    });
    
    // Removing the success/error alert when closed in the modal
    $('#editwheelmap').on('hidden', function () {
        $('#alert-edit-node').removeClass('alert-success alert-error').hide();        
    })
       
    
    // Keeping track of the ajax calls to abort them
    // Adaoted from: http://stackoverflow.com/a/11612641/1462065
    $.ajaxQ = (function(){
      var id = 0, Q = [];

      $(document).ajaxSend(function(e, jqx){
        jqx._id = ++id;
        Q[jqx._id] = jqx;
      });
      $(document).ajaxComplete(function(e, jqx){
        delete Q[jqx._id];
      });

      return {
        abortAll: function(){
          $.each(Q, function(i, jqx){
            jqx.abort();
          });
        }
      };

    })();
    
});

var updateWheelmapNode = function(wheelmapId,  wheelchairStatus, $refererdiv) {
        $alert = $('#alert-edit-node');
{'fraction_non_alphanumeric': 0.17008196721311475, 'fraction_numerical': 0.00546448087431694, 'mean_word_length': 1.7523496240601504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2937884', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1637, 'n_words': 326}