blob: 6c66e35cc9852dd3e3ad6249597d5ad71ddc9455 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/**
* @todo preventDefault() not working in IE 6 and 7
* @todo Close link should be reusable
*/
var closeLink = '<li><a href="#">X</a></li>';
$("document").ready(function() {
$("#gLoginLink").click(function(event){
event.preventDefault();
var url = $("#gLoginLink a").attr("href");
$.get(url, function(data) {
$('#gLoginLink').hide();
$("#gLoginMenu").append(closeLink);
$("#gLoginMenu li:last").addClass("gClose").show();
$("#gLoginMenu .gClose a").click(function(){
$("#gLoginForm").remove();
$("#gLoginMenu .gClose").remove();
$("#gLoginLink").show();
$("input#gUsername").val("");
$("input#gPassword").val("");
});
$("#gLoginFormContainer").html(data);
ajaxify_login_form();
});
});
});
function ajaxify_login_form() {
$("form#gLoginForm").ajaxForm({
target: "#gLoginFormContainer",
success: function(responseText, statusText) {
if (!responseText) {
window.location.reload();
} else {
ajaxify_login_form();
}
},
});
}
|