From e2b4b8a7f895d691fc273ef56cffda48a18e9f0a Mon Sep 17 00:00:00 2001 From: Stephan Kristyn Date: Tue, 10 Feb 2026 14:36:03 +0100 Subject: [PATCH 1/8] Adding new DOM element, CSS and JS code --- css/common.css | 6 ++++++ js/privatebin.js | 4 +++- lib/Configuration.php | 2 +- tpl/bootstrap5.php | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/css/common.css b/css/common.css index b5019c47..a46483b1 100644 --- a/css/common.css +++ b/css/common.css @@ -26,6 +26,12 @@ margin-bottom: 20px; } +#attachmentInfo { + color: #666; + font-size: 0.9em; + margin-left: 0.25em; +} + #dropzone { text-align: center; position: fixed; diff --git a/js/privatebin.js b/js/privatebin.js index a32084e2..533a5a1e 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2995,7 +2995,9 @@ jQuery.PrivateBin = (function($) { attachmentLink.attr('download', fileName); const fileSize = Helper.formatBytes(decodedData.length); - const fileInfo = document.createTextNode(` (${fileName}, ${fileSize})`); + const fileInfo = document.createElement('span'); + fileInfo.id = 'attachmentInfo'; + fileInfo.textContent = ` (${fileName}, ${fileSize})`; template[0].appendChild(fileInfo); } diff --git a/lib/Configuration.php b/lib/Configuration.php index ae647e7d..28bbc284 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -122,7 +122,7 @@ class Configuration 'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==', 'js/legacy.js' => 'sha512-RQEo1hxpNc37i+jz/D9/JiAZhG8GFx3+SNxjYnI7jUgirDIqrCSj6QPAAZeaidditcWzsJ3jxfEj5lVm7ZwTRQ==', 'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==', - 'js/privatebin.js' => 'sha512-Iocquz/9jEXqfZzJP03eR8Km4tMelTrl9JkRs4+zuvUJ1ABl8qoqkRnaftcoqE3sJHTncnnlOwAsL3brzH05gA==', + 'js/privatebin.js' => 'sha512-h+pxj+EYo9SEt65HLl1lFThdF05atKK3xaWBqGBWxERpllH5JZOsSWSM+V5vk/hj20HPQewsPgtrhBDv54uMIQ==', 'js/purify-3.3.0.js' => 'sha512-lsHD5zxs4lu/NDzaaibe27Vd2t7Cy9JQ3qDHUvDfb4oZvKoWDNEhwUY+4bT3R68cGgpgCYp8U1x2ifeVxqurdQ==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', 'js/zlib-1.3.1-2.js' => 'sha512-4gT+v+BkBqdVBbKOO4qKGOAzuay+v1FmOLksS+bMgQ08Oo4xEb3X48Xq1Kv2b4HtiCQA7xq9dFRzxal7jmQI7w==', diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index 47b1fcec..06547e1a 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -550,6 +550,7 @@ endif; From 9ab16674aa43e6cbe8d095df4e980988566e9fbf Mon Sep 17 00:00:00 2001 From: Stephan Kristyn Date: Tue, 10 Feb 2026 18:22:17 +0100 Subject: [PATCH 2/8] Adding Bootstrap Classname to dynamically created child element --- css/bootstrap/privatebin.css | 2 +- css/common.css | 6 ------ js/privatebin.js | 2 +- lib/Configuration.php | 2 +- tpl/bootstrap.php | 4 ++-- tpl/bootstrap5.php | 3 +-- 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/css/bootstrap/privatebin.css b/css/bootstrap/privatebin.css index ab2fdebc..e45655b9 100644 --- a/css/bootstrap/privatebin.css +++ b/css/bootstrap/privatebin.css @@ -165,4 +165,4 @@ html[dir="rtl"] #prettyMessageCopyBtn { #copyShortcutHint { margin-bottom: 5px; -} \ No newline at end of file +} diff --git a/css/common.css b/css/common.css index a46483b1..b5019c47 100644 --- a/css/common.css +++ b/css/common.css @@ -26,12 +26,6 @@ margin-bottom: 20px; } -#attachmentInfo { - color: #666; - font-size: 0.9em; - margin-left: 0.25em; -} - #dropzone { text-align: center; position: fixed; diff --git a/js/privatebin.js b/js/privatebin.js index 533a5a1e..5c77ed8c 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2996,7 +2996,7 @@ jQuery.PrivateBin = (function($) { const fileSize = Helper.formatBytes(decodedData.length); const fileInfo = document.createElement('span'); - fileInfo.id = 'attachmentInfo'; + fileInfo.class = 'alert'; fileInfo.textContent = ` (${fileName}, ${fileSize})`; template[0].appendChild(fileInfo); } diff --git a/lib/Configuration.php b/lib/Configuration.php index 28bbc284..38c3f96c 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -122,7 +122,7 @@ class Configuration 'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==', 'js/legacy.js' => 'sha512-RQEo1hxpNc37i+jz/D9/JiAZhG8GFx3+SNxjYnI7jUgirDIqrCSj6QPAAZeaidditcWzsJ3jxfEj5lVm7ZwTRQ==', 'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==', - 'js/privatebin.js' => 'sha512-h+pxj+EYo9SEt65HLl1lFThdF05atKK3xaWBqGBWxERpllH5JZOsSWSM+V5vk/hj20HPQewsPgtrhBDv54uMIQ==', + 'js/privatebin.js' => 'sha512-YOVC+ZjeGfgp/PBIZDJOKvbGRpFnQkXAXLKXLSgP/aXysO34DRxpNLFOmJeZlP9NfraS2tl9paeIcM0nV1uxcQ==', 'js/purify-3.3.0.js' => 'sha512-lsHD5zxs4lu/NDzaaibe27Vd2t7Cy9JQ3qDHUvDfb4oZvKoWDNEhwUY+4bT3R68cGgpgCYp8U1x2ifeVxqurdQ==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', 'js/zlib-1.3.1-2.js' => 'sha512-4gT+v+BkBqdVBbKOO4qKGOAzuay+v1FmOLksS+bMgQ08Oo4xEb3X48Xq1Kv2b4HtiCQA7xq9dFRzxal7jmQI7w==', diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index ab45060e..7237c8e1 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -689,8 +689,8 @@ endif; - diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index 06547e1a..d3098a3f 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -549,8 +549,7 @@ endif; From 42d516c07a66e24c4264506409b611284278d70f Mon Sep 17 00:00:00 2001 From: Stephan Kristyn Date: Tue, 10 Feb 2026 18:30:42 +0100 Subject: [PATCH 3/8] Removing unnecessary alterations --- tpl/bootstrap.php | 4 ++-- tpl/bootstrap5.php | 27 ++++++++++++--------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 7237c8e1..ab45060e 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -689,8 +689,8 @@ endif; - diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index d3098a3f..0730d1ba 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -33,7 +33,7 @@ if ($QRCODE) : - _scriptTag('js/zlib-1.3.1-2.js', 'defer'); ?> + _scriptTag('js/zlib-1.3.1-1.js', 'defer'); ?> _scriptTag('js/base-x-5.0.1.js', 'defer'); ?> _scriptTag('js/bootstrap-5.3.8.js', 'defer'); ?> _scriptTag('js/dark-mode-switch.js', 'defer'); ?> @@ -206,7 +206,7 @@ endif; foreach ($EXPIRE as $key => $value) : ?> @@ -287,7 +287,7 @@ endif; foreach ($FORMATTER as $key => $value) : ?> @@ -378,21 +378,18 @@ if ($FILEUPLOAD) : - From 7467840644a60363fc992e15c328041b4e94d2bd Mon Sep 17 00:00:00 2001 From: Stephan Kristyn Date: Tue, 10 Feb 2026 18:34:30 +0100 Subject: [PATCH 4/8] Removing unnecessary alterations-2 --- tpl/bootstrap5.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index 0730d1ba..06547e1a 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -33,7 +33,7 @@ if ($QRCODE) : - _scriptTag('js/zlib-1.3.1-1.js', 'defer'); ?> + _scriptTag('js/zlib-1.3.1-2.js', 'defer'); ?> _scriptTag('js/base-x-5.0.1.js', 'defer'); ?> _scriptTag('js/bootstrap-5.3.8.js', 'defer'); ?> _scriptTag('js/dark-mode-switch.js', 'defer'); ?> @@ -206,7 +206,7 @@ endif; foreach ($EXPIRE as $key => $value) : ?> @@ -287,7 +287,7 @@ endif; foreach ($FORMATTER as $key => $value) : ?> @@ -378,18 +378,21 @@ if ($FILEUPLOAD) : - From 89838a48710abaf5a51a0e6e737e753c68a3ded7 Mon Sep 17 00:00:00 2001 From: Stephan Kristyn Date: Tue, 10 Feb 2026 18:37:21 +0100 Subject: [PATCH 5/8] Removing unnecessary alterations-3 --- tpl/bootstrap5.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index 06547e1a..47b1fcec 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -550,7 +550,6 @@ endif; From 755be747a688eb0eb26e74f9abf70cbebf406e22 Mon Sep 17 00:00:00 2001 From: Stephan Kristyn Date: Wed, 11 Feb 2026 18:41:44 +0100 Subject: [PATCH 6/8] Refactoring the way DOM element is created and styled. Now leaving styling to customer --- js/privatebin.js | 6 ++---- tpl/bootstrap.php | 5 ++++- tpl/bootstrap5.php | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 5c77ed8c..cd5502fc 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2995,10 +2995,8 @@ jQuery.PrivateBin = (function($) { attachmentLink.attr('download', fileName); const fileSize = Helper.formatBytes(decodedData.length); - const fileInfo = document.createElement('span'); - fileInfo.class = 'alert'; - fileInfo.textContent = ` (${fileName}, ${fileSize})`; - template[0].appendChild(fileInfo); + const span = template[0].querySelector('a > span'); + span.textContent = ` (${fileName}, ${fileSize})`; } // sanitize SVG preview diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index ab45060e..b0d45142 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -691,7 +691,10 @@ endif; diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index 47b1fcec..073feb62 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -549,7 +549,10 @@ endif; From cfea0fb20e9024140dc5f2193f6f6c866aa3db43 Mon Sep 17 00:00:00 2001 From: Stephan Kristyn Date: Wed, 11 Feb 2026 19:03:34 +0100 Subject: [PATCH 7/8] Now leaving styling to customer if he wants the filename and filesize as a hyperlink or outside the hyperlink --- js/privatebin.js | 3 ++- lib/Configuration.php | 2 +- tpl/bootstrap.php | 5 +---- tpl/bootstrap5.php | 5 +---- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index cd5502fc..a65dcf42 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2995,7 +2995,8 @@ jQuery.PrivateBin = (function($) { attachmentLink.attr('download', fileName); const fileSize = Helper.formatBytes(decodedData.length); - const span = template[0].querySelector('a > span'); + const spans = template[0].querySelectorAll('span'); + const span = spans[spans.length - 1]; span.textContent = ` (${fileName}, ${fileSize})`; } diff --git a/lib/Configuration.php b/lib/Configuration.php index 38c3f96c..10e4c069 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -122,7 +122,7 @@ class Configuration 'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==', 'js/legacy.js' => 'sha512-RQEo1hxpNc37i+jz/D9/JiAZhG8GFx3+SNxjYnI7jUgirDIqrCSj6QPAAZeaidditcWzsJ3jxfEj5lVm7ZwTRQ==', 'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==', - 'js/privatebin.js' => 'sha512-YOVC+ZjeGfgp/PBIZDJOKvbGRpFnQkXAXLKXLSgP/aXysO34DRxpNLFOmJeZlP9NfraS2tl9paeIcM0nV1uxcQ==', + 'js/privatebin.js' => 'sha512-KnVJOIXg/dcO/A1cEEWD/AlKfmGK2UNmNrqr0kD+ecj4nuwDiscimKy9Olt/iWcDAOQ8WG7JcJ/teQ3kfZWz9A==', 'js/purify-3.3.0.js' => 'sha512-lsHD5zxs4lu/NDzaaibe27Vd2t7Cy9JQ3qDHUvDfb4oZvKoWDNEhwUY+4bT3R68cGgpgCYp8U1x2ifeVxqurdQ==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', 'js/zlib-1.3.1-2.js' => 'sha512-4gT+v+BkBqdVBbKOO4qKGOAzuay+v1FmOLksS+bMgQ08Oo4xEb3X48Xq1Kv2b4HtiCQA7xq9dFRzxal7jmQI7w==', diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index b0d45142..6fcb4b20 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -691,10 +691,7 @@ endif; diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index 073feb62..e10118de 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -549,10 +549,7 @@ endif; From 5d22847ef1795c42c6f1dc54fcebe6d6325344ed Mon Sep 17 00:00:00 2001 From: Stephan Kristyn Date: Thu, 12 Feb 2026 13:48:49 +0100 Subject: [PATCH 8/8] ES6 Compat code broke everything. Reverting. E2E testing wth multiple files works --- js/privatebin.js | 2 +- lib/Configuration.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index a65dcf42..378a89e5 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2997,7 +2997,7 @@ jQuery.PrivateBin = (function($) { const fileSize = Helper.formatBytes(decodedData.length); const spans = template[0].querySelectorAll('span'); const span = spans[spans.length - 1]; - span.textContent = ` (${fileName}, ${fileSize})`; + span.textContent += ` (${fileName}, ${fileSize})`; } // sanitize SVG preview diff --git a/lib/Configuration.php b/lib/Configuration.php index 10e4c069..92347f77 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -122,7 +122,7 @@ class Configuration 'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==', 'js/legacy.js' => 'sha512-RQEo1hxpNc37i+jz/D9/JiAZhG8GFx3+SNxjYnI7jUgirDIqrCSj6QPAAZeaidditcWzsJ3jxfEj5lVm7ZwTRQ==', 'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==', - 'js/privatebin.js' => 'sha512-KnVJOIXg/dcO/A1cEEWD/AlKfmGK2UNmNrqr0kD+ecj4nuwDiscimKy9Olt/iWcDAOQ8WG7JcJ/teQ3kfZWz9A==', + 'js/privatebin.js' => 'sha512-n2IW9L2/VnsAJX1gumf7deXcgIqyp1RfnG40Cd8lK+uWNiX7gEqZ+rO6zrAa8hHMNyjbJiqXc/FYSE6xWJmZUw==', 'js/purify-3.3.0.js' => 'sha512-lsHD5zxs4lu/NDzaaibe27Vd2t7Cy9JQ3qDHUvDfb4oZvKoWDNEhwUY+4bT3R68cGgpgCYp8U1x2ifeVxqurdQ==', 'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==', 'js/zlib-1.3.1-2.js' => 'sha512-4gT+v+BkBqdVBbKOO4qKGOAzuay+v1FmOLksS+bMgQ08Oo4xEb3X48Xq1Kv2b4HtiCQA7xq9dFRzxal7jmQI7w==',