PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.44
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.44
51.1.86 51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 All 40 releases
king-addons / includes / extensions / Theme_Builder / script.js

script.js in King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder 51.1.44, at includes/extensions/Theme_Builder/script.js

71 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 document.addEventListener('DOMContentLoaded', () => {
2 const addNewButton = document.getElementById('ka-theme-builder-add-new');
3 const addNewModal = document.getElementById('ka-theme-builder-modal');
4 const quickModal = document.getElementById('ka-theme-builder-quick-modal');
5 const closeButtons = document.querySelectorAll('.ka-theme-builder-modal__close');
6
7 const openModal = (modal) => {
8 if (modal) {
9 modal.style.display = 'flex';
10 }
11 };
12
13 const closeModal = (modal) => {
14 if (modal) {
15 modal.style.display = 'none';
16 }
17 };
18
19 if (addNewButton) {
20 addNewButton.addEventListener('click', (event) => {
21 event.preventDefault();
22 openModal(addNewModal);
23 });
24 }
25
26 closeButtons.forEach((button) => {
27 button.addEventListener('click', () => {
28 closeModal(addNewModal);
29 closeModal(quickModal);
30 });
31 });
32
33 const quickLinks = document.querySelectorAll('.ka-tb-quick-edit');
34 const quickPriority = document.getElementById('ka-tb-quick-priority');
35 const quickTemplateId = document.getElementById('ka-tb-quick-template-id');
36 const quickEnabled = document.getElementById('ka-tb-quick-enabled');
37
38 quickLinks.forEach((link) => {
39 link.addEventListener('click', (event) => {
40 event.preventDefault();
41 const templateId = link.getAttribute('data-template-id');
42 const priority = link.getAttribute('data-priority');
43 const enabled = link.getAttribute('data-enabled') === '1';
44
45 if (quickTemplateId) {
46 quickTemplateId.value = templateId || '';
47 }
48 if (quickPriority) {
49 quickPriority.value = priority || '10';
50 }
51 if (quickEnabled) {
52 quickEnabled.checked = enabled;
53 }
54
55 openModal(quickModal);
56 });
57 });
58
59 const backdrops = document.querySelectorAll('.ka-theme-builder-modal__backdrop');
60 backdrops.forEach((backdrop) => {
61 backdrop.addEventListener('click', () => {
62 closeModal(addNewModal);
63 closeModal(quickModal);
64 });
65 });
66 });
67
68
69
70
71