From e1b83ec5480fbb02178b77d0b4fee704b012efd8 Mon Sep 17 00:00:00 2001 From: discomrade Date: Thu, 11 Nov 2021 13:06:19 -0100 Subject: [PATCH 1/2] Call upload-selection.js inline Makes the change happen earlier, reducing content shift --- js/upload-selection.js | 6 +++--- templates/post_form.html | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/upload-selection.js b/js/upload-selection.js index b342a134..c40b3383 100644 --- a/js/upload-selection.js +++ b/js/upload-selection.js @@ -9,10 +9,10 @@ * $config['additional_javascript'][] = 'js/jquery.min.js'; * //$config['additional_javascript'][] = 'js/wpaint.js'; * $config['additional_javascript'][] = 'js/upload-selection.js'; - * + * */ -$(function(){ +function init_upload_selection(){ var enabled_file = true; var enabled_url = $("#upload_url").length > 0; var enabled_embed = $("#upload_embed").length > 0; @@ -84,4 +84,4 @@ $(function(){ enable_file(); } -}); +} diff --git a/templates/post_form.html b/templates/post_form.html index 5cbe0d35..cff1c03a 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -210,6 +210,9 @@ +{% if 'js/upload-selection.js' in config.additional_javascript %} + +{% endif %} From 409fbdf24afbafd0b48753b37404256b7157ea46 Mon Sep 17 00:00:00 2001 From: discomrade Date: Thu, 11 Nov 2021 13:07:32 -0100 Subject: [PATCH 2/2] Make file-selector.js inline call conditional --- templates/post_form.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/post_form.html b/templates/post_form.html index cff1c03a..1d77443a 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -148,7 +148,10 @@ + {% if 'js/file-selector.js' in config.additional_javascript %} + {% endif %} + {% if config.allow_upload_by_url %}