PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.17.3
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.17.3
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
admin 3 months ago builder 3 months ago stripe 3 months ago admin.js 3 days ago checkout-fields-manager.js 3 months ago checkout.js 1 month ago clipboard.min.js 3 months ago content-control.js 3 months ago create-form.js 3 months ago frontend.js 3 months ago frontend.min.js 1 month ago index.php 3 months ago jcarousel.min.js 3 months ago jquery.blockUI.js 3 months ago mailoptin.js 3 months ago member-directory.js 3 months ago member-directory.min.js 3 months ago pp-wp-editor.js 3 months ago
admin.js
693 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 form_id: typeof ppress_shortcode_builder_form_id !== 'undefined' ? ppress_shortcode_builder_form_id : 0,
39 _wpnonce: ppress_admin_globals.nonce
40 },
41 beforeSend: function () {
42 if (currentRequest != null) {
43 currentRequest.abort();
44 }
45 },
46 })
47 .done(function (response) {
48 sb.ajax_flag = false;
49 var doc = document.getElementById(iframe_id).contentWindow.document;
50 /** @see https://stackoverflow.com/a/5752189/2648410 */
51 doc.open();
52 doc.write(response);
53 doc.close();
54
55 }).always(function () {
56 sb.process_ajax_queue();
57 });
58 };
59
60 sb.codeMirrorInit = function (id, mode, lineNumbers) {
61 lineNumbers = typeof lineNumbers !== 'undefined' ? lineNumbers : true;
62
63 ppressCodeEditor.settings.codemirror.mode = mode;
64 ppressCodeEditor.settings.codemirror.lineNumbers = lineNumbers;
65
66 $instance = wp.codeEditor.initialize(id, ppressCodeEditor.settings);
67
68 return $instance.codemirror;
69 };
70
71 sb.preview_request = function (builder_structure_id, builder_css_id, iframe_id) {
72
73 iframe_id = iframe_id || 'indexIframe';
74
75 if (document.getElementById(builder_css_id) === null) return;
76
77 var structure_codemirror_editor = window.cmSettingsInstances[builder_structure_id] = sb.codeMirrorInit(document.getElementById(builder_structure_id), 'htmlmixed');
78 var css_codemirror_editor = window.cmSettingsInstances[builder_css_id] = sb.codeMirrorInit(document.getElementById(builder_css_id), 'css');
79
80 // detect if a change event is fired in codemirror editor.
81 structure_codemirror_editor.on('change', _.debounce(function () {
82 sb.send_ajax(iframe_id, structure_codemirror_editor, css_codemirror_editor);
83 window.onbeforeunload = function () {
84 return 'The changes you made will be lost if you navigate away from this page.';
85 };
86 }, 1500));
87
88 // detect if a change event is fired in codemirror editor.
89 css_codemirror_editor.on('change', function () {
90 sb.send_ajax(iframe_id, structure_codemirror_editor, css_codemirror_editor);
91 window.onbeforeunload = function () {
92 return 'The changes you made will be lost if you navigate away from this page.';
93 };
94 });
95
96 $('input[type="submit"]').on('click', function () {
97 window.onbeforeunload = function (e) {
98 e = null;
99 };
100 });
101
102 $(window).on('load', function () {
103 sb.send_ajax(iframe_id, structure_codemirror_editor, css_codemirror_editor);
104 });
105
106
107 if ($('#pp_password_handler_structure').length === 0) return;
108 var password_handler_structure_codemirror_editor = window.cmSettingsInstances['pp_password_handler_structure'] = sb.codeMirrorInit(document.getElementById('pp_password_handler_structure'), 'htmlmixed');
109 password_handler_structure_codemirror_editor.on('change', function () {
110 sb.send_ajax('handlerIframe', password_handler_structure_codemirror_editor, css_codemirror_editor);
111 });
112
113 $(window).on('load', function () {
114 sb.send_ajax('handlerIframe', password_handler_structure_codemirror_editor, css_codemirror_editor);
115 });
116 };
117
118 sb.login = function () {
119 sb.preview_request('pp_login_structure', 'pp_login_css');
120 };
121
122 sb.melange = function () {
123 sb.preview_request('pp_melange_structure', 'pp_melange_css');
124 };
125
126 sb.password_reset = function () {
127 sb.preview_request('pp_password_structure', 'pp_password_css');
128 };
129
130 sb.registration = function () {
131 sb.preview_request('pp_registration_structure', 'pp_registration_css');
132 };
133
134 sb.frontend_profile = function () {
135 sb.preview_request('pp_fe_profile_structure', 'pp_fe_profile_css');
136 };
137
138 sb.edit_profile = function () {
139 sb.preview_request('pp_edit_profile_structure', 'pp_edit_profile_css');
140 };
141
142 var admin_sidebar_tab_settings = function () {
143
144 var open_tab = function (tab_selector, control_view) {
145 if ($(tab_selector).length === 0) return;
146
147 $('.pp-settings-wrap .nav-tab-wrapper a').removeClass('nav-tab-active');
148 $(tab_selector).addClass('nav-tab-active').trigger('blur');
149 var clicked_group = $(tab_selector).attr('href');
150 if (typeof (localStorage) !== 'undefined') {
151 localStorage.setItem(option_name + "_active-tab", $(tab_selector).attr('href'));
152 }
153 $('.pp-group-wrapper').hide();
154 $(clicked_group).fadeIn();
155
156 if (typeof control_view !== 'undefined') {
157 $('html, body').animate({
158 // we are removing 20 to accomodate admin bar which cut into view.
159 scrollTop: $("#" + control_view).offset().top - 20
160 }, 2000);
161 }
162
163 // reset/remove hash from url
164 window.location.hash = '';
165
166 $.each(window.cmSettingsInstances, function (index, value) {
167 value.refresh();
168 });
169 };
170
171 var open_active_or_first_tab = function () {
172 var active_tab = '';
173 if (typeof (localStorage) !== 'undefined') {
174 active_tab = localStorage.getItem(option_name + "_active-tab");
175 }
176
177 if (active_tab !== '' && $(active_tab).length) {
178 active_tab += '-tab';
179 } else {
180 active_tab = $('.pp-settings-wrap .nav-tab-wrapper a').first();
181 }
182
183 open_tab(active_tab);
184 };
185
186 $('.pp-group-wrapper').hide();
187 var option_name = $('div.pp-settings-wrap').data('option-name');
188
189 $('.pp-settings-wrap .nav-tab-wrapper a').on('click', function (e) {
190 e.preventDefault();
191 open_tab(this);
192 });
193
194 var hash_event_triggered = false;
195
196 $(window).on('hashchange', function () {
197 if (hash_event_triggered === true) return;
198
199 // in #registration_page?login_page, registration_page is the tab id and
200 // login_page the control/settings tr id.
201 var hash = this.location.hash, tab_id_len, tab_id, cache;
202 if (hash.length === 0) open_active_or_first_tab();
203
204 if ((tab_id_len = hash.indexOf('?')) !== -1) {
205 tab_id = hash.slice(0, tab_id_len);
206 control_tr_id = hash.slice(tab_id_len + 1);
207
208 if ((cache = $('a' + tab_id + '-tab')).length !== 0) {
209 open_tab(cache, control_tr_id);
210 }
211 } else {
212 open_tab(hash + '-tab')
213 }
214
215 hash_event_triggered = true;
216
217 });
218
219 $(window).trigger('hashchange');
220 };
221
222 var custom_fields_sortable = function () {
223 // profile fields sortable
224 $("table.custom_profile_fields tbody").sortable({
225 cursor: "move",
226 containment: "table",
227 handle: ".custom-field-anchor",
228 start: function (event, ui) {
229 ui.item.toggleClass("alternate");
230 },
231 stop: function (event, ui) {
232 ui.item.toggleClass("alternate");
233 },
234 update: function (event, ui) {
235 var data = $(this).sortable('toArray');
236 $.post(
237 ajaxurl, {
238 action: "pp_profile_fields_sortable",
239 data: data,
240 csrf: ppress_admin_globals.nonce
241 }
242 );
243
244 // regenerate the table tr ids after each DOM update
245 $('table.custom_profile_fields tbody tr').each(function (index) {
246 $(this).attr('id', ++index);
247 });
248 }
249 });
250 // profile fields sortable
251 $("table#pp_contact_info tbody").sortable({
252 cursor: "move",
253 containment: "table",
254 handle: ".custom-field-anchor",
255 start: function (event, ui) {
256 ui.item.toggleClass("alternate");
257 },
258 stop: function (event, ui) {
259 ui.item.toggleClass("alternate");
260 },
261 update: function (event, ui) {
262 var data = $(this).sortable('toArray');
263 $.post(
264 ajaxurl, {
265 action: "pp_contact_info_sortable",
266 data: data,
267 csrf: ppress_admin_globals.nonce
268 }
269 );
270 }
271 });
272
273 // add IDs to table "tr" tags in profile fields wp-list-table
274 // to be used by jQuery sortable.
275 $('table.custom_profile_fields tbody tr').each(function (index) {
276 $(this).attr('id', ++index);
277 });
278 };
279
280 var custom_field_toggling = function () {
281 jQuery(function ($) {
282 var cpf_type = $('#cpf_type');
283
284 var flag = true;
285
286 if (cpf_type.length > 0) {
287
288 cpf_type.on('change', function () {
289 var cache = $('#cpf-multi-select'),
290 cache2 = $('#pp-custom-field-date-format-row'),
291 cache3 = $('#pp-custom-field-options-row'),
292 selected_value = this.value;
293
294 cache.hide();
295 if (selected_value === 'select') {
296 cache.show();
297 }
298
299 cache2.hide();
300 if (selected_value === 'date') {
301 cache2.show();
302 }
303
304 cache3.hide();
305 // contextual display of options field
306 if ($.inArray(selected_value, ['select', 'radio', 'checkbox', 'file']) !== -1) {
307 if (flag === false) {
308 cache3.find('input').val('');
309 }
310 cache3.show();
311 }
312 });
313
314 cpf_type.trigger('change');
315
316 flag = false;
317 }
318
319 });
320 };
321
322 var email_settings_field_init = function () {
323 // initialize codemirror on email field in settings
324 $(window).on('load', function () {
325 $('.pp-email-editor-textarea').each(function () {
326 window.cmSettingsInstances[this.id] = sb.codeMirrorInit(this, 'htmlmixed', false);
327 });
328
329 $('.pp-codemirror-editor-textarea').each(function () {
330 window.cmSettingsInstances[this.id] = sb.codeMirrorInit(this, 'html', true);
331 });
332 });
333
334 $('.pp-email-editor-tablinks').on('click', function (e) {
335 e.preventDefault();
336 $(this).trigger('blur');
337 var parent = $(this).parents('.ppress-email-editor-wrap');
338 $('.pp-email-editor-tablinks', parent).removeClass('eactive');
339 var key = parent.find('.pp-email-editor-textarea').attr('id');
340
341 $('.pp-email-editor-tabcontent', parent).hide();
342
343 $(this).addClass('eactive');
344
345 if ($(this).hasClass('ecode')) {
346 parent.find('.pp-email-editor-tabcontent.ecode').show();
347 } else {
348 $('#' + key + '_preview_tabcontent').html(window.cmSettingsInstances[key].getValue());
349 parent.find('.pp-email-editor-tabcontent.epreview').show();
350 }
351 });
352
353 $('.pp-email-editor-tablinks.ecode').trigger('click');
354
355 $('#email_content_type').on('change', function () {
356 if (this.value === 'text/plain') {
357 $('.pp-email-editor-tablinks').hide();
358
359 $('.pp-email-editor-tabcontent').hide();
360 $('.pp-email-editor-tabcontent.ecode').show();
361 } else {
362 $('.pp-email-editor-tablinks').show();
363 $('.pp-email-editor-tablinks.ecode').trigger('click');
364 }
365 });
366 };
367
368 var titleshit = function () {
369 $('#title').each(function () {
370 var input = $(this), prompt = $('#' + this.id + '-prompt-text');
371
372 if ('' === this.value) {
373 prompt.removeClass('screen-reader-text');
374 }
375
376 prompt.on('click', function () {
377 $(this).addClass('screen-reader-text');
378 input.trigger('focus');
379 });
380
381 input.on('blur', function () {
382 if ('' === this.value) {
383 prompt.removeClass('screen-reader-text');
384 }
385 });
386
387 input.on('focus', function () {
388 prompt.addClass('screen-reader-text');
389 });
390 });
391 };
392
393 var shortcodeBuilderUI = function () {
394 $('.ppSCB-tab-box .nav-tab').on('click', function (e) {
395 e.preventDefault();
396 $('.ppSCB-tab-box .nav-tab').removeClass('nav-tab-active');
397 var href = $(this).attr('href');
398 $('.ppSCB-tab-content').hide();
399 $(this).addClass('nav-tab-active');
400 $(href).show();
401
402 // if tab is switched in settings, refresh codemirror to redraw the layout
403 // see https://github.com/codemirror/CodeMirror/issues/61
404 $.each(window.cmSettingsInstances, function (index, value) {
405 value.refresh();
406 });
407
408 }).eq(0).trigger('click');
409
410 $('.ppSCB-preview-h-left').on('click', function (e) {
411 e.preventDefault();
412 $('.ppSCB-preview-h-left, .ppSCB-preview-h-right').removeClass('ppSCB-preview-active');
413 $('.ppSCB-sidebar.password-reset iframe').hide();
414 $(this).addClass('ppSCB-preview-active');
415 $('#indexIframe').show();
416 }).trigger('click');
417
418 $('.ppSCB-preview-h-right').on('click', function (e) {
419 e.preventDefault();
420 $('.ppSCB-preview-h-left, .ppSCB-preview-h-right').removeClass('ppSCB-preview-active');
421 $('.ppSCB-sidebar.password-reset iframe').hide();
422 $(this).addClass('ppSCB-preview-active');
423 $('#handlerIframe').show();
424 });
425 };
426
427 var payment_methods_sortable = function () {
428
429 $('.ppress-payment-methods-wrap.is-premium tbody').sortable({
430 items: 'tr',
431 cursor: 'move',
432 axis: 'y',
433 handle: '.gateway-sort',
434 scrollSensitivity: 40,
435 helper: 'clone',
436 opacity: 0.65,
437 update: function (event, ui) {
438 $.post(
439 ajaxurl, {
440 action: "ppress_payment_methods_sortable",
441 data: $(this).sortable('toArray'),
442 csrf: ppress_admin_globals.nonce
443 }
444 );
445 }
446 });
447 };
448
449 $(function () {
450 if (typeof window.cmSettingsInstances === 'undefined') {
451 window.cmSettingsInstances = {};
452 }
453 admin_sidebar_tab_settings();
454 custom_fields_sortable();
455 payment_methods_sortable();
456 custom_field_toggling();
457 email_settings_field_init();
458 titleshit();
459 shortcodeBuilderUI();
460
461 sb.login();
462 sb.melange();
463 sb.password_reset();
464 sb.registration();
465 sb.frontend_profile();
466 sb.edit_profile();
467
468 // confirm before deleting form
469 $('.pp-form-listing.pp-forms .pp-form-delete, .pp-builder-action-btn-block .pp-form-delete, .pp-confirm-delete, .ppress-confirm-delete').on('click', function (e) {
470 e.preventDefault();
471 if (confirm(pp_form_builder.confirm_delete)) {
472 window.location.href = $(this).attr('href');
473 }
474 });
475
476 // Access settings tab contextual display
477 $('#global_site_access').on('change', function () {
478 var val = this.value;
479
480 $('#global_site_access_redirect_page_row, #global_site_access_exclude_pages_row, #global_site_access_allow_homepage_row')
481 .toggle('login' === val);
482 }).trigger('change');
483
484 $('.wp-csa-select2').select2();
485
486 $('.pp-color-field').wpColorPicker();
487 $('.ppselect2').select2();
488
489 var tmpl = wp.template('ppress-plan-summary'),
490 cache = $('.ppview .billing_details .ppress-plan-billing-details'),
491 billing_data;
492
493 if (cache.length > 0) {
494
495 cache.each(function () {
496 billing_data = $(this).data('billing-details');
497
498 if (typeof billing_data !== 'object') {
499 billing_data = JSON.parse(billing_data);
500 }
501
502 $(this).html(tmpl(billing_data));
503 });
504 }
505 // date picker for order filter
506 $('.ppress_datepicker').each(function () {
507 var _this = $(this),
508 format = _this.data('format');
509 _this.flatpickr({dateFormat: (typeof format !== 'undefined' ? format : 'Y-m-d'), allowInput: true});
510 });
511
512 $('.ppress-color-picker').wpColorPicker();
513
514 //date picker for order edit screen
515 $('.ppress_datetime_picker').flatpickr({
516 dateFormat: "Y-m-d H:i",
517 enableTime: true,
518 time_24hr: true,
519 allowInput: true
520 });
521
522 $('.ppress-metabox-data-column a.edit_address').on('click', function (e) {
523 e.preventDefault();
524 $(this).trigger('blur');
525 $('.ppress-billing-details').toggle(false);
526 $('.ppress_edit_address_wrap').toggle(true);
527 });
528
529 $('.ppress-select2-field.membership_plan').select2({
530 ajax: {
531 url: ajaxurl,
532 delay: 250,
533 cache: true,
534 data: function (params) {
535 return {
536 search: params.term,
537 nonce: ppress_admin_globals.nonce,
538 action: 'ppress_mb_search_plans'
539 };
540 }
541 },
542 minimumInputLength: 2
543 });
544
545 $('.ppress-select2-field.customer_user').select2({
546 ajax: {
547 url: ajaxurl,
548 delay: 250,
549 cache: true,
550 data: function (params) {
551 return {
552 search: params.term,
553 nonce: ppress_admin_globals.nonce,
554 action: 'ppress_mb_search_customers'
555 };
556 }
557 },
558 minimumInputLength: 2
559 });
560
561 $('.ppress-select2-field.customer_wp_user').select2({
562 ajax: {
563 url: ajaxurl,
564 delay: 250,
565 cache: true,
566 data: function (params) {
567 return {
568 search: params.term,
569 nonce: ppress_admin_globals.nonce,
570 action: 'ppress_mb_search_wp_users'
571 };
572 }
573 },
574 minimumInputLength: 2
575 });
576
577 // delete order notes in view order admin UI
578 $('.ppress-order-notes-wrap .ppress-delete-note').on('click', function (e) {
579 e.preventDefault();
580
581 if (confirm(pp_form_builder.confirm_delete)) {
582
583 $.post(ajaxurl, {
584 'action': 'ppress_delete_order_note',
585 'note_id': $(this).data('note-id'),
586 'security': ppress_admin_globals.nonce
587 });
588
589 $(this).parents('li.ppress-note').remove();
590 }
591 });
592
593 var tmpl = wp.template('add-replace-order-template');
594 // add/replace order item
595 $('.add-replace-order-item').on('click', function (e) {
596 e.preventDefault();
597 var myModal = new jBox('Modal', {
598 'title': ppress_order_replace_modal_title,
599 content: tmpl(),
600 closeButton: 'title',
601 maxWidth: 400,
602 width: 400,
603 onOpenComplete: function () {
604 $('.ppress-order-change-modal').select2({
605 ajax: {
606 url: ajaxurl,
607 delay: 250,
608 cache: true,
609 data: function (params) {
610 return {
611 search: params.term,
612 'type': $(this).attr('id'),
613 nonce: ppress_admin_globals.nonce,
614 action: 'ppress_mb_order_modal_search'
615 };
616 },
617 processResults: function (data) {
618 if ('prices' in data) {
619 window.ppressModalResultPrices = data.prices;
620 }
621
622 return {
623 results: data.results
624 };
625 }
626 },
627 minimumInputLength: 2
628 });
629
630 $('.ppress-order-change-modal').on('select2:select', function (e) {
631 var id = e.params.data.id;
632
633 if (typeof window.ppressModalResultPrices[id] !== 'undefined') {
634 $('#sub_plan_price').val(window.ppressModalResultPrices[id])
635 }
636 });
637 },
638 onClose: function () {
639 setTimeout(function () {
640 myModal.destroy();
641 }, 1000)
642 }
643 });
644
645 myModal.open();
646 });
647 // replace and save
648 $(document).on('click', '#save-order-change', function (e) {
649 e.preventDefault();
650 var plan = $('#subscription-plans').val(),
651 plan_price = $('#sub_plan_price').val(),
652 order_id = $('#ppress_order_id').val(),
653 tax = $('#tax-amount').val(),
654 order_coupon = $('#order_coupon').val();
655
656 if (plan === "") {
657 alert(ppress_modal_empty_plan_error);
658 } else {
659
660 $(this).prop("disabled", true);
661
662 $.post(ajaxurl, {
663 'action': 'ppress_modal_replace_order_item',
664 'order_id': order_id,
665 'plan': plan,
666 'plan_price': plan_price,
667 'tax': tax,
668 'coupon_code': order_coupon,
669 'security': ppress_admin_globals.nonce
670 }, function () {
671 window.location.reload();
672 }
673 );
674 }
675 });
676
677 $('.ppress-copy-url-icon').on('click', function () {
678 const $input = $(this).siblings('input');
679 const $msg = $(this).siblings('.ppress-copy-msg');
680
681 if ($input.length) {
682 $input[0].select();
683 document.execCommand('copy');
684 $msg.fadeIn(200).delay(1000).fadeOut(200);
685 }
686 });
687
688
689 if (typeof postboxes !== 'undefined' && /ppress/.test(pagenow)) {
690 postboxes.add_postbox_toggles(pagenow);
691 }
692 });
693 })(jQuery);