jquery.splitbutton.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * jQuery EasyUI 1.3.4
  3. *
  4. * Copyright (c) 2009-2013 www.jeasyui.com. All rights reserved.
  5. *
  6. * Licensed under the GPL or commercial licenses
  7. * To use it on other terms please contact us: info@jeasyui.com
  8. * http://www.gnu.org/licenses/gpl.txt
  9. * http://www.jeasyui.com/license_commercial.php
  10. *
  11. */
  12. (function($){
  13. function _1(_2){
  14. var _3=$.data(_2,"splitbutton").options;
  15. $(_2).menubutton(_3);
  16. };
  17. $.fn.splitbutton=function(_4,_5){
  18. if(typeof _4=="string"){
  19. var _6=$.fn.splitbutton.methods[_4];
  20. if(_6){
  21. return _6(this,_5);
  22. }else{
  23. return this.menubutton(_4,_5);
  24. }
  25. }
  26. _4=_4||{};
  27. return this.each(function(){
  28. var _7=$.data(this,"splitbutton");
  29. if(_7){
  30. $.extend(_7.options,_4);
  31. }else{
  32. $.data(this,"splitbutton",{options:$.extend({},$.fn.splitbutton.defaults,$.fn.splitbutton.parseOptions(this),_4)});
  33. $(this).removeAttr("disabled");
  34. }
  35. _1(this);
  36. });
  37. };
  38. $.fn.splitbutton.methods={options:function(jq){
  39. var _8=jq.menubutton("options");
  40. var _9=$.data(jq[0],"splitbutton").options;
  41. $.extend(_9,{disabled:_8.disabled,toggle:_8.toggle,selected:_8.selected});
  42. return _9;
  43. }};
  44. $.fn.splitbutton.parseOptions=function(_a){
  45. var t=$(_a);
  46. return $.extend({},$.fn.linkbutton.parseOptions(_a),$.parser.parseOptions(_a,["menu",{plain:"boolean",duration:"number"}]));
  47. };
  48. $.fn.splitbutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,menu:null,duration:100,cls:{btn1:"s-btn-active",btn2:"s-btn-plain-active",arrow:"s-btn-downarrow",trigger:"s-btn-downarrow"}});
  49. })(jQuery);