2 var body
= $('body'), form
= $('form'), notes
= $('.notes');
5 body
.find('.nojs').remove();
7 // Do some fancy fading in, and get rid of that damn error.
10 // remove previous notifications
11 var remove_notes = function() {
12 notes
.find('p').remove();
16 // Check when the MySQL form has been submitted, and AJAX a request off.
17 var check = function() {
18 // remove previous notifications
22 $('#diagnose').animate({'opacity': 0.5}, 250, function() {
25 'url': 'diagnose.php',
26 'data': form
.serialize(),
27 'success': check_result
34 var check_result = function(data
) {
35 $('#diagnose').animate({'opacity': 1});
38 notes
.show().append('<p class="success">✓ Database test successful.</p>').fadeIn();
40 notes
.show().append('<p class="error">' + data
+ '</p>').fadeIn();
44 var submit = function() {
47 'url': 'installer.php',
48 'data': form
.serialize(),
50 'success': submit_result
56 var submit_result = function(data
) {
57 // remove previous notifications
61 var content
= $('.content');
63 content
.animate({'opacity': 0}, function() {
64 var btn_text
= 'Continue to your site.';
66 var html
= '<h2>Thanks for installing!</h2>';
67 html
+= '<p>We created an account for you.<br>The username is <b>admin</b>, and the password is <strong>' + data
.password
+ '</strong>.</p>';
69 if(data
.warnings
.length
) {
70 btn_text
= 'OK, I understand, Continue to your site.';
72 html
+= '<ul style="padding-bottom: 1em;">';
74 for(var i
= 0; i
< data
.warnings
.length
; i
++) {
75 var warn
= data
.warnings
[i
];
76 html
+= '<li>' + warn
+ '</li>';
82 html
+= '<p><a href="../" class="button" style="float: none; display: inline-block;">' + btn_text
+ '</a></p>';
84 content
.html(html
).animate({'opacity': 1});
87 notes
.show().append('<p class="error">' + data
.errors
.join(', ') + '</p>').fadeIn();
91 // Bind normal form submit
92 form
.bind('submit', submit
);
95 $('a[href$=#check]').bind('click', check
);