<commit_before>!!!
%html
  %head
    %title= title
    %link{href: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css", rel: "stylesheet"}
    %link{href: "https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/flatly/bootstrap.min.css", rel: "stylesheet"}
    %link{href: "http://getbootstrap.com/examples/dashboard/dashboard.css", rel: "stylesheet"}
    %script{src: "https://code.jquery.com/jquery-2.1.4.min.js"}
    %script{src: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"}
    %script{src: "http://cdn.rawgit.com/olivernn/lunr.js/master/lunr.min.js"}
    :css
      h1 .label, h2 .label, h3 .label, h4 .label, h5 .label {
        vertical-align: top;
      }
      .nav-sidebar>li>a {
        padding: 5px 15px;
      }
      .nav-sidebar hr {
        margin-top: 10px;
        margin-bottom: 10px;
      }
      .nav-sidebar p {
        padding-left: 5px;
      }
      a.anchor {
        display: block;
        position: relative;
        top: -80px;
        visibility: hidden;
      }
      .search-results {
        display: none;
        width: 100%;
        z-index: 99;
      }
    :javascript
      $(document).ready( function() {
        index = lunr(function () {
          this.field('name', {boost: 10})
          this.field('brief', {boost: 5})
          this.field('description')
          this.field('type')
          this.ref('id')
        });

        // TODO When hosted on a web server it would be better to load from search.json
        // $.getJSON(search_json_url, function(json) {
        //   documents = json;
        // });
        var documents = $.parseJSON('#{lunr_data.to_json}');

        documents.forEach(function (document) {
          index.add(document);
        });

        $('.search-field').keyup(function() {
          $('.search-results').empty();

          var query = $(this).val();
          if(query === '') {
            $('.search-results').hide();
          }
          else {
            $('.search-results').append($('<h2/>').html("Search Results"));
            var results = index.search(query);
            if(results.length == 0) {
              $('.search-results').append($('<p><strong>No results found</strong></p>'));
            }
            else {
              $('.search-results').append(results.map(function(result) {
                return $('<p/>').html($('<textarea/>').html(result.ref).text());
              }));
            }
            $('.search-results').show();
          }
        });

        $('.search-field').keypress(function(e) {
          if(e.which == 13) {
            e.preventDefault();<commit_msg>Adding scroll to top when searching in default template<commit_after>!!!
%html
  %head
    %title= title
    %link{href: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css", rel: "stylesheet"}
    %link{href: "https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/flatly/bootstrap.min.css", rel: "stylesheet"}
    %link{href: "http://getbootstrap.com/examples/dashboard/dashboard.css", rel: "stylesheet"}
    %script{src: "https://code.jquery.com/jquery-2.1.4.min.js"}
    %script{src: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"}
    %script{src: "http://cdn.rawgit.com/olivernn/lunr.js/master/lunr.min.js"}
    :css
      h1 .label, h2 .label, h3 .label, h4 .label, h5 .label {
        vertical-align: top;
      }
      .nav-sidebar>li>a {
        padding: 5px 15px;
      }
      .nav-sidebar hr {
        margin-top: 10px;
        margin-bottom: 10px;
      }
      .nav-sidebar p {
        padding-left: 5px;
      }
      a.anchor {
        display: block;
        position: relative;
        top: -80px;
        visibility: hidden;
      }
      .search-results {
        display: none;
        width: 100%;
        z-index: 99;
      }
    :javascript
      $(document).ready( function() {
        index = lunr(function () {
          this.field('name', {boost: 10})
          this.field('brief', {boost: 2})
          this.field('description')
          this.field('type')
          this.ref('id')
        });

        // TODO When hosted on a web server it would be better to load from search.json
        // $.getJSON(search_json_url, function(json) {
        //   documents = json;
        // });
        var documents = $.parseJSON('#{lunr_data.to_json}');

        documents.forEach(function (document) {
          index.add(document);
        });

        $('.search-field').keyup(function(e) {
          if(e.which == 13) {
            return;
          }
          $('.search-results').empty();

          var query = $(this).val();
          if(query === '') {
            $('.search-results').hide();
          }
          else {
            $('.search-results').append($('<h2/>').html("Search Results"));
            var results = index.search(query);
            if(results.length == 0) {
              $('.search-results').append($('<p><strong>No results found</strong></p>'));
            }
            else {
              $('.search-results').append(results.map(function(result) {
                return $('<p/>').html($('<textarea/>').html(result.ref).text());
              }));
            }
            $('.search-results').show();
            $("html, body").animate({ scrollTop: 0 }, "slow");
          }
        });

        $('.search-field').keypress(function(e) {
          if(e.which == 13) {
            e.preventDefault();
{'fraction_non_alphanumeric': 0.1828550404709345, 'fraction_numerical': 0.014900662251655629, 'mean_word_length': 1.8127263321262286, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 8, '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': '6522324', 'n_tokens_mistral': 1737, 'n_tokens_neox': 1668, 'n_words': 279}