From 3225d23e82a385917c2321dfa7cdcd6ef9a2d235 Mon Sep 17 00:00:00 2001 From: Andre D Date: Wed, 10 Jun 2015 11:45:02 -0400 Subject: [PATCH] Whitespace cleanup --- index.html | 189 +++++++++++++++++++------------------- static/js/downloadable.js | 12 +-- static/js/dragresize.js | 4 +- static/js/textpaste.js | 132 +++++++++++++------------- 4 files changed, 167 insertions(+), 170 deletions(-) diff --git a/index.html b/index.html index 81ce42d..e9e8ab1 100644 --- a/index.html +++ b/index.html @@ -11,8 +11,7 @@ margin: 0; padding: 0; font-family: Sans-Serif; - - overflow: auto; + overflow: auto; } body { @@ -32,14 +31,14 @@ transition: background-color 400ms ease-out; } - .contentarea h1:hover { - background-color: #313538; - -webkit-transition: background-color 100ms ease-in; - -moz-transition: background-color 100ms ease-in; - -o-transition: background-color 100ms ease-in; - -ms-transition: background-color 100ms ease-in; - transition: background-color 100ms ease-in; - } + .contentarea h1:hover { + background-color: #313538; + -webkit-transition: background-color 100ms ease-in; + -moz-transition: background-color 100ms ease-in; + -o-transition: background-color 100ms ease-in; + -ms-transition: background-color 100ms ease-in; + transition: background-color 100ms ease-in; + } .contentarea { width: 200px; @@ -62,50 +61,50 @@ } #viewswitcher { - width: 90px; - height: 40px; - position: absolute; - top: 10px; - right: 10px; - cursor: pointer; - border: 2px solid white; + width: 90px; + height: 40px; + position: absolute; + top: 10px; + right: 10px; + cursor: pointer; + border: 2px solid white; } - - #viewswitcher h3 { - color: white; - text-align: center; - vertical-align: middle; - line-height: 40px; - margin: 0; - -webkit-transition: background-color 400ms ease-out; - -moz-transition: background-color 400ms ease-out; - -o-transition: background-color 400ms ease-out; - -ms-transition: background-color 400ms ease-out; - transition: background-color 400ms ease-out; - } - - #viewswitcher h3:hover { - background-color: #313538; - -webkit-transition: background-color 100ms ease-in; - -moz-transition: background-color 100ms ease-in; - -o-transition: background-color 100ms ease-in; - -ms-transition: background-color 100ms ease-in; - transition: background-color 100ms ease-in; - } - + + #viewswitcher h3 { + color: white; + text-align: center; + vertical-align: middle; + line-height: 40px; + margin: 0; + -webkit-transition: background-color 400ms ease-out; + -moz-transition: background-color 400ms ease-out; + -o-transition: background-color 400ms ease-out; + -ms-transition: background-color 400ms ease-out; + transition: background-color 400ms ease-out; + } + + #viewswitcher h3:hover { + background-color: #313538; + -webkit-transition: background-color 100ms ease-in; + -moz-transition: background-color 100ms ease-in; + -o-transition: background-color 100ms ease-in; + -ms-transition: background-color 100ms ease-in; + transition: background-color 100ms ease-in; + } + #footer { - position: absolute; - width: 100%; - bottom: 10px; - margin: auto; - text-align: center; - } - - #footer a { - color: #aaa; - font-size: 14px; + position: absolute; + width: 100%; + bottom: 10px; + margin: auto; + text-align: center; } + #footer a { + color: #aaa; + font-size: 14px; + } + progress { width: 100%; position: relative; @@ -146,16 +145,16 @@ margin: 0 auto; } - #previewimg img:not(.dragged) { - max-width: 100vw; - max-height: 100vh; - } - - #downloadview .preview { - display: block; - margin: 0 auto; + #previewimg img:not(.dragged) { + max-width: 100vw; + max-height: 100vh; } + #downloadview .preview { + display: block; + margin: 0 auto; + } + audio.preview, video.preview, #downloadprogress, #previewimg { position: relative; @@ -182,10 +181,8 @@ #previewtext { position: absolute; top: 47px; - width: 100%; height: calc(100% - 110px); - overflow: auto; } @@ -194,27 +191,27 @@ padding-left: 50px; } - #previewtext code { - background: none; - margin: 0; - overflow: visible; - } - - #previewtext>textarea { - background: transparent none repeat scroll 0% 0%; - border: 0px none; - padding: 0px; - font-family: monospace; - outline: medium none; - resize: none; - margin: 0; - padding-top: 5px; - padding-left: 50px; - font-size: 13px; - width: calc(100% - 50px); - height: calc(100% - 5px); - color: white; - } + #previewtext code { + background: none; + margin: 0; + overflow: visible; + } + + #previewtext > textarea { + background: transparent none repeat scroll 0% 0%; + border: 0px none; + padding: 0px; + font-family: monospace; + outline: medium none; + resize: none; + margin: 0; + padding-top: 5px; + padding-left: 50px; + font-size: 13px; + width: calc(100% - 50px); + height: calc(100% - 5px); + color: white; + } .hidden { display: none !important; @@ -237,7 +234,7 @@ white-space: nowrap; overflow: hidden; } - + input#filename { position: fixed; font-size: 16px; @@ -293,9 +290,9 @@ color: white; } - .btn:hover { - opacity: 1; - } + .btn:hover { + opacity: 1; + } #linenos { color: #7d7d7d; @@ -330,10 +327,10 @@
-

Text

- +

Text

+
- +

Upload

@@ -351,15 +348,15 @@
- + diff --git a/static/js/downloadable.js b/static/js/downloadable.js index 55801ba..6381cc0 100644 --- a/static/js/downloadable.js +++ b/static/js/downloadable.js @@ -12,7 +12,7 @@ $(function () { var dlbtn = $('#dlbtn') var deletebtn = $('#deletebtn') var viewbtn = $('#inbrowserbtn') - + function hashchanged() { if (window.location.hash && window.location.hash != '#') { upview.addClass('hidden') @@ -29,9 +29,9 @@ $(function () { console.log("bbb"); previewfilename.text(data.header.name) - + console.log(data.header.name) - + var url = URL.createObjectURL(data.decrypted) viewbtn.prop('href', url) @@ -45,7 +45,7 @@ $(function () { var fr = new FileReader() fr.onload = function () { - + var text = fr.result previewtext.removeClass('hidden') @@ -61,7 +61,7 @@ $(function () { } } - fr.readAsText (data.decrypted) + fr.readAsText(data.decrypted) } else if (data.header.mime.startsWith('video/')) { details.find('video.preview').removeClass('hidden').prop('src', url) } else if (data.header.mime.startsWith('audio/')) { @@ -74,7 +74,7 @@ $(function () { } function downloaded() { - console.log("aaa"); + console.log("aaa"); $('#downloadprogress').text('Decrypting') crypt.decrypt(this.response, seed).done(embed) } diff --git a/static/js/dragresize.js b/static/js/dragresize.js index 34b69dc..99f55e5 100644 --- a/static/js/dragresize.js +++ b/static/js/dragresize.js @@ -60,12 +60,12 @@ $(function () { if (!dragging) { return } - + e.preventDefault(); var newx = e.pageX - lastx var newy = e.pageY - lasty - + var width = dragging.width() var height = dragging.height() diff --git a/static/js/textpaste.js b/static/js/textpaste.js index ebd85f0..df21445 100644 --- a/static/js/textpaste.js +++ b/static/js/textpaste.js @@ -1,76 +1,76 @@ -$(function() { - var viewswitcher = $('#viewswitcher'); - var vs_text = $('#viewswitcher>#text'); - var vs_save = $('#viewswitcher>#save'); - - var uploadview = $('#uploadview'); - var textview = $('#textview'); - var textarea = $('#previewtext>textarea'); - var filename = $('input#filename'); - - var pastearea = $('#pastearea') - var uploadprogress = $('#uploadprogress') - var filepicker = $('#filepicker') - var progress = $('#progressamount') - var progressbg = $('#progressamountbg') - - function progressdo(e) { - var percent = (e.loaded / e.total) * 100 - progressbg.css('width', percent + '%'); - progress.text(Math.floor(percent) + '%') - } - - function encrypted(data) { - var formdata = new FormData() - formdata.append('privkey', 'c61540b5ceecd05092799f936e27755f') - formdata.append('ident', data.ident) - formdata.append('file', data.encrypted) - $.ajax({ - url: (g.config.server ? g.config.server : '') + 'up', +$(function () { + var viewswitcher = $('#viewswitcher'); + var vs_text = $('#viewswitcher>#text'); + var vs_save = $('#viewswitcher>#save'); + + var uploadview = $('#uploadview'); + var textview = $('#textview'); + var textarea = $('#previewtext>textarea'); + var filename = $('input#filename'); + + var pastearea = $('#pastearea') + var uploadprogress = $('#uploadprogress') + var filepicker = $('#filepicker') + var progress = $('#progressamount') + var progressbg = $('#progressamountbg') + + function progressdo(e) { + var percent = (e.loaded / e.total) * 100 + progressbg.css('width', percent + '%'); + progress.text(Math.floor(percent) + '%') + } + + function encrypted(data) { + var formdata = new FormData() + formdata.append('privkey', 'c61540b5ceecd05092799f936e27755f') + formdata.append('ident', data.ident) + formdata.append('file', data.encrypted) + $.ajax({ + url: (g.config.server ? g.config.server : '') + 'up', data: formdata, cache: false, processData: false, contentType: false, dataType: 'json', xhr: function () { - var xhr = new XMLHttpRequest() - xhr.upload.addEventListener('progress', progressdo, false) - return xhr + var xhr = new XMLHttpRequest() + xhr.upload.addEventListener('progress', progressdo, false) + return xhr }, type: 'POST' - }).done(function (response) { - progressbg.css('width', 0); - pastearea.removeClass('hidden') - uploadprogress.addClass('hidden') - localStorage.setItem('delete-' + data.ident, response.delkey) - window.location = '#' + data.seed - }) - } - - function doupload(file) { - viewswitcher.addClass('hidden'); - textview.addClass('hidden'); - vs_save.addClass("hidden"); - vs_text.removeClass("hidden"); - textarea.val(''); - - uploadprogress.removeClass('hidden'); - progress.text('Encrypting'); - crypt.encrypt(file).done(encrypted); - } - - viewswitcher.click(function() { - if (vs_text.hasClass("hidden")) { - if (textarea.val() != "") - doupload(new Blob([textarea.val()], { type: 'text/plain', name: filename.val() || "Pasted Text.txt" })) - } else { - vs_text.addClass("hidden"); - uploadview.addClass("hidden"); - - vs_save.removeClass("hidden"); - textview.removeClass("hidden"); - - textarea.select(); + }).done(function (response) { + progressbg.css('width', 0); + pastearea.removeClass('hidden') + uploadprogress.addClass('hidden') + localStorage.setItem('delete-' + data.ident, response.delkey) + window.location = '#' + data.seed + }) } - }); + + function doupload(file) { + viewswitcher.addClass('hidden'); + textview.addClass('hidden'); + vs_save.addClass("hidden"); + vs_text.removeClass("hidden"); + textarea.val(''); + + uploadprogress.removeClass('hidden'); + progress.text('Encrypting'); + crypt.encrypt(file).done(encrypted); + } + + viewswitcher.click(function () { + if (vs_text.hasClass("hidden")) { + if (textarea.val() != "") + doupload(new Blob([textarea.val()], { type: 'text/plain', name: filename.val() || "Pasted Text.txt" })) + } else { + vs_text.addClass("hidden"); + uploadview.addClass("hidden"); + + vs_save.removeClass("hidden"); + textview.removeClass("hidden"); + + textarea.select(); + } + }); }) \ No newline at end of file