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.which == 83 && (e.ctrlKey || e.metaKey))) { return } this.save() e.preventDefault() }, save: function(e) { e ? e.preventDefault() : undefined var blob = new Blob([this.current.find('textarea').val()], { type: this.current.find('#create_mime').val() } ) blob.name = this.current.find('#create_filename').val() window.location = '#noref' upload.route.setroute(upload.home) upload.home.doupload(blob) }, 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 = $('