From 96245818a67c6a51ba5c7a5cd70c33cbc5589055 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 22 Oct 2012 17:41:42 +0200 Subject: Merge upload_form.js into script.js Signed-off-by: Florian Pritz --- application/views/file/upload_form.php | 1 - data/js/script.js | 15 +++++++++++++++ data/js/upload_form.js | 16 ---------------- 3 files changed, 15 insertions(+), 17 deletions(-) delete mode 100644 data/js/upload_form.js diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php index d92cbfb5c..4d69c69ee 100644 --- a/application/views/file/upload_form.php +++ b/application/views/file/upload_form.php @@ -34,7 +34,6 @@ var max_upload_size = ""; /* ]]> */ - diff --git a/data/js/script.js b/data/js/script.js index e49733b97..b9f60ceea 100644 --- a/data/js/script.js +++ b/data/js/script.js @@ -55,6 +55,21 @@ return this; }); + // check file size before uploading if browser support html5 + if (window.File && window.FileList) { + function checkFileUpload(evt) { + var f = evt.target.files[0]; + if (f.size > max_upload_size) { + document.getElementById('upload_button').innerHTML = "File too big"; + document.getElementById('upload_button').disabled = true; + } else { + document.getElementById('upload_button').innerHTML = "Upload it!"; + document.getElementById('upload_button').disabled = false; + } + } + + document.getElementById('file').addEventListener('change', checkFileUpload, false); + } }); })(jQuery); diff --git a/data/js/upload_form.js b/data/js/upload_form.js deleted file mode 100644 index 111747c67..000000000 --- a/data/js/upload_form.js +++ /dev/null @@ -1,16 +0,0 @@ -// check file size before uploading if browser support html5 -if (window.File && window.FileList) { - function checkFileUpload(evt) { - var f = evt.target.files[0]; - if (f.size > max_upload_size) { - document.getElementById('upload_button').innerHTML = "File too big"; - document.getElementById('upload_button').disabled = true; - } else { - document.getElementById('upload_button').innerHTML = "Upload it!"; - document.getElementById('upload_button').disabled = false; - } - } - - document.getElementById('file').addEventListener('change', checkFileUpload, false); -} - -- cgit v1.2.3-24-g4f1b