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 / admin.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
admin.js
691 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 }
241 );
242
243 // regenerate the table tr ids after each DOM update
244 $('table.custom_profile_fields tbody tr').each(function (index) {
245 $(this).attr('id', ++index);
246 });
247 }
248 });
249 // profile fields sortable
250 $("table#pp_contact_info tbody").sortable({
251 cursor: "move",
252 containment: "table",
253 handle: ".custom-field-anchor",
254 start: function (event, ui) {
255 ui.item.toggleClass("alternate");
256 },
257 stop: function (event, ui) {
258 ui.item.toggleClass("alternate");
259 },
260 update: function (event, ui) {
261 var data = $(this).sortable('toArray');
262 $.post(
263 ajaxurl, {
264 action: "pp_contact_info_sortable",
265 data: data
266 }
267 );
268 }
269 });
270
271 // add IDs to table "tr" tags in profile fields wp-list-table
272 // to be used by jQuery sortable.
273 $('table.custom_profile_fields tbody tr').each(function (index) {
274 $(this).attr('id', ++index);
275 });
276 };
277
278 var custom_field_toggling = function () {
279 jQuery(function ($) {
280 var cpf_type = $('#cpf_type');
281
282 var flag = true;
283
284 if (cpf_type.length > 0) {
285
286 cpf_type.on('change', function () {
287 var cache = $('#cpf-multi-select'),
288 cache2 = $('#pp-custom-field-date-format-row'),
289 cache3 = $('#pp-custom-field-options-row'),
290 selected_value = this.value;
291
292 cache.hide();
293 if (selected_value === 'select') {
294 cache.show();
295 }
296
297 cache2.hide();
298 if (selected_value === 'date') {
299 cache2.show();
300 }
301
302 cache3.hide();
303 // contextual display of options field
304 if ($.inArray(selected_value, ['select', 'radio', 'checkbox', 'file']) !== -1) {
305 if (flag === false) {
306 cache3.find('input').val('');
307 }
308 cache3.show();
309 }
310 });
311
312 cpf_type.trigger('change');
313
314 flag = false;
315 }
316
317 });
318 };
319
320 var email_settings_field_init = function () {
321 // initialize codemirror on email field in settings
322 $(window).on('load', function () {
323 $('.pp-email-editor-textarea').each(function () {
324 window.cmSettingsInstances[this.id] = sb.codeMirrorInit(this, 'htmlmixed', false);
325 });
326
327 $('.pp-codemirror-editor-textarea').each(function () {
328 window.cmSettingsInstances[this.id] = sb.codeMirrorInit(this, 'html', true);
329 });
330 });
331
332 $('.pp-email-editor-tablinks').on('click', function (e) {
333 e.preventDefault();
334 $(this).trigger('blur');
335 var parent = $(this).parents('.ppress-email-editor-wrap');
336 $('.pp-email-editor-tablinks', parent).removeClass('eactive');
337 var key = parent.find('.pp-email-editor-textarea').attr('id');
338
339 $('.pp-email-editor-tabcontent', parent).hide();
340
341 $(this).addClass('eactive');
342
343 if ($(this).hasClass('ecode')) {
344 parent.find('.pp-email-editor-tabcontent.ecode').show();
345 } else {
346 $('#' + key + '_preview_tabcontent').html(window.cmSettingsInstances[key].getValue());
347 parent.find('.pp-email-editor-tabcontent.epreview').show();
348 }
349 });
350
351 $('.pp-email-editor-tablinks.ecode').trigger('click');
352
353 $('#email_content_type').on('change', function () {
354 if (this.value === 'text/plain') {
355 $('.pp-email-editor-tablinks').hide();
356
357 $('.pp-email-editor-tabcontent').hide();
358 $('.pp-email-editor-tabcontent.ecode').show();
359 } else {
360 $('.pp-email-editor-tablinks').show();
361 $('.pp-email-editor-tablinks.ecode').trigger('click');
362 }
363 });
364 };
365
366 var titleshit = function () {
367 $('#title').each(function () {
368 var input = $(this), prompt = $('#' + this.id + '-prompt-text');
369
370 if ('' === this.value) {
371 prompt.removeClass('screen-reader-text');
372 }
373
374 prompt.on('click', function () {
375 $(this).addClass('screen-reader-text');
376 input.trigger('focus');
377 });
378
379 input.on('blur', function () {
380 if ('' === this.value) {
381 prompt.removeClass('screen-reader-text');
382 }
383 });
384
385 input.on('focus', function () {
386 prompt.addClass('screen-reader-text');
387 });
388 });
389 };
390
391 var shortcodeBuilderUI = function () {
392 $('.ppSCB-tab-box .nav-tab').on('click', function (e) {
393 e.preventDefault();
394 $('.ppSCB-tab-box .nav-tab').removeClass('nav-tab-active');
395 var href = $(this).attr('href');
396 $('.ppSCB-tab-content').hide();
397 $(this).addClass('nav-tab-active');
398 $(href).show();
399
400 // if tab is switched in settings, refresh codemirror to redraw the layout
401 // see https://github.com/codemirror/CodeMirror/issues/61
402 $.each(window.cmSettingsInstances, function (index, value) {
403 value.refresh();
404 });
405
406 }).eq(0).trigger('click');
407
408 $('.ppSCB-preview-h-left').on('click', function (e) {
409 e.preventDefault();
410 $('.ppSCB-preview-h-left, .ppSCB-preview-h-right').removeClass('ppSCB-preview-active');
411 $('.ppSCB-sidebar.password-reset iframe').hide();
412 $(this).addClass('ppSCB-preview-active');
413 $('#indexIframe').show();
414 }).trigger('click');
415
416 $('.ppSCB-preview-h-right').on('click', function (e) {
417 e.preventDefault();
418 $('.ppSCB-preview-h-left, .ppSCB-preview-h-right').removeClass('ppSCB-preview-active');
419 $('.ppSCB-sidebar.password-reset iframe').hide();
420 $(this).addClass('ppSCB-preview-active');
421 $('#handlerIframe').show();
422 });
423 };
424
425 var payment_methods_sortable = function () {
426
427 $('.ppress-payment-methods-wrap.is-premium tbody').sortable({
428 items: 'tr',
429 cursor: 'move',
430 axis: 'y',
431 handle: '.gateway-sort',
432 scrollSensitivity: 40,
433 helper: 'clone',
434 opacity: 0.65,
435 update: function (event, ui) {
436 $.post(
437 ajaxurl, {
438 action: "ppress_payment_methods_sortable",
439 data: $(this).sortable('toArray'),
440 csrf: ppress_admin_globals.nonce
441 }
442 );
443 }
444 });
445 };
446
447 $(function () {
448 if (typeof window.cmSettingsInstances === 'undefined') {
449 window.cmSettingsInstances = {};
450 }
451 admin_sidebar_tab_settings();
452 custom_fields_sortable();
453 payment_methods_sortable();
454 custom_field_toggling();
455 email_settings_field_init();
456 titleshit();
457 shortcodeBuilderUI();
458
459 sb.login();
460 sb.melange();
461 sb.password_reset();
462 sb.registration();
463 sb.frontend_profile();
464 sb.edit_profile();
465
466 // confirm before deleting form
467 $('.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) {
468 e.preventDefault();
469 if (confirm(pp_form_builder.confirm_delete)) {
470 window.location.href = $(this).attr('href');
471 }
472 });
473
474 // Access settings tab contextual display
475 $('#global_site_access').on('change', function () {
476 var val = this.value;
477
478 $('#global_site_access_redirect_page_row, #global_site_access_exclude_pages_row, #global_site_access_allow_homepage_row')
479 .toggle('login' === val);
480 }).trigger('change');
481
482 $('.wp-csa-select2').select2();
483
484 $('.pp-color-field').wpColorPicker();
485 $('.ppselect2').select2();
486
487 var tmpl = wp.template('ppress-plan-summary'),
488 cache = $('.ppview .billing_details .ppress-plan-billing-details'),
489 billing_data;
490
491 if (cache.length > 0) {
492
493 cache.each(function () {
494 billing_data = $(this).data('billing-details');
495
496 if (typeof billing_data !== 'object') {
497 billing_data = JSON.parse(billing_data);
498 }
499
500 $(this).html(tmpl(billing_data));
501 });
502 }
503 // date picker for order filter
504 $('.ppress_datepicker').each(function () {
505 var _this = $(this),
506 format = _this.data('format');
507 _this.flatpickr({dateFormat: (typeof format !== 'undefined' ? format : 'Y-m-d'), allowInput: true});
508 });
509
510 $('.ppress-color-picker').wpColorPicker();
511
512 //date picker for order edit screen
513 $('.ppress_datetime_picker').flatpickr({
514 dateFormat: "Y-m-d H:i",
515 enableTime: true,
516 time_24hr: true,
517 allowInput: true
518 });
519
520 $('.ppress-metabox-data-column a.edit_address').on('click', function (e) {
521 e.preventDefault();
522 $(this).trigger('blur');
523 $('.ppress-billing-details').toggle(false);
524 $('.ppress_edit_address_wrap').toggle(true);
525 });
526
527 $('.ppress-select2-field.membership_plan').select2({
528 ajax: {
529 url: ajaxurl,
530 delay: 250,
531 cache: true,
532 data: function (params) {
533 return {
534 search: params.term,
535 nonce: ppress_admin_globals.nonce,
536 action: 'ppress_mb_search_plans'
537 };
538 }
539 },
540 minimumInputLength: 2
541 });
542
543 $('.ppress-select2-field.customer_user').select2({
544 ajax: {
545 url: ajaxurl,
546 delay: 250,
547 cache: true,
548 data: function (params) {
549 return {
550 search: params.term,
551 nonce: ppress_admin_globals.nonce,
552 action: 'ppress_mb_search_customers'
553 };
554 }
555 },
556 minimumInputLength: 2
557 });
558
559 $('.ppress-select2-field.customer_wp_user').select2({
560 ajax: {
561 url: ajaxurl,
562 delay: 250,
563 cache: true,
564 data: function (params) {
565 return {
566 search: params.term,
567 nonce: ppress_admin_globals.nonce,
568 action: 'ppress_mb_search_wp_users'
569 };
570 }
571 },
572 minimumInputLength: 2
573 });
574
575 // delete order notes in view order admin UI
576 $('.ppress-order-notes-wrap .ppress-delete-note').on('click', function (e) {
577 e.preventDefault();
578
579 if (confirm(pp_form_builder.confirm_delete)) {
580
581 $.post(ajaxurl, {
582 'action': 'ppress_delete_order_note',
583 'note_id': $(this).data('note-id'),
584 'security': ppress_admin_globals.nonce
585 });
586
587 $(this).parents('li.ppress-note').remove();
588 }
589 });
590
591 var tmpl = wp.template('add-replace-order-template');
592 // add/replace order item
593 $('.add-replace-order-item').on('click', function (e) {
594 e.preventDefault();
595 var myModal = new jBox('Modal', {
596 'title': ppress_order_replace_modal_title,
597 content: tmpl(),
598 closeButton: 'title',
599 maxWidth: 400,
600 width: 400,
601 onOpenComplete: function () {
602 $('.ppress-order-change-modal').select2({
603 ajax: {
604 url: ajaxurl,
605 delay: 250,
606 cache: true,
607 data: function (params) {
608 return {
609 search: params.term,
610 'type': $(this).attr('id'),
611 nonce: ppress_admin_globals.nonce,
612 action: 'ppress_mb_order_modal_search'
613 };
614 },
615 processResults: function (data) {
616 if ('prices' in data) {
617 window.ppressModalResultPrices = data.prices;
618 }
619
620 return {
621 results: data.results
622 };
623 }
624 },
625 minimumInputLength: 2
626 });
627
628 $('.ppress-order-change-modal').on('select2:select', function (e) {
629 var id = e.params.data.id;
630
631 if (typeof window.ppressModalResultPrices[id] !== 'undefined') {
632 $('#sub_plan_price').val(window.ppressModalResultPrices[id])
633 }
634 });
635 },
636 onClose: function () {
637 setTimeout(function () {
638 myModal.destroy();
639 }, 1000)
640 }
641 });
642
643 myModal.open();
644 });
645 // replace and save
646 $(document).on('click', '#save-order-change', function (e) {
647 e.preventDefault();
648 var plan = $('#subscription-plans').val(),
649 plan_price = $('#sub_plan_price').val(),
650 order_id = $('#ppress_order_id').val(),
651 tax = $('#tax-amount').val(),
652 order_coupon = $('#order_coupon').val();
653
654 if (plan === "") {
655 alert(ppress_modal_empty_plan_error);
656 } else {
657
658 $(this).prop("disabled", true);
659
660 $.post(ajaxurl, {
661 'action': 'ppress_modal_replace_order_item',
662 'order_id': order_id,
663 'plan': plan,
664 'plan_price': plan_price,
665 'tax': tax,
666 'coupon_code': order_coupon,
667 'security': ppress_admin_globals.nonce
668 }, function () {
669 window.location.reload();
670 }
671 );
672 }
673 });
674
675 $('.ppress-copy-url-icon').on('click', function () {
676 const $input = $(this).siblings('input');
677 const $msg = $(this).siblings('.ppress-copy-msg');
678
679 if ($input.length) {
680 $input[0].select();
681 document.execCommand('copy');
682 $msg.fadeIn(200).delay(1000).fadeOut(200);
683 }
684 });
685
686
687 if (typeof postboxes !== 'undefined' && /ppress/.test(pagenow)) {
688 postboxes.add_postbox_toggles(pagenow);
689 }
690 });
691 })(jQuery);