jquery.splitbutton.js 1.4 KB

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