From ae3bddc36eee0e1eb68c8a28b24a6f2ba280963a Mon Sep 17 00:00:00 2001
From: Andreas Nilsson <nilsson.andreas.85@gmail.com>
Date: Thu, 2 Jul 2015 18:48:06 +0200
Subject: [PATCH] Fixed so that HTML is displayed instead of a popup.
---
mediagoblin/static/js/file_size.js | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/mediagoblin/static/js/file_size.js b/mediagoblin/static/js/file_size.js
index 9ba366b..477d0cc 100644
a
|
b
|
var file;
|
20 | 20 | var uploaded; |
21 | 21 | var upload_limit; |
22 | 22 | var max_file_size; |
23 | | |
24 | | // FIXME: Very hackish, please fix if you can. This is because the extra HTML won't appear. |
25 | | var popup; |
| 23 | var bAttachment; |
26 | 24 | |
27 | 25 | function check_file_size() { |
28 | 26 | var file_size = file.files[0].size / (1024.0 * 1024); |
29 | 27 | |
30 | 28 | if (file_size >= max_file_size) { |
31 | | if (popup) |
| 29 | if (bAttachment) |
32 | 30 | { |
33 | | alert("Sorry, the file size is too big.") |
| 31 | $('#attachment_file').after('<p id="file_size_error" class="form_field_error">Sorry, the file size is too big.</p>'); |
34 | 32 | document.getElementById('max_size_reached').value = true; |
35 | 33 | } |
36 | 34 | else if (document.getElementById('upload_limit_error')) { |
… |
… |
function check_file_size() {
|
43 | 41 | |
44 | 42 | if (upload_limit) { |
45 | 43 | if ( uploaded + file_size >= upload_limit) { |
46 | | if (popup) |
| 44 | if (bAttachment) |
47 | 45 | { |
48 | | alert("Sorry, uploading this file will put you over your upload limit."); |
| 46 | $('#attachment_file').after('<p id="upload_limit_error" class="form_field_error">Sorry, uploading this file will put you over your upload limit.</p>'); |
49 | 47 | document.getElementById('max_size_reached').value = true; |
50 | 48 | } |
51 | 49 | else if (document.getElementById('upload_limit_error')) { |
… |
… |
function check_file_size() {
|
60 | 58 | } |
61 | 59 | |
62 | 60 | $(document).ready(function(){ |
63 | | popup = false; |
| 61 | bAttachment = false; |
64 | 62 | file = document.getElementById('file'); |
65 | 63 | if (file == null) |
66 | 64 | { |
67 | | popup = true; |
| 65 | bAttachment = true; |
68 | 66 | file = document.getElementById('attachment_file'); |
69 | 67 | } |
70 | 68 | uploaded = parseInt(document.getElementById('uploaded').value); |