21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
jQuery.ajax({type: "POST", url: u, data: query, success: function(msg) { if(t) { if(t==':eval') eval(msg); else jQuery("#" + t).html(msg); } } });
}
String.prototype.reverse = function () { return this.split('').reverse().join('');};
function web2py_ajax_init() {
jQuery('.hidden').hide();
jQuery('.error').hide().slideDown('slow');
jQuery('.flash').click(function() { jQuery(this).fadeOut('slow'); return false; });
// 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()+'">')});
jQuery('input.integer').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
jQuery('input.double,input.decimal').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
jQuery("input[type='checkbox'].delete").live('click', function(){ if(this.checked) if(!confirm(confirm_message)) this.checked=false; });
var date_format = (typeof w2p_ajax_date_format != 'undefined') ? w2p_ajax_date_format : "%Y-%m-%d";
try {jQuery("input.date").live('focus',function() {Calendar.setup({
|
|
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
jQuery.ajax({type: "POST", url: u, data: query, success: function(msg) { if(t) { if(t==':eval') eval(msg); else jQuery("#" + t).html(msg); } } });
}
String.prototype.reverse = function () { return this.split('').reverse().join('');};
function web2py_ajax_init() {
jQuery('.hidden').hide();
jQuery('.error').hide().slideDown('slow');
jQuery('.flash').click(function(e) { jQuery(this).fadeOut('slow'); e.preventDefault(); });
// 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()+'">')});
jQuery('input.integer').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
jQuery('input.double,input.decimal').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
jQuery("input[type='checkbox'].delete").live('click', function(){ if(this.checked) if(!confirm(confirm_message)) this.checked=false; });
var date_format = (typeof w2p_ajax_date_format != 'undefined') ? w2p_ajax_date_format : "%Y-%m-%d";
try {jQuery("input.date").live('focus',function() {Calendar.setup({
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
if(flash.html()) flash.slideDown();
web2py_ajax_init();
});
function web2py_trap_form(action,target) {
jQuery('#'+target+' form').each(function(i){
var form=jQuery(this);
if(!form.hasClass('no_trap'))
form.submit(function(obj){
jQuery('.flash').hide().html('');
web2py_ajax_page('post',action,form.serialize(),target);
return false;
});
});
}
function web2py_ajax_page(method,action,data,target) {
jQuery.ajax({'type':method,'url':action,'data':data,
'beforeSend':function(xhr) {
xhr.setRequestHeader('web2py-component-location',document.location);
|
|
|
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
if(flash.html()) flash.slideDown();
web2py_ajax_init();
});
function web2py_trap_form(action,target) {
jQuery('#'+target+' form').each(function(i){
var form=jQuery(this);
if(!form.hasClass('no_trap'))
form.submit(function(e){
jQuery('.flash').hide().html('');
web2py_ajax_page('post',action,form.serialize(),target);
e.preventDefault();
});
});
}
function web2py_ajax_page(method,action,data,target) {
jQuery.ajax({'type':method,'url':action,'data':data,
'beforeSend':function(xhr) {
xhr.setRequestHeader('web2py-component-location',document.location);
|