upload.modules.addmodule({ name: 'download', // Dear santa, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings template: '\
\
\

\ \
\
\
\ DownloadView In BrowserDelete\
\ \
\ ', init: function () { $(document).on('click', '#editpaste', this.editpaste.bind(this)) }, route: function (route, content) { return this }, render: function (view) { view.html(this.template) this._ = {} this._.view = view this._.detailsarea = view.find('#downloaddetails') this._.filename = view.find('#downloaded_filename') this._.btns = view.find('#btnarea') this._.deletebtn = view.find('#deletebtn') this._.dlbtn = view.find('#dlbtn') this._.viewbtn = view.find('#inbrowserbtn') this._.viewswitcher = view.find('.viewswitcher') this._.newupload = view.find('#newupload') this._.editpaste = view.find('#editpaste') this._.dlarea = view.find('#dlarea') this._.title = $('title') $('#footer').hide() }, initroute: function (content) { delete this._['text'] this._.filename.hide() this._.title.text("Up1") this._.btns.hide() this._.editpaste.hide() this._.newupload.hide() this._.content = {} this._.content.main = this._.content.loading = $('

').prop('id', 'downloadprogress').text('Downloading') this._.detailsarea.empty().append(this._.content.main) this._.deletebtn.hide() upload.updown.download(content, this.progress.bind(this), this.downloaded.bind(this)) }, unrender: function () { this._.title.text('Up1') delete this['_'] }, assocations: { 'application/javascript': 'text', 'application/x-javascript': 'text', 'application/xml': 'text', }, downloaded: function (data) { this._.filename.text(data.header.name) this._.title.text(data.header.name + ' - Up1') var stored = localStorage.getItem('delete-' + data.ident) if (stored) { this._.deletebtn.show().prop('href', (upload.config.server ? upload.config.server : '') + 'del?delkey=' + stored + '&ident=' + data.ident) } this._.newupload.show() var url = URL.createObjectURL(data.decrypted) this._.viewbtn.prop('href', url) this._.dlbtn.prop('href', url) this._.dlbtn.prop('download', data.header.name) delete this._['content'] this._.detailsarea.empty() association = this.assocations[data.header.mime] if (data.header.mime.startsWith('image/')) { var imgcontent = $('
').prop('id', 'previewimg').addClass('preview').appendTo(this._.detailsarea) var previewimg = $('').addClass('dragresize').appendTo(imgcontent).prop('src', url) } else if (data.header.mime.startsWith('text/') || association == 'text') { var textcontent = $('
').prop('id', 'downloaded_text').addClass('preview').addClass('previewtext').appendTo(this._.detailsarea) var linenos = $('
').prop('id', 'linenos').appendTo(textcontent) var pre = $('
').appendTo(textcontent)

            var code = $('').appendTo(pre)

            var fr = new FileReader()

            fr.onload = function () {

                var text = fr.result

                this._.text = {}

                this._.text.header = data.header

                this._.text.data = text

                code.text(text)

                hljs.highlightBlock(code[0])

                var length = text.split(/\r\n|\r|\n/).length

                for (var i = 0; i < length; i++) {
                    linenos.append((i + 1) + '
') } }.bind(this) fr.readAsText(data.decrypted) this._.editpaste.show() } else if (data.header.mime.startsWith('video/')) { $('