diff options
Diffstat (limited to 'ishtar_common/static/js')
| -rw-r--r-- | ishtar_common/static/js/ishtar.js | 38 | 
1 files changed, 38 insertions, 0 deletions
| diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index 97fdaf13a..8da971dbd 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -84,6 +84,7 @@ var default_search_vector;  var pin_search_url;  var static_path = '/static/';  var autofocus_field; +var form_changed = false;  var datatables_default = {      "processing": true, @@ -115,6 +116,7 @@ var activate_own_search_msg = "Searches in the shortcut menu deals with only you  var added_message = " items added.";  var select_only_one_msg = "Select only one item.";  var search_pinned_msg = ""; +var form_changed_msg = "The form has changed. If you don't validate it, all your changes will be lost.";  var advanced_menu = false;  var shortcut_menu_hide = false; @@ -1578,6 +1580,42 @@ var search_get_query_data = function(query_vars, table_name){      return data;  }; +var register_wizard_form = function(){ +    $('form :input').focus(function(){ +      let item_bottom = $(this).offset().top + $(this).height(); +      let footer_top = $("#footer").offset().top; +      if (item_bottom > footer_top) { +        $('html, body').animate({ +          scrollTop: $(document).scrollTop() + (item_bottom - footer_top) + 25 +        }, 800); +      } +      let label_margin = 30; +      if ($(document).scrollTop() > ($(this).offset().top - label_margin)){ +        $('html, body').animate({ +          scrollTop: $(this).offset().top - label_margin +        }, 800); +      } +    }); + +    $('form :input').change(function(){form_changed=true;}); + +    $('.change_step').click(function(){ +        if(!form_changed || +            confirm(form_changed_msg)){ +            return true; +        } +        return false; +    }); + +    if ($("[autofocus]").length > 0) autofocus_field = "#" + $($("[autofocus]")[0]).attr('id'); + +    $(".wizard-form").keydown(function(e){ +      if (e.ctrlKey && e.keyCode == 13) { +        $("#submit_form").click(); +      } +    }); +} +  var registered_stats = false;  var extra_list = new Array();  var sources = new Array(); | 
