jquery.mobile.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /**
  2. * EasyUI for jQuery 1.6.10
  3. *
  4. * Copyright (c) 2009-2018 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. $.fn.navpanel=function(_1,_2){
  12. if(typeof _1=="string"){
  13. var _3=$.fn.navpanel.methods[_1];
  14. return _3?_3(this,_2):this.panel(_1,_2);
  15. }else{
  16. _1=_1||{};
  17. return this.each(function(){
  18. var _4=$.data(this,"navpanel");
  19. if(_4){
  20. $.extend(_4.options,_1);
  21. }else{
  22. _4=$.data(this,"navpanel",{options:$.extend({},$.fn.navpanel.defaults,$.fn.navpanel.parseOptions(this),_1)});
  23. }
  24. $(this).panel(_4.options);
  25. });
  26. }
  27. };
  28. $.fn.navpanel.methods={options:function(jq){
  29. return $.data(jq[0],"navpanel").options;
  30. }};
  31. $.fn.navpanel.parseOptions=function(_5){
  32. return $.extend({},$.fn.panel.parseOptions(_5),$.parser.parseOptions(_5,[]));
  33. };
  34. $.fn.navpanel.defaults=$.extend({},$.fn.panel.defaults,{fit:true,border:false,cls:"navpanel"});
  35. $.parser.plugins.push("navpanel");
  36. })(jQuery);
  37. (function($){
  38. $(function(){
  39. $.mobile.init();
  40. });
  41. $.mobile={defaults:{animation:"slide",direction:"left",reverseDirections:{up:"down",down:"up",left:"right",right:"left"}},panels:[],init:function(_6){
  42. $.mobile.panels=[];
  43. var _7=$(_6||"body").children(".navpanel:visible");
  44. if(_7.length){
  45. _7.not(":first").children(".panel-body").navpanel("close");
  46. var p=_7.eq(0).children(".panel-body");
  47. $.mobile.panels.push({panel:p,animation:$.mobile.defaults.animation,direction:$.mobile.defaults.direction});
  48. }
  49. $(document).unbind(".mobile").bind("click.mobile",function(e){
  50. var a=$(e.target).closest("a");
  51. if(a.length){
  52. var _8=$.parser.parseOptions(a[0],["animation","direction",{back:"boolean"}]);
  53. if(_8.back){
  54. $.mobile.back();
  55. e.preventDefault();
  56. }else{
  57. var _9=$.trim(a.attr("href"));
  58. if(/^#/.test(_9)){
  59. var to=$(_9);
  60. if(to.length&&to.hasClass("panel-body")){
  61. $.mobile.go(to,_8.animation,_8.direction);
  62. e.preventDefault();
  63. }
  64. }
  65. }
  66. }
  67. });
  68. $(window).unbind(".mobile").bind("hashchange.mobile",function(){
  69. var _a=$.mobile.panels.length;
  70. if(_a>1){
  71. var _b=location.hash;
  72. var p=$.mobile.panels[_a-2];
  73. if(!_b||_b=="#&"+p.panel.attr("id")){
  74. $.mobile._back();
  75. }
  76. }
  77. });
  78. },nav:function(_c,to,_d,_e){
  79. if(window.WebKitAnimationEvent){
  80. _d=_d!=undefined?_d:$.mobile.defaults.animation;
  81. _e=_e!=undefined?_e:$.mobile.defaults.direction;
  82. var _f="m-"+_d+(_e?"-"+_e:"");
  83. var p1=$(_c).panel("open").panel("resize").panel("panel");
  84. var p2=$(to).panel("open").panel("resize").panel("panel");
  85. p1.add(p2).bind("webkitAnimationEnd",function(){
  86. $(this).unbind("webkitAnimationEnd");
  87. var p=$(this).children(".panel-body");
  88. if($(this).hasClass("m-in")){
  89. p.panel("open").panel("resize");
  90. }else{
  91. p.panel("close");
  92. }
  93. $(this).removeClass(_f+" m-in m-out");
  94. });
  95. p2.addClass(_f+" m-in");
  96. p1.addClass(_f+" m-out");
  97. }else{
  98. $(to).panel("open").panel("resize");
  99. $(_c).panel("close");
  100. }
  101. },_go:function(_10,_11,_12){
  102. _11=_11!=undefined?_11:$.mobile.defaults.animation;
  103. _12=_12!=undefined?_12:$.mobile.defaults.direction;
  104. var _13=$.mobile.panels[$.mobile.panels.length-1].panel;
  105. var to=$(_10);
  106. if(_13[0]!=to[0]){
  107. $.mobile.nav(_13,to,_11,_12);
  108. $.mobile.panels.push({panel:to,animation:_11,direction:_12});
  109. }
  110. },_back:function(){
  111. if($.mobile.panels.length<2){
  112. return;
  113. }
  114. var p1=$.mobile.panels.pop();
  115. var p2=$.mobile.panels[$.mobile.panels.length-1];
  116. var _14=p1.animation;
  117. var _15=$.mobile.defaults.reverseDirections[p1.direction]||"";
  118. $.mobile.nav(p1.panel,p2.panel,_14,_15);
  119. },go:function(_16,_17,_18){
  120. _17=_17!=undefined?_17:$.mobile.defaults.animation;
  121. _18=_18!=undefined?_18:$.mobile.defaults.direction;
  122. location.hash="#&"+$(_16).attr("id");
  123. $.mobile._go(_16,_17,_18);
  124. },back:function(){
  125. history.go(-1);
  126. }};
  127. $.map(["validatebox","textbox","passwordbox","filebox","searchbox","combo","combobox","combogrid","combotree","combotreegrid","datebox","datetimebox","numberbox","spinner","numberspinner","timespinner","datetimespinner"],function(_19){
  128. if($.fn[_19]){
  129. $.extend($.fn[_19].defaults,{iconWidth:28,tipPosition:"bottom"});
  130. }
  131. });
  132. $.map(["spinner","numberspinner","timespinner","datetimespinner"],function(_1a){
  133. if($.fn[_1a]){
  134. $.extend($.fn[_1a].defaults,{iconWidth:56,spinAlign:"horizontal"});
  135. }
  136. });
  137. if($.fn.menu){
  138. $.extend($.fn.menu.defaults,{itemHeight:30,noline:true});
  139. }
  140. })(jQuery);