1function mblp_loader($elem, action, replace) { 2 var tpl = '<div class="loader-ellipse" loader>' + 3 '<span class="loader-ellipse__dot"></span>' + 4 '<span class="loader-ellipse__dot"></span>' + 5 '<span class="loader-ellipse__dot"></span>' + 6 '<span class="loader-ellipse__dot"></span>' + 7 '</div>'; 8 9 action = action || 'start'; 10 replace = replace || true; 11 12 if (action === 'start') { 13 $elem[replace ? 'html' : 'append'](tpl) 14 } else if (action === 'stop') { 15 $elem.find('[loader]').remove(); 16 } 17} 18 19jQuery(function ($) { 20 mblp_check_order_status(); 21 22 23 function mblp_check_order_status() { 24 var $statusLoader = $('#mblp-status-loader'), 25 interval, 26 timeout; 27 28 if ($statusLoader.length) { 29 interval = setInterval(function () { 30 $.ajax({ 31 type : 'POST', 32 dataType : 'json', 33 url : ajaxurl, 34 data : { 35 action : "mblp_check_order_status", 36 order_id : $statusLoader.data('id') 37 }, 38 success : function (data) { 39 if (data.success && data.status !== undefined) { 40 if (data.status === 'completed' && data.link !== undefined) { 41 clearTimeout(timeout); 42 clearInterval(interval); 43 location.href = data.link; 44 } 45 } else if (data.message !== undefined) { 46 clearInterval(interval); 47 clearTimeout(timeout); 48 $statusLoader.html(data.message); 49 } 50 }, 51 error : function (errorThrown) { 52 clearInterval(interval); 53 clearTimeout(timeout); 54 $statusLoader.remove(); 55 $('#mblp-status-loader-error').show(); 56 } 57 }); 58 }, 2000); 59 timeout = setTimeout(function () { 60 clearInterval(interval); 61 $statusLoader.remove(); 62 $('#mblp-status-loader-error').show(); 63 }, 20000); 64 } 65 } 66 67 $(document).on('mblp.place_order.change', function (e, enable) { 68 var $orderReview = $('#order_review'); 69 var $userAgreementInput = $orderReview.find('.user_agreement_input:visible'); 70 71 if(enable && !$userAgreementInput.length || $userAgreementInput.prop('checked')) { 72 $orderReview.find('.cart-proceed-button').prop('disabled', false); 73 $('.mbl-access-sc-checkout').removeClass('mbl-access-locked'); 74 } 75 76 if(!enable) { 77 $orderReview.find('.cart-proceed-button').prop('disabled', true); 78 $('.mbl-access-sc-checkout').addClass('mbl-access-locked'); 79 } 80 }); 81});
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.