diff --git a/js/core.min.js b/js/core.min.js index 86515b0ece..765d3dc3e1 100644 --- a/js/core.min.js +++ b/js/core.min.js @@ -62,9 +62,9 @@ wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px $(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);') $(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')};(function($){$.fn.add_options=function(options_list){for(var i=0;i').html(label).attr('value',value).appendTo(this);} $(this).val(options_list[0].value||options_list[0]);} -$.fn.set_working=function(){var ele=this.get(0);if(ele.loading_img){$(ele.loading_img).toggle(true);}else{ele.disabled=1;ele.loading_img=$('').insertAfter(ele);}} -$.fn.done_working=function(){var ele=this.get(0);ele.disabled=0;if(ele.loading_img){$(ele.loading_img).toggle(false);};}})(jQuery); +$.fn.done_working=function(){var ele=this.get(0);$(ele).attr('disabled',null);if(ele.loading_img){$(ele.loading_img).toggle(false);};}})(jQuery); /* * lib/js/wn/model.js */ diff --git a/js/legacy/utils/handler.js b/js/legacy/utils/handler.js index 44f16c84f5..3ed9986f63 100644 --- a/js/legacy/utils/handler.js +++ b/js/legacy/utils/handler.js @@ -34,7 +34,7 @@ function $c(command, args, callback, error, no_spinner, freeze_msg, btn) { // For calling an object function $c_obj(doclist, method, arg, callback, no_spinner, freeze_msg, btn) { if(arg && typeof arg!='string') arg = JSON.stringify(arg); - + args = { cmd:'runserverobj', arg: arg, diff --git a/js/legacy/widgets/form/fields.js b/js/legacy/widgets/form/fields.js index 08aa427aef..10b9ef1eb2 100644 --- a/js/legacy/widgets/form/fields.js +++ b/js/legacy/widgets/form/fields.js @@ -1273,18 +1273,15 @@ _f.ButtonField.prototype.make_input = function() { var me = this; me.df.label, null, {fontWeight:'bold'}, null, 1) - this.input.onclick = function() { + $(this.input).click(function() { if(me.not_in_form) return; - this.disabled = 'disabled'; if(cur_frm.cscript[me.df.fieldname] && (!me.in_filter)) { cur_frm.runclientscript(me.df.fieldname, me.doctype, me.docname); - this.disabled = false; } else { cur_frm.runscript(me.df.options, me); - this.disabled = false; } - } + }); } _f.ButtonField.prototype.hide = function() { diff --git a/js/legacy/widgets/form/form.js b/js/legacy/widgets/form/form.js index 2f9915d427..393d002cd5 100644 --- a/js/legacy/widgets/form/form.js +++ b/js/legacy/widgets/form/form.js @@ -865,7 +865,8 @@ _f.Frm.prototype.runscript = function(scriptname, callingfield, onrefresh) { // make doc list var doclist = compress_doclist(make_doclist(this.doctype, this.docname)); // send to run - if(callingfield)callingfield.input.disabled = true; + if(callingfield) + $(callingfield.input).set_working(); $c('runserverobj', {'docs':doclist, 'method':scriptname }, function(r, rtxt) { @@ -880,7 +881,8 @@ _f.Frm.prototype.runscript = function(scriptname, callingfield, onrefresh) { me.refresh_dependency(); // enable button - if(callingfield)callingfield.input.done_working(); + if(callingfield) + $(callingfield.input).done_working(); } ); } diff --git a/js/wn/dom.js b/js/wn/dom.js index b4644bc910..b00f7e4d90 100644 --- a/js/wn/dom.js +++ b/js/wn/dom.js @@ -143,10 +143,10 @@ wn.dom.set_box_shadow = function(ele, spread) { } $.fn.set_working = function() { var ele = this.get(0); + $(ele).attr('disabled', 'disabled'); if(ele.loading_img) { $(ele.loading_img).toggle(true); } else { - ele.disabled = 1; ele.loading_img = $('') .insertAfter(ele); @@ -154,7 +154,7 @@ wn.dom.set_box_shadow = function(ele, spread) { } $.fn.done_working = function() { var ele = this.get(0); - ele.disabled = 0; + $(ele).attr('disabled', null); if(ele.loading_img) { $(ele.loading_img).toggle(false); }; diff --git a/js/wn/request.js b/js/wn/request.js index 79b34682f3..c65b25f8ac 100644 --- a/js/wn/request.js +++ b/js/wn/request.js @@ -29,7 +29,7 @@ wn.request.url = 'index.cgi'; wn.request.prepare = function(opts) { // btn indicator if(opts.btn) $(opts.btn).set_working(); - + // navbar indicator if(opts.show_spinner) set_loading(); diff --git a/js/wn/ui/button.js b/js/wn/ui/button.js index 30cced8e01..98b2cb1da3 100644 --- a/js/wn/ui/button.js +++ b/js/wn/ui/button.js @@ -30,7 +30,6 @@ wn.ui.Button = function(args) { // ajax loading me.loading_img = wn.dom.add(me.btn.args.parent,'img','',{margin:'0px 4px -2px 4px', display:'none'}); me.loading_img.src= 'images/lib/ui/button-load.gif'; - if(args.is_ajax) wn.dom.css(me.btn,{marginRight:'24px'}); // label me.btn.innerHTML = args.label; @@ -53,17 +52,11 @@ wn.ui.Button = function(args) { set_working: function() { me.btn.disabled = 'disabled'; - if(me.btn.args.is_ajax) { - $(me.btn).css('margin-right', '0px'); - } $(me.loading_img).css('display','inline'); }, done_working: function() { me.btn.disabled = false; - if(me.btn.args.is_ajax) { - $(me.btn).css('margin-right', '24px'); - } $(me.loading_img).toggle(false); } });