| 1 |
// generic JS fixes
|
| 2 |
|
| 3 |
// various JavaScript object.
|
| 4 |
var Blueprint = {};
|
| 5 |
|
| 6 |
// jump to the value in a select drop down
|
| 7 |
Blueprint.go = function(e) {
|
| 8 |
var destination = e.options[e.selectedIndex].value;
|
| 9 |
if (destination && destination != 0) location.href = destination;
|
| 10 |
};
|
| 11 |
|
| 12 |
// prevent users from clicking a submit button twice
|
| 13 |
Blueprint.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 |
|
| 17 |
// insert the saving div now to cache it for better performance and to show the loading image
|
| 18 |
$('<div id="saving"><p class="saving">Saving…</p></div>').insertAfter(forms);
|
| 19 |
|
| 20 |
forms.click(function() {
|
| 21 |
$(this).siblings("input[@type=submit]").hide();
|
| 22 |
$(this).hide();
|
| 23 |
$("#saving").show();
|
| 24 |
|
| 25 |
var notice = function() {
|
| 26 |
$('<p id="saving-notice">Not saving? Wait a few seconds, reload this page, and try again. Every now and then the internet hiccups too :-)</p>').appendTo("#saving").fadeIn();
|
| 27 |
};
|
| 28 |
|
| 29 |
// append notice if form saving isn't work, perhaps a timeout issue
|
| 30 |
setTimeout(notice, 24000);
|
| 31 |
});
|
| 32 |
};
|
| 33 |
|
| 34 |
// Global Killswitch.
|
| 35 |
if (Drupal.jsEnabled) {
|
| 36 |
$(document).ready(Blueprint.formCheck);
|
| 37 |
}
|