|
1
|
1 |
// $Id: script.js,v 1.2 2008/10/30 13:00:59 jmburnz Exp $ |
|
|
2 |
|
|
|
3 |
/** |
|
|
4 |
* Animates submit buttons |
|
|
5 |
*/ |
|
|
6 |
var Genesis = {}; |
|
|
7 |
// jump to the value in a select drop down |
|
|
8 |
Genesis.go = function(e) { |
|
|
9 |
var destination = e.options[e.selectedIndex].value; |
|
|
10 |
if (destination && destination != 0) location.href = destination; |
|
|
11 |
}; |
|
|
12 |
// prevent users from clicking a submit button twice |
|
|
13 |
Genesis.formCheck = function() { |
|
|
14 |
// only apply this to node and comment and new user registration forms |
|
|
15 |
var forms = $("#node-form>div>div>#edit-submit,#comment-form>div>#edit-submit,#user-register>div>#edit-submit"); |
|
|
16 |
// insert the saving div now to cache it for better performance and to show the loading image |
|
|
17 |
$('<div id="saving"><p class="saving">Enregistrement des données…</p></div>').insertAfter(forms); |
|
|
18 |
forms.click(function() { |
|
|
19 |
$(this).siblings("input[@type=submit]").hide(); |
|
|
20 |
$(this).hide(); |
|
|
21 |
$("#saving").show(); |
|
|
22 |
var notice = function() { |
|
|
23 |
$('<p id="saving-notice">Pas d\'enregistrement ? Patientez quelques secondes, rechargez cette page, et essayez à nouveau.</p>').appendTo("#saving").fadeIn(); |
|
|
24 |
}; |
|
|
25 |
// append notice if form saving isn't work, perhaps a timeout issue |
|
|
26 |
setTimeout(notice, 24000); |
|
|
27 |
}); |
|
|
28 |
}; |
|
|
29 |
// Global Killswitch. |
|
|
30 |
if (Drupal.jsEnabled) { |
|
|
31 |
$(document).ready(Genesis.formCheck); |
|
|
32 |
} |