1(function ($) { 2 3 function data ($form) { 4 var d = {}; 5 var e = {}; 6 $form.find('input[type=text],input[type=hidden]').each( function (index, item) { 7 var i = $(item); 8 var n = i.attr('name'); 9 if ( 'email' !== n && 'site_id' !== n ) { 10 e[n] = i.val() 11 } else { 12 d[n] = i.val() 13 } 14 }); 15 16 d['extra_fields'] = JSON.stringify(e); 17 return d; 18 } 19 20 function feedback(selector, form, message) { 21 var fb = $(selector); 22 23 if (0 === fb.length) { 24 return alert(fallbackMessage); 25 } 26 27 fb 28 .html( $(selector + '-template').html().replace(/{message}/gi, message) ) 29 .show(); 30 $(form).hide(); 31 } 32 33 window.launchrock = function (form) { 34 $.ajax('http://platform.launchrock.com/v1/createSiteUser', { 35 data: data($(form)), 36 error: function(xhr, status, error) { 37 feedback('.launchrock.failure', form, 'LaunchRock didn\'t like this request, try again later!'); 38 }, 39 success: function(data, status, xhr) { 40 41 var r = data[0].response; 42 switch ( r.status ) { 43 case 'OK': 44 feedback('.launchrock.success', form, 'Thanks, you\'re on!'); 45 break; 46 47 default: 48 feedback('.launchrock.failure', form, r.error.error_message); 49 } 50 } 51 }); 52 }; 53})(jQuery)
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.