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.3 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 / admin.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
admin.js
457 lines
1 (function ($) {
2
3 var sb = {
4 ajax_flag: false,
5 ajax_queue: []
6 };
7
8 sb.process_ajax_queue = function () {
9 if (sb.ajax_queue.length === 0) return;
10 var req = sb.ajax_queue.pop();
11 sb.send_ajax(req.iframe_id, req.structure_codemirror_editor, req.css_codemirror_editor);
12 };
13
14 var currentRequest = null;
15
16 sb.send_ajax = function (iframe_id, structure_codemirror_editor, css_codemirror_editor) {
17 if (sb.ajax_flag === true) {
18 sb.ajax_queue.push({
19 iframe_id: iframe_id,
20 structure_codemirror_editor: structure_codemirror_editor,
21 css_codemirror_editor: css_codemirror_editor
22 });
23
24 return;
25 }
26
27 sb.ajax_flag = true;
28
29 var builder_structure = '<div class="pp-password-reset-handler-wrap">' + structure_codemirror_editor.getValue() + '</div>';
30
31 currentRequest = $.ajax({
32 type: "POST",
33 url: ajaxurl,
34 data: {
35 builder_structure: builder_structure,
36 builder_css: css_codemirror_editor.getValue(),
37 action: 'pp-builder-preview',
38 _wpnonce: ppress_admin_globals.nonce
39 },
40 beforeSend: function () {
41 if (currentRequest != null) {
42 currentRequest.abort();
43 }
44 },
45 })
46 .done(function (response) {
47 sb.ajax_flag = false;
48 var doc = document.getElementById(iframe_id).contentWindow.document;
49 doc.open();
50 doc.write(response);
51 doc.close();
52
53 }).always(function () {
54 sb.process_ajax_queue();
55 });
56 };
57
58 sb.codeMirrorInit = function (id, mode, lineNumbers) {
59 lineNumbers = typeof lineNumbers !== 'undefined' ? lineNumbers : true;
60 return CodeMirror.fromTextArea(id, {
61 lineNumbers: lineNumbers,
62 mode: mode
63 });
64 };
65
66 sb.preview_request = function (builder_structure_id, builder_css_id, iframe_id) {
67
68 iframe_id = iframe_id || 'indexIframe';
69
70 if (document.getElementById(builder_css_id) === null) return;
71
72 var structure_codemirror_editor = window.cmSettingsInstances[builder_structure_id] = sb.codeMirrorInit(document.getElementById(builder_structure_id), 'htmlmixed');
73 var css_codemirror_editor = window.cmSettingsInstances[builder_css_id] = sb.codeMirrorInit(document.getElementById(builder_css_id), 'css');
74
75 // detect if a change event is fired in codemirror editor.
76 structure_codemirror_editor.on('change', _.debounce(function () {
77 sb.send_ajax(iframe_id, structure_codemirror_editor, css_codemirror_editor);
78 window.onbeforeunload = function () {
79 return 'The changes you made will be lost if you navigate away from this page.';
80 };
81 }, 1500));
82
83 // detect if a change event is fired in codemirror editor.
84 css_codemirror_editor.on('change', function () {
85 sb.send_ajax(iframe_id, structure_codemirror_editor, css_codemirror_editor);
86 window.onbeforeunload = function () {
87 return 'The changes you made will be lost if you navigate away from this page.';
88 };
89 });
90
91 $('input[type="submit"]').click(function () {
92 window.onbeforeunload = function (e) {
93 e = null;
94 };
95 });
96
97 $(window).load(function () {
98 sb.send_ajax(iframe_id, structure_codemirror_editor, css_codemirror_editor);
99 });
100
101
102 if ($('#pp_password_handler_structure').length === 0) return;
103 var password_handler_structure_codemirror_editor = window.cmSettingsInstances['pp_password_handler_structure'] = sb.codeMirrorInit(document.getElementById('pp_password_handler_structure'), 'htmlmixed');
104 password_handler_structure_codemirror_editor.on('change', function () {
105 sb.send_ajax('handlerIframe', password_handler_structure_codemirror_editor, css_codemirror_editor);
106 });
107
108 $(window).load(function () {
109 sb.send_ajax('handlerIframe', password_handler_structure_codemirror_editor, css_codemirror_editor);
110 });
111 };
112
113 sb.login = function () {
114 sb.preview_request('pp_login_structure', 'pp_login_css');
115 };
116
117 sb.melange = function () {
118 sb.preview_request('pp_melange_structure', 'pp_melange_css');
119 };
120
121 sb.password_reset = function () {
122 sb.preview_request('pp_password_structure', 'pp_password_css');
123 };
124
125 sb.registration = function () {
126 sb.preview_request('pp_registration_structure', 'pp_registration_css');
127 };
128
129 sb.frontend_profile = function () {
130 sb.preview_request('pp_fe_profile_structure', 'pp_fe_profile_css');
131 };
132
133 sb.edit_profile = function () {
134 sb.preview_request('pp_edit_profile_structure', 'pp_edit_profile_css');
135 };
136
137 var admin_sidebar_tab_settings = function () {
138
139 var open_tab = function (tab_selector, control_view) {
140 if ($(tab_selector).length === 0) return;
141
142 $('.pp-settings-wrap .nav-tab-wrapper a').removeClass('nav-tab-active');
143 $(tab_selector).addClass('nav-tab-active').blur();
144 var clicked_group = $(tab_selector).attr('href');
145 if (typeof (localStorage) !== 'undefined') {
146 localStorage.setItem(option_name + "_active-tab", $(tab_selector).attr('href'));
147 }
148 $('.pp-group-wrapper').hide();
149 $(clicked_group).fadeIn();
150
151 if (typeof control_view !== 'undefined') {
152 $('html, body').animate({
153 // we are removing 20 to accomodate admin bar which cut into view.
154 scrollTop: $("#" + control_view).offset().top - 20
155 }, 2000);
156 }
157
158 // reset/remove hash from url
159 window.location.hash = '';
160
161 $.each(window.cmSettingsInstances, function (index, value) {
162 value.refresh();
163 });
164 };
165
166 var open_active_or_first_tab = function () {
167 var active_tab = '';
168 if (typeof (localStorage) !== 'undefined') {
169 active_tab = localStorage.getItem(option_name + "_active-tab");
170 }
171
172 if (active_tab !== '' && $(active_tab).length) {
173 active_tab += '-tab';
174 } else {
175 active_tab = $('.pp-settings-wrap .nav-tab-wrapper a:first')
176 }
177
178 open_tab(active_tab);
179 };
180
181 $('.pp-group-wrapper').hide();
182 var option_name = $('div.pp-settings-wrap').data('option-name');
183
184 $('.pp-settings-wrap .nav-tab-wrapper a').click(function (e) {
185 e.preventDefault();
186 open_tab(this);
187 });
188
189 var hash_event_triggered = false;
190
191 $(window).on('hashchange', function () {
192 if (hash_event_triggered === true) return;
193
194 // in #registration_page?login_page, registration_page is the tab id and \
195 // login_page the control/settings tr id.
196 var hash = this.location.hash, tab_id_len, tab_id, cache;
197 if (hash.length === 0) open_active_or_first_tab();
198
199 if ((tab_id_len = hash.indexOf('?')) !== -1) {
200 tab_id = hash.slice(0, tab_id_len);
201 control_tr_id = hash.slice(tab_id_len + 1);
202
203 if ((cache = $('a' + tab_id + '-tab')).length !== 0) {
204 open_tab(cache, control_tr_id);
205 }
206 } else {
207 open_tab(hash + '-tab')
208 }
209
210 hash_event_triggered = true;
211
212 });
213
214 $(window).trigger('hashchange');
215 };
216
217 var custom_fields_sortable = function () {
218 // profile fields sortable
219 $("table.custom_profile_fields tbody").sortable({
220 cursor: "move",
221 containment: "table",
222 handle: ".custom-field-anchor",
223 start: function (event, ui) {
224 ui.item.toggleClass("alternate");
225 },
226 stop: function (event, ui) {
227 ui.item.toggleClass("alternate");
228 },
229 update: function (event, ui) {
230 var data = $(this).sortable('toArray');
231 $.post(
232 ajaxurl, {
233 action: "pp_profile_fields_sortable",
234 data: data
235 }
236 );
237
238 // regenerate the table tr ids after each DOM update
239 $('table.custom_profile_fields tbody tr').each(function (index) {
240 $(this).attr('id', ++index);
241 });
242 }
243 });
244 // profile fields sortable
245 $("table#pp_contact_info tbody").sortable({
246 cursor: "move",
247 containment: "table",
248 handle: ".custom-field-anchor",
249 start: function (event, ui) {
250 ui.item.toggleClass("alternate");
251 },
252 stop: function (event, ui) {
253 ui.item.toggleClass("alternate");
254 },
255 update: function (event, ui) {
256 var data = $(this).sortable('toArray');
257 $.post(
258 ajaxurl, {
259 action: "pp_contact_info_sortable",
260 data: data
261 }
262 );
263 }
264 });
265
266 // add IDs to table "tr" tags in profile fields wp-list-table
267 // to be used by jQuery sortable.
268 $('table.custom_profile_fields tbody tr').each(function (index) {
269 $(this).attr('id', ++index);
270 });
271 };
272
273 var custom_field_toggling = function () {
274 jQuery(function ($) {
275 var cpf_type = $('#cpf_type');
276
277 var flag = true;
278
279 if (cpf_type.length > 0) {
280
281 cpf_type.change(function () {
282 var cache = $('#cpf-multi-select'),
283 cache2 = $('#pp-custom-field-date-format-row'),
284 cache3 = $('#pp-custom-field-options-row'),
285 selected_value = this.value;
286
287 cache.hide();
288 if (selected_value === 'select') {
289 cache.show();
290 }
291
292 cache2.hide();
293 if (selected_value === 'date') {
294 cache2.show();
295 }
296
297 cache3.hide();
298 // contextual display of options field
299 if ($.inArray(selected_value, ['select', 'radio', 'checkbox', 'file']) !== -1) {
300 if (flag === false) {
301 cache3.find('input').val('');
302 }
303 cache3.show();
304 }
305 });
306
307 cpf_type.change();
308
309 flag = false;
310 }
311
312 });
313 };
314
315 var email_settings_field_init = function () {
316 // initialize codemirror on email field in settings
317 $(window).load(function () {
318 $('.pp-email-editor-textarea').each(function () {
319 window.cmSettingsInstances[this.id] = sb.codeMirrorInit(this, 'htmlmixed', false);
320 });
321
322 $('.pp-codemirror-editor-textarea').each(function () {
323 window.cmSettingsInstances[this.id] = sb.codeMirrorInit(this, 'html', true);
324 });
325 });
326
327 $('.pp-email-editor-tablinks').click(function (e) {
328 e.preventDefault();
329 $(this).blur();
330 var parent = $(this).parents('.ppress-email-editor-wrap');
331 $('.pp-email-editor-tablinks', parent).removeClass('eactive');
332 var key = parent.find('.pp-email-editor-textarea').attr('id');
333
334 $('.pp-email-editor-tabcontent', parent).hide();
335
336 $(this).addClass('eactive');
337
338 if ($(this).hasClass('ecode')) {
339 parent.find('.pp-email-editor-tabcontent.ecode').show();
340 } else {
341 $('#' + key + '_preview_tabcontent').html(window.cmSettingsInstances[key].getValue());
342 parent.find('.pp-email-editor-tabcontent.epreview').show();
343 }
344 });
345
346 $('.pp-email-editor-tablinks.ecode').click();
347
348 $('#email_content_type').on('change', function () {
349 if (this.value === 'text/plain') {
350 $('.pp-email-editor-tablinks').hide();
351
352 $('.pp-email-editor-tabcontent').hide();
353 $('.pp-email-editor-tabcontent.ecode').show();
354 } else {
355 $('.pp-email-editor-tablinks').show();
356 $('.pp-email-editor-tablinks.ecode').click();
357 }
358 });
359 };
360
361 var titleshit = function () {
362 $('#title').each(function () {
363 var input = $(this), prompt = $('#' + this.id + '-prompt-text');
364
365 if ('' === this.value) {
366 prompt.removeClass('screen-reader-text');
367 }
368
369 prompt.click(function () {
370 $(this).addClass('screen-reader-text');
371 input.focus();
372 });
373
374 input.blur(function () {
375 if ('' === this.value) {
376 prompt.removeClass('screen-reader-text');
377 }
378 });
379
380 input.focus(function () {
381 prompt.addClass('screen-reader-text');
382 });
383 });
384 };
385
386 var shortcodeBuilderUI = function () {
387 $('.ppSCB-tab-box .nav-tab').click(function (e) {
388 e.preventDefault();
389 $('.ppSCB-tab-box .nav-tab').removeClass('nav-tab-active');
390 var href = $(this).attr('href');
391 $('.ppSCB-tab-content').hide();
392 $(this).addClass('nav-tab-active');
393 $(href).show();
394
395 // if tab is switched in settings, refresh codemirror to redraw the layout
396 // see https://github.com/codemirror/CodeMirror/issues/61
397 $.each(window.cmSettingsInstances, function (index, value) {
398 value.refresh();
399 });
400
401 }).eq(0).click();
402
403 $('.ppSCB-preview-h-left').click(function (e) {
404 e.preventDefault();
405 $('.ppSCB-preview-h-left, .ppSCB-preview-h-right').removeClass('ppSCB-preview-active');
406 $('.ppSCB-sidebar.password-reset iframe').hide();
407 $(this).addClass('ppSCB-preview-active');
408 $('#indexIframe').show();
409 }).click();
410
411 $('.ppSCB-preview-h-right').click(function (e) {
412 e.preventDefault();
413 $('.ppSCB-preview-h-left, .ppSCB-preview-h-right').removeClass('ppSCB-preview-active');
414 $('.ppSCB-sidebar.password-reset iframe').hide();
415 $(this).addClass('ppSCB-preview-active');
416 $('#handlerIframe').show();
417 });
418 };
419
420 $(function () {
421
422 if (typeof window.cmSettingsInstances === 'undefined') {
423 window.cmSettingsInstances = {};
424 }
425 admin_sidebar_tab_settings();
426 custom_fields_sortable();
427 custom_field_toggling();
428 email_settings_field_init();
429 titleshit();
430 shortcodeBuilderUI();
431
432 sb.login();
433 sb.melange();
434 sb.password_reset();
435 sb.registration();
436 sb.frontend_profile();
437 sb.edit_profile();
438
439 // confirm before deleting form
440 $('.pp-form-listing.pp-forms .pp-form-delete, .pp-builder-action-btn-block .pp-form-delete, .pp-confirm-delete').click(function (e) {
441 e.preventDefault();
442 if (confirm(pp_form_builder.confirm_delete)) {
443 window.location.href = $(this).attr('href');
444 }
445 });
446
447 // Access settings tab contextual display
448 $('#global_site_access').change(function () {
449 var val = this.value;
450
451 $('#global_site_access_redirect_page_row, #global_site_access_exclude_pages_row, #global_site_access_allow_homepage_row')
452 .toggle('login' === val);
453 }).change();
454
455 $('.wp-csa-select2').select2();
456 });
457 })(jQuery);