App data, everywhere it's needed

Simperium is a cross-platform data sync service. Learn more

Tried and tested a million times over

More than a million users trust their valuable personal information to Simplenote — and trust Simperium to keep their data fresh. Try it!




'; var fragments = { "loading":'
Creating account…
', "success":sval, "failure":'

' }; $t1.click(function(event){ event.preventDefault(); $('#newaccount1').submit(); return false; }); $t2.click(function(event){ event.preventDefault(); $('#newaccount2').submit(); return false; }); $("#newaccount1").submit(function(e){ submitHelper($(this), e); }); $("#newaccount2").submit(function(e){ submitHelper($(this), e); }); function submitHelper(obj, e){ e.preventDefault(); var request_data = obj.serialize(); $n1.prepend(fragments.loading); $n2.prepend(fragments.loading); $n1.find('.loading').addClass('very-invisible'); $n2.find('.loading').addClass('very-invisible'); $fs1.fadeOut(speed, function(){ $n1.find('.loading').removeClass('very-invisible').fadeIn(speed); }); $fs1.addClass('still-processing').find('input').blur(); $fs2.fadeOut(speed, function(){ $n2.find('.loading').removeClass('very-invisible').fadeIn(speed); }); $fs2.addClass('still-processing').find('input').blur(); $.ajax('/signup/', { data: request_data, dataType: 'json', type: "POST", timeout: 10000, // 10k = 10sec; expect over a second since this is essentially a proxied api call success: function(data, textStatus, jqXHR){ if(data && data.success && data.success ===true) { $('#user-dd').html(data.userdd); show_success(); } else if(data && data.error) { show_failure(data.error); } else { show_failure(); } }, error: function(jqXHR, textStatus, errorThrown){ show_failure(); }, complete: function(){ $fs1.removeClass('still-processing'); $fs2.removeClass('still-processing'); } }); return false; } function show_failure(text){ if($.type(text)!=='string') {text = 'Invalid email address. Please try again.';} function _show_failure(text){ $n1.find('.success, .help-inline').remove(); $n2.find('.success, .help-inline').remove(); $n1.prepend(fragments.failure); $n2.prepend(fragments.failure); $n1.find('.help-inline').text(text); $n2.find('.help-inline').text(text); return false; } var $loading1 = $n1.find('.loading'); var $loading2 = $n2.find('.loading'); $fs1.hide();// if it was still visible $fs2.hide();// if it was still visible if($loading1.length && ! $loading1.hasClass('very-invisible')) { $loading1.fadeOut(speed, function(){ $(this).remove(); _show_failure(text); }); } else { $loading1.remove(); //just in case _show_failure(text); } if($loading2.length && ! $loading2.hasClass('very-invisible')) { $loading2.fadeOut(speed, function(){ $(this).remove(); _show_failure(text); }); } else { $loading2.remove(); //just in case _show_failure(text); } window.setTimeout(reset, 2500); return false; } function show_success(){ $n1.find('.loading').fadeOut(speed, function(){ $(this).remove(); $n1.prepend(fragments.success); $fs1.find('.success').fadeIn(speed); }); $n2.find('.loading').fadeOut(speed, function(){ $(this).remove(); $n2.prepend(fragments.success); $fs2.find('.success').fadeIn(speed); }); return false; } function reset(){ $n1.find('.success, .help-inline').remove(); $n1.find('.form input[type=email]').val(''); $fs1.fadeIn(speed); $n2.find('.success, .help-inline').remove(); $n2.find('.form input[type=email]').val(''); $fs2.fadeIn(speed); return false; } });