<commit_before>$(document).ready(function() {
    var page_path = document.location.hash.replace(/^#/, '')
    updateBreadCrumbs(page_path)

    table = $(filechooser_id).dataTable( {
        "sorting": [],
        "language": {
          "emptyTable":     "empty directory"
        },
        "ajax":       baseurl + page_path,
        "columns": [
            { "render": function ( value, type, data, meta ) {
                file = data['filename']
                if (type == 'display'){
                  url = (file['type'] == 'folder')  ? '#'+file['value'] : nexturl + encodeURIComponent(file['value']);

                  content = "<span class=\"glyphicon glyphicon-"+file['icon']+"\" aria-hidden=\"true\"></span> &nbsp;";
                  return content + ' <a href="'+url+'" data-file-name="'+file['value']+'" class="file-type-'+file['type']+'">' + file['display'] + '</a>';
                }
                else
                  return data['filename']['value'];
            }, },
            { "render": function ( value, type, data, meta ) {
                  if (type == 'display'){
                    return '<span title="'+data['size']['value']+' bytes">' + data['size']['display'] + '</span>';
                  }
                  else return data['size']['value'];
            }, },
            { "render": function ( value, type, data, meta ) {
                  if (type == 'display'){
                    return '<span title="'+data['mtime']['title']+'">' + data['mtime']['display'] + '</span>';
                  }
                  else return data['mtime']['value'];
              },
            }
        ]
    } );

    // Add event for clicking on folders
    $(filechooser_id + ' tbody').on('click', 'a.file-type-folder', function () {
        changeDirectory($(this).data('file-name'))
    });

    // Add event for clicking on breadcrumbs
    $('#folder-breadcrumbs').on('click', 'a', function () {
        changeDirectory($(this).data('full-path'))
    });

    $(window).on('hashchange', function(){
          var page_path = document.location.hash.replace(/^#/, '')
          changeDirectory(page_path)
    });

    function changeDirectory(new_path){
      updateBreadCrumbs(new_path)
      table.api().ajax.url(baseurl + encodeURIComponent(new_path)).load();
    }
<commit_msg>Filechooser should work a little better now<commit_after>$(document).ready(function() {
    var page_path = document.location.hash.replace(/^#/, '')
    updateBreadCrumbs(page_path)

    table = $(filechooser_id).dataTable( {
        "sorting": [],
        "language": {
          "emptyTable":     "empty directory"
        },
        "ajax":       baseurl + page_path,
        "columns": [
            { "render": function ( value, type, data, meta ) {
                file = data['filename']
                if (type == 'display'){
                  url = (file['type'] == 'folder')  ? '#'+file['value'] : nexturl + encodeURI(file['value']);

                  content = "<span class=\"glyphicon glyphicon-"+file['icon']+"\" aria-hidden=\"true\"></span> &nbsp;";
                  return content + ' <a href="'+url+'" data-file-name="'+file['value']+'" class="file-type-'+file['type']+'">' + file['display'] + '</a>';
                }
                else
                  return data['filename']['value'];
            }, },
            { "render": function ( value, type, data, meta ) {
                  if (type == 'display'){
                    return '<span title="'+data['size']['value']+' bytes">' + data['size']['display'] + '</span>';
                  }
                  else return data['size']['value'];
            }, },
            { "render": function ( value, type, data, meta ) {
                  if (type == 'display'){
                    return '<span title="'+data['mtime']['title']+'">' + data['mtime']['display'] + '</span>';
                  }
                  else return data['mtime']['value'];
              },
            }
        ]
    } );

    // Add event for clicking on folders
    $(filechooser_id + ' tbody').on('click', 'a.file-type-folder', function () {
        changeDirectory($(this).data('file-name'))
    });

    // Add event for clicking on breadcrumbs
    $('#folder-breadcrumbs').on('click', 'a', function () {
        changeDirectory($(this).data('full-path'))
    });

    $(window).on('hashchange', function(){
          var page_path = document.location.hash.replace(/^#/, '')
          changeDirectory(page_path)
    });

    function changeDirectory(new_path){
      updateBreadCrumbs(new_path)
      table.api().ajax.url(baseurl + encodeURI(new_path)).load();
    }

{'fraction_non_alphanumeric': 0.19741935483870968, 'fraction_numerical': 0.0, 'mean_word_length': 1.9756877799104287, 'pattern_counts': {'":': 16, '<': 19, '<?xml version=': 0, '>': 19, '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': '7313394', 'n_tokens_mistral': 1319, 'n_tokens_neox': 1280, 'n_words': 240}