~ubuntu-branches/debian/jessie/web2py/jessie

« back to all changes in this revision

Viewing changes to applications/welcome/static/js/web2py_ajax.js

  • Committer: Package Import Robot
  • Author(s): José L. Redrejo Rodríguez
  • Date: 2011-11-04 10:12:01 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20111104101201-ym8q3030ik8sc10u
Tags: 1.99.2.1-1
* Updated upstream sources with real 1.99.2 version
* Ensure python-gtk2 is not needed to run web2py, fixing 
  debian/patches/gtk_gui (Closes: #646931)
* Refreshed debian/patches/avoid_updating patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
function web2py_ajax_init() {
26
26
  jQuery('.hidden').hide();
27
27
  jQuery('.error').hide().slideDown('slow');
28
 
  jQuery('.flash').click(function() { jQuery(this).fadeOut('slow'); return false; });
 
28
  jQuery('.flash').click(function(e) { jQuery(this).fadeOut('slow'); e.preventDefault(); });
29
29
  // jQuery('input[type=submit]').click(function(){var t=jQuery(this);t.hide();t.after('<input class="submit_disabled" disabled="disabled" type="submit" name="'+t.attr("name")+'_dummy" value="'+t.val()+'">')});
30
30
  jQuery('input.integer').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
31
31
  jQuery('input.double,input.decimal').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
32
32
  var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
33
33
  jQuery("input[type='checkbox'].delete").live('click', function(){ if(this.checked) if(!confirm(confirm_message)) this.checked=false; });
34
34
  var date_format = (typeof w2p_ajax_date_format != 'undefined') ? w2p_ajax_date_format : "%Y-%m-%d";
35
 
  try {jQuery("input.date").live('focus',function() {Calendar.setup({
36
 
     inputField:this, ifFormat:date_format, showsTime:false
37
 
  }); }); } catch(e) {};
38
35
  var datetime_format = (typeof w2p_ajax_datetime_format != 'undefined') ? w2p_ajax_datetime_format : "%Y-%m-%d %H:%M:%S";
39
 
  try { jQuery("input.datetime").live('focus', function() {Calendar.setup({
40
 
     inputField:this, ifFormat:datetime_format, showsTime: true,timeFormat: "24"
41
 
  }); }); } catch(e) {};
42
 
 
43
 
  jQuery("input.time").live('focus', function() { var el = jQuery(this); 
44
 
          if (!el.hasClass('hasTimeEntry')) try { el.timeEntry(); } catch(e) {}; 
45
 
  });
 
36
  try {
 
37
      jQuery("input.datetime").AnyTime_picker({
 
38
              format: datetime_format.replace('%M','%i')});
 
39
      jQuery("input.date").AnyTime_picker({
 
40
              format: date_format.replace('%M','%i')});
 
41
      jQuery("input.time").AnyTime_picker({
 
42
              format: "%H:%i:%S"});
 
43
  } catch(e) {};
46
44
};
47
45
 
48
46
jQuery(function() {   
55
53
   jQuery('#'+target+' form').each(function(i){
56
54
      var form=jQuery(this);
57
55
      if(!form.hasClass('no_trap'))
58
 
        form.submit(function(obj){
 
56
        form.submit(function(e){
59
57
         jQuery('.flash').hide().html('');
60
58
         web2py_ajax_page('post',action,form.serialize(),target);
61
 
         return false;
 
59
         e.preventDefault();
62
60
      });
63
61
   });
64
62
}