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)}
`); } }); },