Sha256: 73c4b4d84a8be36811d6c79ff81671cfc1a853beac1447034d1c960d7162750c

Contents?: true

Size: 1.3 KB

Versions: 10

Compression:

Stored size: 1.3 KB

Contents

//= require compatibility
//= require authentication

(function($) {
	$(function() {
		$('#login-form input.text').focus(function() {
			var $this = $(this);
			$('span', $this.parent()).addClass('faded');
		}).blur(function() {
			var $this = $(this);
			if ($this.val() === '') {
				$('span', $this.parent()).removeClass('faded').show();
			}
		}).keydown(function() {
			var $this = $(this);
			$('span', $this.parent()).hide();
		}).keyup(function() {
			var $this = $(this);
			if ($this.val() === '') {
				$('span', $this.parent()).show();
			} else {
				$('span', $this.parent()).hide();
			}
		}).each(function() {
			var $this = $(this);
			if ($this.val() !== '') {
				$('span', $this.parent()).hide();
			}
		});
		$('#login form').submit(function() {
			var $this = $(this);
			$.ajax({
				url: $this.attr('action'),
				type: "POST",
				data:$this.serialize(),
				success: function(data) {
					if (data.key) {
						Spontaneous.Auth.Key.save(Spontaneous.site_id, data.key);
						window.location.href = data.redirect;
					}
				},
				error: function() {
					$('#failure-message').fadeOut(function() {
						$('#failed-name').text($('#user-login').val());
						$(this).fadeIn();
					});
					$("#error-message:hidden").slideDown(200);
				},
				dataType: 'json'
			});
			return false;
		});

	});
}(jQuery));

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta5 application/js/login.js
spontaneous-0.2.0.beta4 application/js/login.js
spontaneous-0.2.0.beta3 application/js/login.js
spontaneous-0.2.0.beta2 application/js/login.js
spontaneous-0.2.0.beta1 application/js/login.js
spontaneous-0.2.0.alpha7 application/js/login.js
spontaneous-0.2.0.alpha6 application/js/login.js
spontaneous-0.2.0.alpha5 application/js/login.js
spontaneous-0.2.0.alpha4 application/js/login.js
spontaneous-0.2.0.alpha3 application/js/login.js