1jQuery(function ($) { 2 $(document).on('click', '.rpress-reorder-btn', function (e) { 3 e.preventDefault(); 4 var self = $(this); 5 var $modal = $('#rpressModal'); 6 if (!$modal.length) { 7 $('body').append('<div class="modal micromodal-slide" id="rpressModal" aria-hidden="true"><div class="modal__overlay" tabindex="-1" data-micromodal-close><div class="modal__container modal-content" role="dialog" aria-modal="true"><header class="modal__header modal-header"><h2 class="modal__title modal-title"></h2><button class="modal__close" aria-label="Close modal" data-micromodal-close></button></header><main class="modal__content modal-body"></main></div></div></div>'); 8 $modal = $('#rpressModal'); 9 } 10 if (!$modal.length) { 11 return; 12 } 13 var action = 'rpress_reorder'; 14 var order_id = self.attr('data-order-id'); 15 var data = { 16 action: action, 17 order_id: order_id, 18 security: rp_scripts.order_details_nonce 19 }; 20 21 $modal 22 .addClass('rpress-order-details-context') 23 .addClass('show-order-details'); 24 $.ajax({
25 type: "POST", 26 data: data, 27 dataType: "json", 28 url: rp_scripts.ajaxurl, 29 beforeSend: (jqXHR, object) => { 30 self.addClass('rp-loading'); 31 self.find('.rp-ajax-toggle-text') 32 .addClass('rp-text-visibility'); 33 }, 34 complete: (jqXHR, object) => { 35 self.removeClass('rp-loading'); 36 self.find('.rp-ajax-toggle-text') 37 .removeClass('rp-text-visibility'); 38 }, 39 success: function (response) { 40 if (!response || response.success !== true || !response.data || typeof response.data.html !== 'string') { 41 return; 42 } 43 $modal.find('.modal__container') 44 .html(response.data.html); 45 if (typeof MicroModal !== 'undefined' && typeof MicroModal.show === 'function') { 46 MicroModal.show('rpressModal'); 47 } else { 48 $modal 49 .addClass('is-open') 50 .attr('aria-hidden', 'false'); 51 $('html, body') 52 .addClass('modal-open') 53 .css('overflow', 'hidden'); 54 } 55 }, 56 error: function () { 57 $modal.removeClass('show-order-details rpress-order-details-context'); 58 } 59 }) 60 }); 61 62 // Handle clicks on checkout/add more items buttons inside reorder modal 63 $(document).on('click', '#rpressModal .rp-detils-content-view a', function (e) { 64 e.preventDefault(); 65 var href = $(this).attr('href'); 66 if (href) { 67 if (typeof MicroModal !== 'undefined' && typeof MicroModal.close === 'function') { 68 try { 69 MicroModal.close('rpressModal'); 70 } catch (err) {} 71 } else { 72 $('#rpressModal') 73 .removeClass('is-open show-order-details rpress-order-details-context') 74 .attr('aria-hidden', 'true'); 75 $('html, body') 76 .removeClass('modal-open') 77 .css('overflow', ''); 78 } 79 window.location.href = href; 80 } 81 }); 82});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.