PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.2.4
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.2.4
4.17.2 4.17.1 4.17.0 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
builder 4 years ago admin.js 5 years ago clipboard.min.js 5 years ago content-control.js 5 years ago create-form.js 5 years ago frontend.js 5 years ago frontend.min.js 4 years ago index.php 5 years ago jcarousel.min.js 5 years ago jquery.blockUI.js 5 years ago mailoptin.js 5 years ago member-directory.js 5 years ago member-directory.min.js 4 years ago pp-wp-editor.js 5 years ago shortcakeui.js 5 years ago
content-control.js
178 lines
1 (function ($) {
2
3 var cr = {
4 orRuleTemplate: wp.template('ppress-cr-or-rule'),
5 andRuleTemplate: wp.template('ppress-cr-and-rule'),
6 unlinkedAndRuleBadge: wp.template('ppress-cr-unlinked-and-rule-badge'),
7 linkedAndRuleBadge: wp.template('ppress-cr-linked-and-rule-badge')
8 };
9
10 cr.uiBlock = function () {
11 $('#ppress-content-protection-content').block({
12 message: '<span class="spinner" style="visibility:visible;float:none;"></span>',
13 css: {border: '0', backgroundColor: 'transparent'},
14 overlayCSS: {
15 backgroundColor: '#fff',
16 opacity: 0.9
17 }
18 });
19 };
20
21 cr.uiUnBlock = function () {
22 $('#ppress-content-protection-content').unblock();
23 };
24
25 cr.select2Init = function () {
26 $('.facetList .facet').each(function (index, element) {
27
28 var selected_condition, select2options, fieldType, parent = $(element);
29
30 $('.ppress-cr-select2', parent).each(function (index2, element2) {
31 if ($(element2).hasClass("select2-hidden-accessible") === false) {
32 selected_condition = $('.ppress-content-condition-rule-name', parent).val();
33 select2options = typeof ppress_cr_conditions[selected_condition]['field'] ? ppress_cr_conditions[selected_condition]['field'] : {};
34 fieldType = typeof select2options['type'] !== "undefined" ? select2options['type'] : '';
35 if (_.contains(['postselect', 'taxonomyselect'], fieldType)) {
36 select2options = _.extend(select2options, {
37 ajax: {
38 url: ajaxurl,
39 delay: 250,
40 cache: true,
41 data: function (params) {
42 return {
43 search: params.term,
44 nonce: ppress_cr_nonce,
45 action: 'ppress_cr_object_search',
46 object_type: fieldType === 'postselect' ? 'post_type' : 'taxonomy',
47 object_key: select2options.type === 'postselect' ? select2options.post_type : select2options.taxonomy
48 };
49 }
50 }
51 });
52 }
53
54 $(element2).select2(select2options);
55 }
56 })
57 })
58 };
59
60 cr.generateUniqueID = function () {
61 return Math.random().toString(36).substring(2) + Date.now().toString(36);
62 };
63
64 cr.addOrRule = function () {
65 $(document).on('click', '#ppress-content-protection-content .addFacet', function () {
66 $(this).blur();
67 var parent = $(this).parents('.condAction');
68 parent.find('.facetList').append(
69 cr.orRuleTemplate({
70 facetListId: parent.data('facet-list'),
71 facetId: cr.generateUniqueID()
72 })
73 );
74 });
75 };
76
77 cr.addAndRule = function () {
78 $(document).on('click', '#ppress-content-protection-content .addCondition', function () {
79 $(this).blur();
80 $('#workflowConditions').append(
81 cr.andRuleTemplate({
82 facetListId: cr.generateUniqueID(),
83 facetId: cr.generateUniqueID()
84 })
85 );
86
87 $(this).parents('.and').replaceWith(cr.unlinkedAndRuleBadge());
88 });
89 };
90
91 cr.deleteOrRule = function () {
92 $(document).on('click', '#ppress-content-protection-content .removeFacet', function () {
93 $(this).blur();
94 var andRuleWrapper = $(this).parents('.condAction').parent(),
95 rule_wrapper = $(this).parents('.facetList').find('.facet');
96
97 if (rule_wrapper.length === 1) {
98
99 if ($('#ppress-content-protection-content .condAction').length === 1) {
100 rule_wrapper.find('.ppress-cr-rule-values').html('');
101 rule_wrapper.find('.ppress-content-condition-rule-name').val('');
102 return false;
103 }
104
105 andRuleWrapper.remove();
106
107 $('p.and').eq(-1).replaceWith(cr.linkedAndRuleBadge());
108 return;
109 }
110
111 $(this).parents('.facet').remove();
112 });
113 };
114
115 cr.getConditionValueField = function () {
116
117 $(document).on('change', '.ppress-content-condition-rule-name', function () {
118
119 var cr_rule_value_container = $(this).parents('.facet').find('.ppress-cr-rule-values'),
120 selected_condition = this.value;
121
122 cr_rule_value_container.html('');
123
124 if (selected_condition === "") return false;
125
126 var ajaxData = {
127 'action': 'ppress_content_condition_field',
128 'condition_id': this.value,
129 'nonce': ppress_cr_nonce
130 },
131 facetId = $(this).parents('.facet').data('facet'),
132 facetListId = $(this).parents('.condAction').data('facet-list');
133
134 if (typeof facetId !== "undefined") {
135 ajaxData.facetId = facetId;
136 }
137
138 if (typeof facetListId !== "undefined") {
139 ajaxData.facetListId = facetListId;
140 }
141
142 try {
143 ajaxData.field_type = ppress_cr_conditions[selected_condition]['field']['type'];
144 } catch (e) {
145 return false;
146 }
147
148 cr.uiBlock();
149
150 $.post(ajaxurl, ajaxData, function (response) {
151
152 if ('success' in response && response.success === true) {
153 cr_rule_value_container.append(response.data);
154 $(document).trigger('ppress_cr_field_added', selected_condition)
155 }
156
157 cr.uiUnBlock();
158 }
159 );
160 })
161 };
162
163 cr.EventsListener = function () {
164 $(document).on('ppress_cr_field_added', function () {
165 cr.select2Init();
166 });
167 };
168
169 $(function () {
170 cr.select2Init();
171 cr.addOrRule();
172 cr.addAndRule();
173 cr.deleteOrRule();
174 cr.getConditionValueField();
175 cr.EventsListener();
176 });
177
178 })(jQuery);