summaryrefslogtreecommitdiff
path: root/modules/user/js
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-11-27 06:14:32 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-11-27 06:14:32 +0000
commit27e64f1dc6cc43b40592337eed360bdf7e3d7a59 (patch)
treef127c76bff448c546a30753b466cf909bb42ca7d /modules/user/js
parent7e5f59bcb7682896657dd11a530dc25412ef3cdc (diff)
Move javascript from default theme to appropriate modules
Diffstat (limited to 'modules/user/js')
-rw-r--r--modules/user/js/user.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/user/js/user.js b/modules/user/js/user.js
new file mode 100644
index 00000000..8ee543bf
--- /dev/null
+++ b/modules/user/js/user.js
@@ -0,0 +1,38 @@
+/**
+ * @todo preventDefault() not working in IE 6 and 7
+ * @todo Close link should be reusable
+ */
+
+$("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();
+ $("#gLoginMenu .gClose a").click(function(){
+ $("#gLoginForm").remove();
+ $("#gLoginMenu .gClose").remove();
+ $("#gLoginLink").show();
+ $("input#gUsername").val("");
+ $("input#gPassword").val("");
+ });
+ $("#gLoginFormContainer").html(data).hide().fadeIn();
+ 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();
+ }
+ }
+ });
+}