1/* global sumo_pp_myaccount_params */ 2 3jQuery( function( $ ) { 4 // sumo_pp_myaccount_params is required to continue, ensure the object exists 5 if ( typeof sumo_pp_myaccount_params === 'undefined' ) { 6 return false; 7 } 8 9 var $page = $( '.sumo-pp-view-payment' ); 10 11 var is_blocked = function( $node ) { 12 return $node.is( '.processing' ) || $node.parents( '.processing' ).length; 13 }; 14 15 /** 16 * Block a node visually for processing. 17 * 18 * @param {JQuery Object} $node 19 */ 20 var block = function( $node ) { 21 if ( ! is_blocked( $node ) ) { 22 $node.addClass( 'processing' ).block( { 23 message : null, 24 overlayCSS : { 25 background : '#fff', 26 opacity : 0.6 27 } 28 } ); 29 } 30 }; 31 32 /** 33 * Unblock a node after processing is complete. 34 * 35 * @param {JQuery Object} $node 36 */ 37 var unblock = function( $node ) { 38 $node.removeClass( 'processing' ).unblock(); 39 }; 40 41 var my_account = { 42 /** 43 * Manage My Payments Table Editable UI events. 44 */ 45 init : function() { 46 $( document ).on( 'click', 'div.pay_installments input', this.payInstallments ); 47 $( document ).on( 'click', 'table.payment_activities #prevent_more_notes', this.preventMorePaymentNotes ); 48 }, 49 payInstallments : function( evt ) { 50 var $this = $( evt.currentTarget ); 51 $.blockUI.defaults.overlayCSS.cursor = 'wait'; 52 block( $page ); 53 54 $.ajax( { 55 type : 'POST', 56 url : sumo_pp_myaccount_params.wp_ajax_url, 57 data : { 58 action : '_sumo_pp_pay_remaining_custom_installments', 59 security : sumo_pp_myaccount_params.myaccount_nonce, 60 payment_id : $( '.sumo-pp-view-payment table.payment_details' ).data( 'payment_id' ), 61 selected_installments : $( 'div.pay_installments' ).find( 'select' ).val(), 62 }, 63 success : function( data ) { 64 if ( 'undefined' !== typeof data.result ) { 65 window.location.href = data.redirect; 66 } 67 }, 68 complete : function() { 69 unblock( $page ); 70 } 71 } ); 72 }, 73 preventMorePaymentNotes : function( evt ) { 74 var $this = $( evt.currentTarget ); 75 76 if ( 'more' === $this.attr( 'data-flag' ) ) { 77 $this.text( sumo_pp_myaccount_params.show_less_notes_label ); 78 $this.attr( 'data-flag', 'less' ); 79 80 $( '._alert_box' ).slideDown(); 81 } else { 82 $this.text( sumo_pp_myaccount_params.show_more_notes_label ); 83 $this.attr( 'data-flag', 'more' ); 84 85 $( '._alert_box' ).css( 'display', 'none' ); 86 $( '.default_notes0' ).slideDown(); 87 $( '.default_notes1' ).slideDown(); 88 $( '.default_notes2' ).slideDown(); 89 } 90 } 91 }; 92 93 if ( $page.length ) { 94 my_account.init(); 95 } 96} );
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.