Sha256: 26c62c955db7b4e9cb420f5a1f80243157881866c47a839a937f71d961cc5abb

Contents?: true

Size: 1.3 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 application/js/login.js
spontaneous-0.2.0.beta9 application/js/login.js
spontaneous-0.2.0.beta8 application/js/login.js
spontaneous-0.2.0.beta7 application/js/login.js
spontaneous-0.2.0.beta6 application/js/login.js