<commit_before>upload.modules.addmodule({
    name: 'textpaste',
    init: function () {
      $(document).on('submit', '#textview', this.save.bind(this))
      $(document).on('click', '#retbtn', this.closethis.bind(this))
      $(document).on('keydown', this.keypress.bind(this))
    },
    keypress: function(e) {
      if (!this.current) {
        return
      }

      if (!(e.keyCode == 83 && (e.ctrlKey || e.metaKey))) {
        return
      }

      this.save()
      event.preventDefault()
    },
    save: function(e) {
      e ? e.preventDefault() : undefined
      upload.route.setroute(upload.home)
      upload.home.doupload(new File([this.current.find('textarea').val()],
      this.current.find('#create_filename').val(),
        {
          type: this.current.find('#create_mime').val()
        }
      ))
    },
    closethis: function(closeback) {
      var closeback = this.closeback
      delete this['closeback']
      this.current.remove()
      delete this['current']
      closeback()
    },
    render: function(view, filename, data, mime, closeback) {
      var main = $('<form>').prop('id', 'textview').prop('autocomplete', 'off')

      main.appendTo(view)

      this.closeback = closeback
      this.current = main

      main.append($('<div>').addClass('viewswitcher').append(
        $('<button>').prop('type', 'submit').text('Save').addClass('btn')
      ).append(
        $('<a>').prop('id', 'retbtn').text('Return').addClass('btn')
      ))

      var filenamefield = $('<input>').prop('id', 'create_filename').val(filename)

      var mimefield = $('<input>').prop('hidden', true).prop('id', 'create_mime').val(mime)<commit_msg>Save dialog fixes<commit_after>upload.modules.addmodule({
    name: 'textpaste',
    init: function () {
      $(document).on('submit', '#textview', this.save.bind(this))
      $(document).on('click', '#retbtn', this.closethis.bind(this))
      $(document).on('keypress', this.keypress.bind(this))
    },
    keypress: function(e) {
      if (!this.current || !this.current.is(':visible')) {
        return
      }
      
      if (!(e.which == 115 && (e.ctrlKey || e.metaKey)) && !(e.which == 19)) {
        return
      }

      this.save()
      event.preventDefault()
    },
    save: function(e) {
      e ? e.preventDefault() : undefined
      upload.route.setroute(upload.home)
      upload.home.doupload(new File([this.current.find('textarea').val()],
      this.current.find('#create_filename').val(),
        {
          type: this.current.find('#create_mime').val()
        }
      ))
    },
    cleanup: function() {
      delete this['closeback']
      delete this['current']
    },
    closethis: function() {
      var closeback = this.closeback
      this.current.remove()
      this.cleanup()
      closeback()
    },
    render: function(view, filename, data, mime, closeback) {
      var main = $('<form>').prop('id', 'textview').prop('autocomplete', 'off')

      main.appendTo(view)

      this.closeback = closeback
      this.current = main

      main.append($('<div>').addClass('viewswitcher').append(
        $('<button>').prop('type', 'submit').text('Save').addClass('btn')
      ).append(
        $('<a>').prop('id', 'retbtn').text('Return').addClass('btn')
      ))

      var filenamefield = $('<input>').prop('id', 'create_filename').val(filename)

      var mimefield = $('<input>').prop('hidden', true).prop('id', 'create_mime').val(mime)
{'fraction_non_alphanumeric': 0.20232896652110627, 'fraction_numerical': 0.0020378457059679767, 'mean_word_length': 2.7841409691629955, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2846117', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1062, 'n_words': 165}