PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.16.19
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.16.19
4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / assets / js / content-control.js
wp-user-avatar / assets / js Last commit date
admin 1 month ago builder 1 month ago stripe 1 month ago admin.js 1 month ago checkout-fields-manager.js 1 month ago checkout.js 1 month ago clipboard.min.js 1 month ago content-control.js 1 month ago create-form.js 1 month ago frontend.js 1 month ago frontend.min.js 1 month ago index.php 1 month ago jcarousel.min.js 1 month ago jquery.blockUI.js 1 month ago mailoptin.js 1 month ago member-directory.js 1 month ago member-directory.min.js 1 month ago pp-wp-editor.js 1 month ago
content-control.js
327 lines
1 (function ($) {
2
3 var cr = {
4 orRuleTemplate: wp.template('ppress-cr-or-rule'),
5 orExemptTemplate: wp.template('ppress-cr-or-exempt'),
6 andRuleTemplate: wp.template('ppress-cr-and-rule'),
7 unlinkedAndRuleBadge: wp.template('ppress-cr-unlinked-and-rule-badge'),
8 linkedAndRuleBadge: wp.template('ppress-cr-linked-and-rule-badge')
9 };
10
11 cr.uiBlock = function () {
12 $('#ppress-content-protection-content').block({
13 message: '<span class="spinner" style="visibility:visible;float:none;"></span>',
14 css: {border: '0', backgroundColor: 'transparent'},
15 overlayCSS: {
16 backgroundColor: '#fff',
17 opacity: 0.9
18 }
19 });
20 };
21
22 cr.uiUnBlock = function () {
23 $('#ppress-content-protection-content').unblock();
24 };
25
26 cr.uiExemptBlock = function () {
27 $('#ppress-content-protection-excludes').block({
28 message: '<span class="spinner" style="visibility:visible;float:none;"></span>',
29 css: {border: '0', backgroundColor: 'transparent'},
30 overlayCSS: {
31 backgroundColor: '#fff',
32 opacity: 0.9
33 }
34 });
35 };
36
37 cr.uiExemptUnBlock = function () {
38 $('#ppress-content-protection-excludes').unblock();
39 };
40
41 cr.select2Init = function (isContentExempt = false) {
42 if (isContentExempt) {
43 $('.pp-content-protection-excludes .facetList .facet').each(function (index, element) {
44 var selected_condition, select2options, fieldType, parent = $(element);
45
46 $('.ppress-cr-select2', parent).each(function (index2, element2) {
47 if ($(element2).hasClass("select2-hidden-accessible") === false) {
48 selected_condition = $('.ppress-content-condition-exempt-rule-name', parent).val();
49 select2options = typeof ppress_cr_conditions[selected_condition]['field'] ? ppress_cr_conditions[selected_condition]['field'] : {};
50 fieldType = typeof select2options['type'] !== "undefined" ? select2options['type'] : '';
51 if (_.contains(['postselect', 'taxonomyselect'], fieldType)) {
52 select2options = _.extend(select2options, {
53 ajax: {
54 url: ajaxurl,
55 delay: 250,
56 cache: true,
57 data: function (params) {
58 return {
59 search: params.term,
60 nonce: ppress_cr_nonce,
61 action: 'ppress_cr_object_search',
62 object_type: fieldType === 'postselect' ? 'post_type' : 'taxonomy',
63 object_key: select2options.type === 'postselect' ? select2options.post_type : select2options.taxonomy
64 };
65 }
66 }
67 });
68 }
69
70 $(element2).select2(select2options);
71 }
72 })
73 });
74 } else {
75 $('.pp-content-protection-content-box .facetList .facet').each(function (index, element) {
76
77 var selected_condition, select2options, fieldType, parent = $(element);
78
79 $('.ppress-cr-select2', parent).each(function (index2, element2) {
80 if ($(element2).hasClass("select2-hidden-accessible") === false) {
81 selected_condition = $('.ppress-content-condition-rule-name', parent).val();
82 select2options = typeof ppress_cr_conditions[selected_condition]['field'] ? ppress_cr_conditions[selected_condition]['field'] : {};
83 fieldType = typeof select2options['type'] !== "undefined" ? select2options['type'] : '';
84 if (_.contains(['postselect', 'taxonomyselect'], fieldType)) {
85 select2options = _.extend(select2options, {
86 ajax: {
87 url: ajaxurl,
88 delay: 250,
89 cache: true,
90 data: function (params) {
91 return {
92 search: params.term,
93 nonce: ppress_cr_nonce,
94 action: 'ppress_cr_object_search',
95 object_type: fieldType === 'postselect' ? 'post_type' : 'taxonomy',
96 object_key: select2options.type === 'postselect' ? select2options.post_type : select2options.taxonomy
97 };
98 }
99 }
100 });
101 }
102
103 $(element2).select2(select2options);
104 }
105 })
106 });
107 }
108 $('#pp-cc-access-membership-plans').select2();
109
110 $('#pp-cc-access-wp-users').select2({
111 ajax: {
112 url: ajaxurl,
113 delay: 250,
114 cache: true,
115 data: function (params) {
116 return {
117 search: params.term,
118 nonce: ppress_cr_nonce,
119 action: 'ppress_cr_object_search',
120 object_type: 'wp_users',
121 };
122 }
123 },
124 minimumInputLength: 2
125 });
126 };
127
128 cr.generateUniqueID = function () {
129 return Math.random().toString(36).substring(2) + Date.now().toString(36);
130 };
131
132 cr.addOrRule = function () {
133 $(document).on('click', '#ppress-content-protection-content .addFacet', function () {
134 $(this).trigger('blur');
135 var parent = $(this).parents('.condAction');
136 parent.find('.facetList').append(
137 cr.orRuleTemplate({
138 facetListId: parent.data('facet-list'),
139 facetId: cr.generateUniqueID()
140 })
141 );
142 });
143
144 $(document).on('click', '#ppress-content-protection-excludes .addFacet', function () {
145 $(this).trigger('blur');
146 var parent = $(this).parents('.condAction');
147 parent.find('.facetList').append(
148 cr.orExemptTemplate({
149 facetListId: parent.data('facet-list'),
150 facetId: cr.generateUniqueID()
151 })
152 );
153 });
154 };
155
156 cr.addAndRule = function () {
157 $(document).on('click', '#ppress-content-protection-content .addCondition', function () {
158 $(this).trigger('blur');
159 $('#ppress-content-protection-content .workflowConditions').append(
160 cr.andRuleTemplate({
161 facetListId: cr.generateUniqueID(),
162 facetId: cr.generateUniqueID()
163 })
164 );
165
166 $(this).parents('.and').replaceWith(cr.unlinkedAndRuleBadge());
167 });
168 };
169
170 cr.deleteOrRule = function () {
171 $(document).on('click', '#ppress-content-protection-content .removeFacet', function () {
172 $(this).trigger('blur');
173 var andRuleWrapper = $(this).parents('.condAction').parent(),
174 rule_wrapper = $(this).parents('.facetList').find('.facet');
175
176 if (rule_wrapper.length === 1) {
177
178 if ($('#ppress-content-protection-content .condAction').length === 1) {
179 rule_wrapper.find('.ppress-cr-rule-values').html('');
180 rule_wrapper.find('.ppress-content-condition-rule-name').val('');
181 return false;
182 }
183
184 andRuleWrapper.remove();
185
186 $('p.and').eq(-1).replaceWith(cr.linkedAndRuleBadge());
187 return;
188 }
189
190 $(this).parents('.facet').remove();
191 });
192
193 $(document).on('click', '#ppress-content-protection-excludes .removeFacet', function () {
194 $(this).trigger('blur');
195 var andRuleWrapper = $(this).parents('.condAction').parent(),
196 rule_wrapper = $(this).parents('.facetList').find('.facet');
197
198 if (rule_wrapper.length === 1) {
199
200 if ($('#ppress-content-protection-excludes .condAction').length === 1) {
201 rule_wrapper.find('.ppress-cr-rule-values').html('');
202 rule_wrapper.find('.ppress-content-condition-exempt-rule-name').val('');
203 return false;
204 }
205
206 andRuleWrapper.remove();
207
208 $('p.and').eq(-1).replaceWith(cr.linkedAndRuleBadge());
209 return;
210 }
211
212 $(this).parents('.facet').remove();
213 });
214 };
215
216 cr.getConditionValueField = function () {
217 $(document).on('change', '.ppress-content-condition-rule-name', function () {
218
219 var cr_rule_value_container = $(this).parents('.facet').find('.ppress-cr-rule-values'),
220 selected_condition = this.value;
221
222 cr_rule_value_container.html('');
223
224 if (selected_condition === "") return false;
225
226 var ajaxData = {
227 'action': 'ppress_content_condition_field',
228 'condition_id': this.value,
229 'nonce': ppress_cr_nonce
230 },
231 facetId = $(this).parents('.facet').data('facet'),
232 facetListId = $(this).parents('.condAction').data('facet-list');
233
234 if (typeof facetId !== "undefined") {
235 ajaxData.facetId = facetId;
236 }
237
238 if (typeof facetListId !== "undefined") {
239 ajaxData.facetListId = facetListId;
240 }
241
242 try {
243 ajaxData.field_type = ppress_cr_conditions[selected_condition]['field']['type'];
244 } catch (e) {
245 return false;
246 }
247
248 cr.uiBlock();
249
250 $.post(ajaxurl, ajaxData, function (response) {
251
252 if ('success' in response && response.success === true) {
253 cr_rule_value_container.append(response.data);
254 $(document).trigger('ppress_cr_field_added', selected_condition)
255 }
256
257 cr.uiUnBlock();
258 }
259 );
260 });
261
262 $(document).on('change', '.ppress-content-condition-exempt-rule-name', function () {
263
264 var cr_rule_value_container = $(this).parents('.facet').find('.ppress-cr-rule-values'),
265 selected_condition = this.value;
266
267 cr_rule_value_container.html('');
268
269 if (selected_condition === "") return false;
270
271 var ajaxData = {
272 'action': 'ppress_exempt_content_condition_field',
273 'condition_id': this.value,
274 'nonce': ppress_cr_nonce
275 },
276 facetId = $(this).parents('.facet').data('facet'),
277 facetListId = $(this).parents('.condAction').data('facet-list');
278
279 if (typeof facetId !== "undefined") {
280 ajaxData.facetId = facetId;
281 }
282
283 if (typeof facetListId !== "undefined") {
284 ajaxData.facetListId = facetListId;
285 }
286
287 try {
288 ajaxData.field_type = ppress_cr_conditions[selected_condition]['field']['type'];
289 } catch (e) {
290 return false;
291 }
292
293 cr.uiExemptBlock();
294
295 $.post(ajaxurl, ajaxData, function (response) {
296
297 if ('success' in response && response.success === true) {
298 cr_rule_value_container.append(response.data);
299 $(document).trigger('ppress_cr_field_added_exempt', selected_condition)
300 }
301
302 cr.uiExemptUnBlock();
303 }
304 );
305 })
306 };
307
308 cr.EventsListener = function () {
309 $(document).on('ppress_cr_field_added', function () {
310 cr.select2Init();
311 });
312 $(document).on('ppress_cr_field_added_exempt', function () {
313 cr.select2Init(true);
314 });
315 };
316
317 $(function () {
318 cr.select2Init();
319 cr.select2Init(true);
320 cr.addOrRule();
321 cr.addAndRule();
322 cr.deleteOrRule();
323 cr.getConditionValueField();
324 cr.EventsListener();
325 });
326
327 })(jQuery);