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

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2008-11-24 00:27:45 +00:00
/**
* @todo preventDefault() not working in IE 6 and 7
* @todo Close link should be reusable
2008-11-24 00:27:45 +00:00
*/
$("document").ready(function() {
$("#gLoginLink").click(function(event){
event.preventDefault();
var url = $("#gLoginLink a").attr("href");
$.get(url, function(data) {
$('#gLoginLink').hide();
$("#gLoginMenu").append('<li><a href="#">X</a></li>');
$("#gLoginMenu li:last").addClass("gClose").show();
2008-11-24 00:27:45 +00:00
$("#gLoginMenu .gClose a").click(function(){
$("#gLoginForm").remove();
$("#gLoginMenu .gClose").remove();
$("#gLoginLink").show();
$("input#gUsername").val("");
$("input#gPassword").val("");
2008-11-24 00:27:45 +00:00
});
$("#gLoginFormContainer").html(data).hide().fadeIn();
2008-11-24 00:27:45 +00:00
ajaxify_login_form();
});
});
2008-11-24 00:27:45 +00:00
});
2008-11-15 06:23:09 +00:00
function ajaxify_login_form() {
2008-11-16 07:07:16 +00:00
$("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();
}
}
});
}