1jQuery( document ).ready( function( $ ) { 2 3 function mkAjax( action, form, objData, callback ) { 4 5 var formdata = new FormData( form[0] ), 6 array = [], 7 arrayLength, 8 i 9 ; 10 11 formdata.append( '_ajax_nonce', objDaeDownload.nonce ); 12 formdata.append( 'action', action ); 13 14 for ( x in objData ) { 15 16 if ( $.isArray( objData[ x ] ) ) { 17 18 array = objData[ x ]; 19 arrayLength = array.length; 20 21 for ( i = 0; i < arrayLength; i++ ) { 22 formdata.append( x + '[]', array[ i ] ); 23 } 24 25 } else { 26 27 formdata.append( x, objData[ x ] ); 28 29 } 30 31 } 32 33 $.ajax( { 34 url: objDaeDownload.ajaxUrl, 35 type: 'POST', 36 data: formdata, 37 contentType: false, 38 cache: false, 39 processData: false, 40 success: callback 41 } ); 42 43 } 44 45 $( 'body' ).on( 'click', '.dae-shortcode-download-button', function() { 46 $( this ).parent().find( '.dae-shortcode-register-wrapper' ).slideToggle(); 47 } ); 48 49 $( 'body' ).on( 'focusin', '.dae-shortcode-register-temp', function() { 50 51 var nextField = $( this ).parent().next(); 52 53 if ( nextField[0] ) { 54 $( this ).parent().remove(); 55 $( this ).remove(); 56 nextField.attr( 'style', 'display: block;' ); 57 } else { 58 $( this ).attr( 'type', 'date' ); 59 } 60 61 } ); 62 63 $( 'body' ).on( 'focus', 'input.dae-shortcode-register-field[name="email"]', function() { 64 65 var form = $( this ).closest( '.dae-shortcode-register-form' ),
66 fileName = form.find( 'input[name="file"]' ).val() 67 ; 68 69 if ( form.find( 'input[name="dae_nonce"]' ).length === 0 ) { 70 71 $.ajax( { 72 url: objDaeDownload.ajaxUrl, 73 type: 'POST', 74 data: { 75 action: 'dae_create_ajax_nonce', 76 file: fileName 77 }, 78 success: function( response ) { 79 if ( response.success && response.data && response.data.nonce ) { 80 form.append( '<input type="hidden" name="dae_nonce" value="' + response.data.nonce + '" />' ); 81 } 82 } 83 } ); 84 85 } 86 87 } ); 88 89 $( 'body' ).on( 'submit', '.dae-shortcode-register-form', function( e ) { 90 91 e.preventDefault(); 92 93 var form = $( this ), 94 objData = { 95 form_content: form.parent().parent().html() 96 } 97 ; 98 99 form.parent().find( '.dae-shortcode-register-message' ).empty(); 100 form.find( '.dae-shortcode-register-loading' ).show(); 101 102 mkAjax( 'dae_send_downloadlink', $( this ), objData, function( data ) { 103 104 dataObj = JSON.parse( data ); 105 106 if ( 'success' === dataObj.type ) { 107 form[0].reset(); 108 } 109 110 form.parent().find( '.dae-shortcode-register-message' ).html( dataObj.message ); 111 form.find( '.dae-shortcode-register-loading' ).hide(); 112 113 } ); 114 115 } ); 116 117} );
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.