diff --git a/js/privatebin.js b/js/privatebin.js index 41364f6c..2ce3c89d 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -3918,11 +3918,20 @@ window.PrivateBin = (function () { // we use text/html instead of text/plain to avoid a bug when // reloading the raw text view (it reverts to type text/html) - const $head = $('head').children().not('noscript, script, link[type="text/css"]'), - newDoc = document.open('text/html', 'replace'); + const headElements = Array.from(document.head.children).filter(function (element) { + if (element.tagName === 'NOSCRIPT' || element.tagName === 'SCRIPT') { + return false; + } + if (element.tagName === 'LINK' && element.getAttribute('type') === 'text/css') { + return false; + } + return true; + }), + + newDoc = document.open('text/html', 'replace'); newDoc.write(''); - for (let i = 0; i < $head.length; ++i) { - newDoc.write($head[i].outerHTML); + for (let i = 0; i < headElements.length; ++i) { + newDoc.write(headElements[i].outerHTML); } newDoc.write( '
' +
@@ -5725,38 +5734,38 @@ window.PrivateBin = (function () {
          * @function
          */
         function handleRevealButtonClick() {
-            const element = $(this);
-            const passwordInput = element.siblings('.input-password');
-            const isHidden = passwordInput.attr('type') === 'password';
+            const element = this;
+            const passwordInput = element.closest('.input-group')?.querySelector('.input-password');
+            if (!passwordInput) {
+                return;
+            }
 
-            passwordInput.attr('type', isHidden ? 'text' : 'password');
+            const isHidden = passwordInput.getAttribute('type') === 'password';
+            passwordInput.setAttribute('type', isHidden ? 'text' : 'password');
 
             const tooltip = I18n._(isHidden ? 'Hide password' : 'Show password');
-
-            element.attr('title', tooltip);
-            element.attr('aria-label', tooltip);
+            element.setAttribute('title', tooltip);
+            element.setAttribute('aria-label', tooltip);
 
             // handle bootstrap 5 icons: eye & eye-slash
-            const buttonSvg = element.find('use');
-            if (buttonSvg.length) {
-                const iconHref = buttonSvg.attr('href');
-                if (isHidden) {
-                    buttonSvg.attr('href', iconHref + '-slash');
-                } else {
-                    buttonSvg.attr('href', iconHref.substring(0, iconHref.length - 6));
+            const buttonSvg = element.querySelector('use');
+            if (buttonSvg) {
+                const iconHref = buttonSvg.getAttribute('href');
+                if (iconHref) {
+                    buttonSvg.setAttribute('href', isHidden ? `${iconHref}-slash` : iconHref.substring(0, iconHref.length - 6));
                 }
                 return;
             }
 
             // handle bootstrap 3 icons: eye-open & eye-close
-            const buttonSpan = element.find('span');
-            if (buttonSpan.length) {
+            const buttonSpan = element.querySelector('span');
+            if (buttonSpan) {
                 if (isHidden) {
-                    buttonSpan.addClass('glyphicon-eye-close');
-                    buttonSpan.removeClass('glyphicon-eye-open');
+                    buttonSpan.classList.add('glyphicon-eye-close');
+                    buttonSpan.classList.remove('glyphicon-eye-open');
                 } else {
-                    buttonSpan.addClass('glyphicon-eye-open');
-                    buttonSpan.removeClass('glyphicon-eye-close');
+                    buttonSpan.classList.add('glyphicon-eye-open');
+                    buttonSpan.classList.remove('glyphicon-eye-close');
                 }
             }
         }
@@ -5769,8 +5778,10 @@ window.PrivateBin = (function () {
          */
         me.init = function () {
             const revealButton = document.querySelector('.toggle-password');
-
-            revealButton.click(handleRevealButtonClick);
+            if (!revealButton) {
+                return;
+            }
+            revealButton.addEventListener('click', handleRevealButtonClick);
         };
 
         return me;
diff --git a/lib/Configuration.php b/lib/Configuration.php
index 531a7087..8abec8f4 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-1nnRQdjFEp16n/ogNB9UcDmHrLwn+tvu+X1aA6nDDadOFAfujyhg+8qAdZqdZRocSTWY844Wk6FCpv7FnZUrgg==',
+            'js/privatebin.js'       => 'sha512-DuxxL6ql7YGgBPEL7YuICSt9X58C8cxTwLbRUAmVK/PX1IlINBHtfFalo+T3hhGSGkd2ylmbnTzzMvenN7p2Hw==',
             '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==',