PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13.1
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13.1
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / assets / js / admin / charitable-admin-onboarding.js

charitable-admin-onboarding.js in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at assets/js/admin/charitable-admin-onboarding.js

129 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global wpchar, wpCookies */
2 // eslint-disable-line no-unused-vars
3
4 var CharitableOnboarding = window.CharitableOnboarding || (function (document, window, $) {
5
6 var s = {},
7 $checklist,
8 elements = {};
9
10 var app = {
11
12 settings: {
13 onboarded: false
14 },
15
16 /**
17 * Start the engine.
18 *
19 * @since 1.8.1
20 */
21 init: function () {
22
23 s = this.settings;
24
25 // Document ready.
26 $(app.ready);
27
28 },
29
30 /**
31 * Document ready.
32 *
33 * @since 1.8.1.12
34 *
35 */
36 ready: function () { // check to see if javascript has been defined.
37
38 $checklist = $('#charitable-setup-checklist');
39
40 // Bind all actions.
41 app.bindUIActions();
42
43 },
44
45 /**
46 * Element bindings.
47 *
48 * @since 1.8.1
49 */
50 bindUIActions: function () {
51
52 $checklist.on('click', '.charitable-toggle', function (e) {
53 e.preventDefault();
54 // remove the focus from the button.
55 $(this).blur();
56 app.fieldSectionToggle($(this), 'click');
57 });
58
59 $checklist.on('click', '.charitable-toggle-optin-allow', function (e) {
60 e.preventDefault();
61 // remove the focus from the button.
62 $(this).blur();
63 var $this = $(this),
64 $toggleGroup = $('.charitable-checklist-allow'),
65 $icon = $this.find('i');
66 $icon.toggleClass('charitable-angle-right');
67 $toggleGroup.stop().slideToggle('', function () {
68 $toggleGroup.toggleClass('charitable-closed');
69 if ($toggleGroup.hasClass('charitable-closed')) {
70 $toggleGroup.removeClass('charitable-open');
71 }
72 });
73 });
74
75 $checklist.on('click', '#wpchar-no-stripe', function (e) {
76 // if this checkbox is checked, then add a css class to charitable-connect-stripe.
77 if ($(this).is(':checked')) {
78 $('.charitable-connect-stripe').addClass('wpchar-disabled');
79 } else {
80 $('.charitable-connect-stripe').removeClass('wpchar-disabled');
81 }
82 });
83
84 },
85
86 /**
87 * Toggle field group visibility in the field sidebar.
88 *
89 * @since 1.8.1.12
90 *
91 * @param {mixed} el DOM element or jQuery object.
92 * @param {string} action Action.
93 */
94 fieldSectionToggle: function (el, action) {
95
96 var $this = $(el),
97 $nearestContainer = $this.closest('section.charitable-step'),
98 $toggleGroup = $nearestContainer.find('.charitable-toggle-container'),
99 sectionName = $nearestContainer.data('section-name'),
100 $icon = $this.find('i'),
101 cookieName = 'charitable_checklist_section_' + sectionName;
102
103 if (action === 'click') {
104
105 $icon.toggleClass('charitable-angle-right');
106
107 $toggleGroup.stop().slideToggle('', function () {
108 $nearestContainer.toggleClass('charitable-closed');
109 if ($nearestContainer.hasClass('charitable-closed')) {
110 $nearestContainer.removeClass('charitable-open');
111 wpCookies.remove(cookieName);
112 } else {
113 wpCookies.set(cookieName, 'true', 2592000); // 1 month
114 }
115 });
116
117 return;
118 }
119
120 },
121
122 };
123
124 return app;
125
126 }(document, window, jQuery)); // eslint-disable-line no-undef
127
128 CharitableOnboarding.init();
129