Files
gallery3/modules/user/js/user.js
T

40 lines
1.0 KiB
JavaScript
Raw Normal View History

2008-11-24 00:27:45 +00:00
/**
2008-12-06 23:28:26 +00:00
* Display user login form
*
* @todo Close link should be reusable
2008-11-24 00:27:45 +00:00
*/
$("document").ready(function() {
$("#gLoginLink").click(function() {
2008-11-24 00:27:45 +00:00
var url = $("#gLoginLink a").attr("href");
$.get(url, function(data) {
2008-12-06 23:28:26 +00:00
$('#gLoginLink').hide();
$("#gLoginMenu").append('<li><a href="#">X</a></li>');
$("#gLoginMenu li:last").addClass("gClose").show();
$("#gLoginMenu .gClose a").click(function() {
$("#gLoginForm").remove();
$("#gLoginMenu .gClose").remove();
$("#gLoginFormContainer").hide();
$("#gLoginLink").show();
$("input#gUsername").val("");
$("input#gPassword").val("");
});
$("#gLoginFormContainer").html(data).hide().fadeIn();
2008-11-24 00:27:45 +00:00
ajaxify_login_form();
});
return false;
});
2008-11-24 00:27:45 +00:00
});
2008-11-15 06:23:09 +00:00
function ajaxify_login_form() {
$("#gLoginForm").ajaxForm({
2008-11-15 06:23:09 +00:00
target: "#gLoginFormContainer",
success: function(responseText, statusText) {
if (!responseText) {
2008-11-13 04:56:12 +00:00
window.location.reload();
2008-11-15 06:23:09 +00:00
} else {
ajaxify_login_form();
}
}
});
}