From a924479777f4064ece70cc98d899b4559ae8d346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E5=B0=8F=E5=8F=AA=E6=89=98=E5=B0=BC?= Date: Sun, 10 Nov 2024 17:54:21 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20=E6=9B=B4=E6=94=B9copilot?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/js/main.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/source/js/main.js b/source/js/main.js index e41c32dc..f0e945f9 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -1,12 +1,3 @@ -const escapeHtml = (unsafe) => { - return unsafe - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); -}; - const sidebarFn = () => { const $toggleMenu = document.getElementById('toggle-menu'); const $mobileSidebarMenus = document.getElementById('sidebar-menus'); @@ -302,7 +293,7 @@ const sco = { document.querySelectorAll('#article-container img:not(.gallery-item img)').forEach(image => { const captionText = image.getAttribute('alt'); if (captionText) { - image.insertAdjacentHTML('afterend', `
${escapeHtml(captionText)}
`); + image.insertAdjacentHTML('afterend', `
${utils.escapeHtml(captionText)}
`); } }); },