diff --git a/js/settings-admin.js b/js/settings-admin.js index 15f152d..29c624e 100644 --- a/js/settings-admin.js +++ b/js/settings-admin.js @@ -20,21 +20,26 @@ * along with this program. If not, see . * */ -$(document).ready(function () { - $('html > head').append($('')); - $('#theming-customcss button').click(function (e) { - var content = $('#theming-customcss-input').val(); +document.addEventListener('DOMContentLoaded', () => { + const style = document.createElement('style'); + style.type = 'text/css'; + style.id = 'previewStylesCustom'; + document.head.appendChild(style); + + const button = document.querySelector('#theming-customcss button'); + button.addEventListener('click', (e) => { + const content = document.querySelector('#theming-customcss-input').value; OCP.AppConfig.setValue('theming_customcss', 'customcss', content, { - success: function () { + success: () => { OC.msg.finishedSuccess('#theming-customcss_settings_msg', t('theming_customcss', 'Saved')); - $('link[href*="theming_customcss/styles"]').remove(); - $('#previewStylesCustom').replaceWith($('')); - OCP.AppConfig.setValue('theming_customcss', 'cachebuster', Date.now); + document.querySelectorAll('link[href*="theming_customcss/styles"]').forEach((el) => el.remove()); + style.textContent = content; + OCP.AppConfig.setValue('theming_customcss', 'cachebuster', `${Date.now()}`); }, - error: function () { + error: () => { OC.msg.finishedError('#theming-customcss_settings_msg', t('theming_customcss', 'Error')); } }); OC.msg.startSaving('#theming-customcss_settings_msg'); }); -}); +}); \ No newline at end of file