document.addEventListener("DOMContentLoaded", () => { initCodeMirror(); initTooltips(); function initCodeMirror() { if (typeof CodeMirror !== "undefined") { const textarea = document.getElementById("X13GPSR_CUSTOM_CSS"); if (!textarea) return; CodeMirror.fromTextArea(textarea, { lineNumbers: true, mode: "css", theme: "monokai", }); } } function initTooltips() { $(".x13gpsr-circle-container").popover({ html: true, trigger: "hover", placement: "top", content: function () { const tooltip = this.querySelector(".x13gpsr-custom-tooltip"); if (!tooltip) return false; const html = tooltip.innerHTML; return html; }, }); $(".x13gpsr-circle-container").on("show.bs.popover", function () { const popoverInstance = $(this).data("bs.popover"); if (popoverInstance) { const $tip = popoverInstance.tip(); $tip.addClass("x13gpsr-tooltip"); } }); } if (typeof x13gpsr_select_brands_txt !== "undefined" && $('select[name="brands[]"]').length) { $('select[name="brands[]"]').attr('data-placeholder', x13gpsr_select_brands_txt); } if (document.querySelector('#configuration_form.x13gpsr')) { document.querySelector('#subtab-AdminX13GPSRParent, #maintab-AdminX13GPSRParent').classList.add('ul-open', 'open', 'active'); document.querySelector('#subtab-AdminX13GPSRSettings').classList.add('link-active', 'active'); } $(document).on('click', 'button[name="xgpsr-copy-code"]', function () { var target = $(this).data('target'); var msg = $(this).data('success'); $(target).focus().select(); document.execCommand("copy"); $.growl.notice({ title: "", message: msg }); }); });