/** * jQuery EasyUI 1.2.5 * * Licensed under the GPL terms * To use it on other terms please contact us * * Copyright(c) 2009-2011 stworthy [ stworthy@gmail.com ] * */ (function($){ function _1(_2){ var _3=$.data(_2,"linkbutton").options; $(_2).empty(); $(_2).addClass("l-btn"); if(_3.id){ $(_2).attr("id",_3.id); }else{ $.fn.removeProp?$(_2).removeProp("id"):$(_2).removeAttr("id"); } if(_3.plain){ $(_2).addClass("l-btn-plain"); }else{ $(_2).removeClass("l-btn-plain"); } if(_3.text){ $(_2).html(_3.text).wrapInner(""+""+""+""); if(_3.iconCls){ $(_2).find(".l-btn-text").addClass(_3.iconCls).css("padding-left","20px"); } }else{ $(_2).html(" ").wrapInner(""+""+""+""+""); if(_3.iconCls){ $(_2).find(".l-btn-empty").addClass(_3.iconCls); } } $(_2).unbind(".linkbutton").bind("focus.linkbutton",function(){ if(!_3.disabled){ $(this).find("span.l-btn-text").addClass("l-btn-focus"); } }).bind("blur.linkbutton",function(){ $(this).find("span.l-btn-text").removeClass("l-btn-focus"); }); _4(_2,_3.disabled); }; function _4(_5,_6){ var _7=$.data(_5,"linkbutton"); if(_6){ _7.options.disabled=true; var _8=$(_5).attr("href"); if(_8){ _7.href=_8; $(_5).attr("href","javascript:void(0)"); } if(_5.onclick){ _7.onclick=_5.onclick; _5.onclick=null; } $(_5).addClass("l-btn-disabled"); }else{ _7.options.disabled=false; if(_7.href){ $(_5).attr("href",_7.href); } if(_7.onclick){ _5.onclick=_7.onclick; } $(_5).removeClass("l-btn-disabled"); } }; $.fn.linkbutton=function(_9,_a){ if(typeof _9=="string"){ return $.fn.linkbutton.methods[_9](this,_a); } _9=_9||{}; return this.each(function(){ var _b=$.data(this,"linkbutton"); if(_b){ $.extend(_b.options,_9); }else{ $.data(this,"linkbutton",{options:$.extend({},$.fn.linkbutton.defaults,$.fn.linkbutton.parseOptions(this),_9)}); $(this).removeAttr("disabled"); } _1(this); }); }; $.fn.linkbutton.methods={options:function(jq){ return $.data(jq[0],"linkbutton").options; },enable:function(jq){ return jq.each(function(){ _4(this,false); }); },disable:function(jq){ return jq.each(function(){ _4(this,true); }); }}; $.fn.linkbutton.parseOptions=function(_c){ var t=$(_c); return {id:t.attr("id"),disabled:(t.attr("disabled")?true:undefined),plain:(t.attr("plain")?t.attr("plain")=="true":undefined),text:$.trim(t.html()),iconCls:(t.attr("icon")||t.attr("iconCls"))}; }; $.fn.linkbutton.defaults={id:null,disabled:false,plain:false,text:"",iconCls:null}; })(jQuery);