mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 03:19:13 -04:00
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
/**
|
|
* @todo preventDefault() not working in IE 6 and 7
|
|
* @todo Close link should be reusable
|
|
*/
|
|
|
|
$("document").ready(function() {
|
|
$("#gLoginLink").click(function() {
|
|
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();
|
|
$("#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();
|
|
ajaxify_login_form();
|
|
});
|
|
return false;
|
|
});
|
|
});
|
|
|
|
function ajaxify_login_form() {
|
|
$("#gLoginForm").ajaxForm({
|
|
target: "#gLoginFormContainer",
|
|
success: function(responseText, statusText) {
|
|
if (!responseText) {
|
|
window.location.reload();
|
|
} else {
|
|
ajaxify_login_form();
|
|
}
|
|
}
|
|
});
|
|
}
|