1; 2function jxFormData(p) { 3 var list = {}; 4 jQuery('input[name], select[name], textarea[name]', p).each(function(i, v){ 5 var vj = jQuery(v); 6 var n = vj.attr('name'); 7 var val = vj.val(); 8 var ismult = false; 9 if (n.substr(-2) === '[]') { 10 n = n.substr(0, n.length - 2); 11 ismult = true; 12 } 13 if (vj.is('input[type="radio"]') || vj.is('input[type="checkbox"]')) { 14 // Case 1 (radio or checkbox) 15 if (vj.is(':checked')) { 16 if (ismult) { 17 if ((typeof list[n] === 'object') && (list[n] !== null)) { 18 list[n].push(val); 19 } else { 20 list[n] = [val]; 21 } 22 } else { 23 list[n] = val; 24 } 25 } else { 26 // Ignore 27 } 28 } else { 29 if (vj.is('select[name]')) { 30 if (ismult) { 31 if (typeof val !== 'object') { 32 list[n] = [val]; 33 } else { 34 if (val === null) { 35 // Pass it 36 } else { 37 if (typeof list[n] !== 'undefined') { 38 if ((typeof list[n] === 'object') && (list[n] !== null)) { 39 // Merge 40 for (var z in val) { 41 list[n].push(val[z]); 42 } 43 } else { 44 list[n] = val; 45 } 46 } else { 47 list[n] = val; 48 } 49 } 50 } 51 } else { 52 list[n] = val; 53 } 54 } else { 55 // Common control 56 list[n] = val; 57 } 58 } 59 }); 60 61 return list; 62} 63 64function jxAction(action, data, cb) { 65 if (typeof data === 'undefined') { 66 data = {}; 67 } 68 data['jx_action'] = action; 69 jQuery(document).trigger('jx_start', data); 70 jQuery(document).trigger('jx_start_' + data['jx_action'], data); 71 jQuery.ajax({ 72 url: wpjxm_ajaxurl, 73 method: 'POST', 74 data: {'action': wpjxm_action, '__xr':1, 'z':JSON.stringify(data)}, 75 success: function(jx) { 76 jQuery(document).trigger('jx_finish', data); 77 jQuery(document).trigger('jx_finish_' + data['jx_action'], data); 78 jQuery(document).trigger('jx_success', [data, jx]); 79 jQuery(document).trigger('jx_success_' + data['jx_action'], [data, jx]); 80 var ret = true; 81 if ((typeof cb !== 'undefined') && (cb)) { 82 var vars = {}; 83 for (var i = 0; i < jx.length; i ++) { 84 switch (jx[i][0]) { 85 case 'vr': 86 vars[jx[i][1]] = jx[i][2]; 87 break; 88 case 'vs': 89 for (var kk in jx[i][1]) { 90 vars[kk] = jx[i][1][kk]; 91 } 92 break; 93 } 94 } 95 ret = cb(vars); 96 } 97 if ((ret) || (typeof ret === 'undefined')) { 98 for (var i = 0; i < jx.length; i ++) { 99 var jd = jx[i]; 100 switch (jd[0]) { 101 case 'cn': 102 console.log(jd[1]); 103 break; 104 case 'cl': 105 window[jd[1]].apply(this, jd[2]); 106 break; 107 case 'al': 108 alert(jd[1]); 109 break; 110 case 'as': 111 if (jQuery(jd[1]).length > 0) { 112 jQuery(jd[1]).html(jd[2]); 113 } 114 break; 115 case 'js': 116 eval(jd[1]); 117 break; 118 case 'rd': 119 document.location.href = jd[1]; 120 break; 121 case 'rl': 122 window.location.reload(); 123 break; 124 case 'tr': 125 jQuery(document).trigger(jd[1], jd[2]); 126 break; 127 } 128 } 129 } 130 }, 131 error: function(xhr, status, error) { 132 jQuery(document).trigger('jx_finish', data); 133 jQuery(document).trigger('jx_finish_' + data['jx_action'], data); 134 jQuery(document).trigger('jx_error', [data, xhr, status, error]); 135 jQuery(document).trigger('jx_error_' + data['jx_action'], [data, xhr, status, error]); 136 console.log('Wrong jx JSON response (not JSON): ' + error); 137 }, 138 dataType: 'json' 139 }); 140 141}
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.