diff --git a/gallery/__init__.py b/gallery/__init__.py
index a330404..13db19a 100644
--- a/gallery/__init__.py
+++ b/gallery/__init__.py
@@ -62,9 +62,11 @@ def create_app(test_config=None):
# Load theme
theme_manager.compile_theme('default', app.root_path)
- # Bundle JS files
- js_scripts = Bundle('js/*.js', output='gen/packed.js')
- assets.register('js_all', js_scripts)
+ # Load JS assets
+ js_pre = Bundle('js/pre/*.js', output='gen/pre_packed.js')
+ js_post = Bundle('js/post/*.js', output='gen/post_packed.js')
+ assets.register('js_pre', js_pre)
+ assets.register('js_post', js_post)
# Error handlers, if the error is not a HTTP error, return 500
@app.errorhandler(Exception)
diff --git a/gallery/static/js/login.js b/gallery/static/js/post/login.js
similarity index 98%
rename from gallery/static/js/login.js
rename to gallery/static/js/post/login.js
index d3b12e4..f402e45 100644
--- a/gallery/static/js/login.js
+++ b/gallery/static/js/post/login.js
@@ -54,7 +54,7 @@ function login(event) {
}
// Make form
- let formData = new FormData();
+ const formData = new FormData();
formData.append("username", formUsername);
formData.append("password", formPassword);
@@ -153,7 +153,7 @@ function register(event) {
}
// Make form
- let formData = new FormData();
+ const formData = new FormData();
formData.append("username", formUsername);
formData.append("email", formEmail);
formData.append("password", formPassword);
diff --git a/gallery/static/js/popup.js b/gallery/static/js/post/popup.js
similarity index 100%
rename from gallery/static/js/popup.js
rename to gallery/static/js/post/popup.js
diff --git a/gallery/static/js/uploadTab.js b/gallery/static/js/post/uploadTab.js
similarity index 99%
rename from gallery/static/js/uploadTab.js
rename to gallery/static/js/post/uploadTab.js
index 689b5bc..6cf4016 100644
--- a/gallery/static/js/uploadTab.js
+++ b/gallery/static/js/post/uploadTab.js
@@ -167,7 +167,7 @@ function clearUpload() {
// }
-document.addEventListener('DOMContentLoaded', function() {
+document.addEventListener('DOMContentLoaded', () => {
// Function to upload images
let uploadTab = document.querySelector(".upload-panel");
diff --git a/gallery/static/js/main.js b/gallery/static/js/pre/main.js
similarity index 100%
rename from gallery/static/js/main.js
rename to gallery/static/js/pre/main.js
diff --git a/gallery/static/js/notifications.js b/gallery/static/js/pre/notifications.js
similarity index 100%
rename from gallery/static/js/notifications.js
rename to gallery/static/js/pre/notifications.js
diff --git a/gallery/templates/layout.html b/gallery/templates/layout.html
index 9e776fc..cf58624 100644
--- a/gallery/templates/layout.html
+++ b/gallery/templates/layout.html
@@ -29,7 +29,7 @@
- {% assets "js_all" %}
+ {% assets "js_pre" %}
{% endassets %}
@@ -152,6 +152,10 @@
{% endfor %}
+ {% assets "js_post" %}
+
+ {% endassets %}
+
{% block script %}{% endblock %}