<commit_before>window.hads = (function () {
  'use strict';

  var editor = null;
  var byId = document.getElementById.bind(document);

  window.onload = function () {
    var editorElem = byId('editor');
    if (editorElem) {
      editor = ace.edit('editor');
      editor.setTheme('ace/theme/clouds');
      var session = editor.getSession();
      var count = session.getLength();
      session.setMode('ace/mode/markdown');
      editor.focus();
      editor.gotoLine(count, session.getLine(count-1).length);
    }

    document.addEventListener('click', function (e) {
      if (e.target.id === 'add-modal')
        window.hads.closeAdd();
    }, false);
    document.addEventListener('keydown', function (e) {
      if (e.keyCode === 27)
        window.hads.closeAdd();
    }, false);
  };

  return {
    save: function () {
      if (editor) {
        byId('content').value = editor.getValue();
        byId('form').submit();
      }
    },
    showAdd: function () {
      byId('add-modal').className = '';
      byId('add').focus();
    },
    closeAdd: function () {
      byId('add-modal').className = 'hidden';
    },
    add: function (file) {
      this.closeAdd();
      window.location = '/' + file + '?create=1';
    }
  }
})();<commit_msg>Added save keyboard shortcut<commit_after>window.hads = (function () {
  'use strict';

  var editor = null;
  var byId = document.getElementById.bind(document);
  var module = {
    save: function () {
      if (editor) {
        byId('content').value = editor.getValue();
        byId('form').submit();
      }
    },
    showAdd: function () {
      byId('add-modal').className = '';
      byId('add').focus();
    },
    closeAdd: function () {
      byId('add-modal').className = 'hidden';
    },
    add: function (file) {
      this.closeAdd();
      window.location = '/' + file + '?create=1';
    }
  };

  window.onload = function () {
    var editorElem = byId('editor');
    if (editorElem) {
      editor = ace.edit('editor');
      editor.setOptions({
        useSoftTabs: true,
        tabSize: 2,
        mode: 'ace/mode/markdown',
        theme: 'ace/theme/clouds'
      });
      var session = editor.getSession();
      var count = session.getLength();
      editor.focus();
      editor.gotoLine(count, session.getLine(count-1).length);
      editor.commands.addCommand({
        name: 'save',
        bindKey: {
          win: 'Ctrl-S',
          mac: 'Command-S'
        },
        exec: module.save,
        readOnly: true
      });
    }

    document.addEventListener('click', function (e) {
      if (e.target.id === 'add-modal')
        window.hads.closeAdd();
    }, false);
    document.addEventListener('keydown', function (e) {
      if (e.keyCode === 27)
        window.hads.closeAdd();
    }, false);
  };

  return module;
})();
{'fraction_non_alphanumeric': 0.17582417582417584, 'fraction_numerical': 0.0031903580290677065, 'mean_word_length': 2.292882147024504, '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': '6772219', 'n_tokens_mistral': 889, 'n_tokens_neox': 872, 'n_words': 163}