jquery.parser.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. $.parser={auto:true,onComplete:function(_1){
  14. },plugins:["draggable","droppable","resizable","pagination","tooltip","linkbutton","menu","menubutton","splitbutton","progressbar","tree","combobox","combotree","combogrid","numberbox","validatebox","searchbox","numberspinner","timespinner","calendar","datebox","datetimebox","slider","layout","panel","datagrid","propertygrid","treegrid","tabs","accordion","window","dialog"],parse:function(_2){
  15. var aa=[];
  16. for(var i=0;i<$.parser.plugins.length;i++){
  17. var _3=$.parser.plugins[i];
  18. var r=$(".easyui-"+_3,_2);
  19. if(r.length){
  20. if(r[_3]){
  21. r[_3]();
  22. }else{
  23. aa.push({name:_3,jq:r});
  24. }
  25. }
  26. }
  27. if(aa.length&&window.easyloader){
  28. var _4=[];
  29. for(var i=0;i<aa.length;i++){
  30. _4.push(aa[i].name);
  31. }
  32. easyloader.load(_4,function(){
  33. for(var i=0;i<aa.length;i++){
  34. var _5=aa[i].name;
  35. var jq=aa[i].jq;
  36. jq[_5]();
  37. }
  38. $.parser.onComplete.call($.parser,_2);
  39. });
  40. }else{
  41. $.parser.onComplete.call($.parser,_2);
  42. }
  43. },parseOptions:function(_6,_7){
  44. var t=$(_6);
  45. var _8={};
  46. var s=$.trim(t.attr("data-options"));
  47. if(s){
  48. if(s.substring(0,1)!="{"){
  49. s="{"+s+"}";
  50. }
  51. _8=(new Function("return "+s))();
  52. }
  53. if(_7){
  54. var _9={};
  55. for(var i=0;i<_7.length;i++){
  56. var pp=_7[i];
  57. if(typeof pp=="string"){
  58. if(pp=="width"||pp=="height"||pp=="left"||pp=="top"){
  59. _9[pp]=parseInt(_6.style[pp])||undefined;
  60. }else{
  61. _9[pp]=t.attr(pp);
  62. }
  63. }else{
  64. for(var _a in pp){
  65. var _b=pp[_a];
  66. if(_b=="boolean"){
  67. _9[_a]=t.attr(_a)?(t.attr(_a)=="true"):undefined;
  68. }else{
  69. if(_b=="number"){
  70. _9[_a]=t.attr(_a)=="0"?0:parseFloat(t.attr(_a))||undefined;
  71. }
  72. }
  73. }
  74. }
  75. }
  76. $.extend(_8,_9);
  77. }
  78. return _8;
  79. }};
  80. $(function(){
  81. var d=$("<div style=\"position:absolute;top:-1000px;width:100px;height:100px;padding:5px\"></div>").appendTo("body");
  82. $._boxModel=parseInt(d.width())==100;
  83. d.remove();
  84. if(!window.easyloader&&$.parser.auto){
  85. $.parser.parse();
  86. }
  87. });
  88. $.fn._outerWidth=function(_c){
  89. if(_c==undefined){
  90. if(this[0]==window){
  91. return this.width()||document.body.clientWidth;
  92. }
  93. return this.outerWidth()||0;
  94. }
  95. return this.each(function(){
  96. if($._boxModel){
  97. $(this).width(_c-($(this).outerWidth()-$(this).width()));
  98. }else{
  99. $(this).width(_c);
  100. }
  101. });
  102. };
  103. $.fn._outerHeight=function(_d){
  104. if(_d==undefined){
  105. if(this[0]==window){
  106. return this.height()||document.body.clientHeight;
  107. }
  108. return this.outerHeight()||0;
  109. }
  110. return this.each(function(){
  111. if($._boxModel){
  112. $(this).height(_d-($(this).outerHeight()-$(this).height()));
  113. }else{
  114. $(this).height(_d);
  115. }
  116. });
  117. };
  118. $.fn._scrollLeft=function(_e){
  119. if(_e==undefined){
  120. return this.scrollLeft();
  121. }else{
  122. return this.each(function(){
  123. $(this).scrollLeft(_e);
  124. });
  125. }
  126. };
  127. $.fn._propAttr=$.fn.prop||$.fn.attr;
  128. $.fn._fit=function(_f){
  129. _f=_f==undefined?true:_f;
  130. var t=this[0];
  131. var p=(t.tagName=="BODY"?t:this.parent()[0]);
  132. var _10=p.fcount||0;
  133. if(_f){
  134. if(!t.fitted){
  135. t.fitted=true;
  136. p.fcount=_10+1;
  137. $(p).addClass("panel-noscroll");
  138. if(p.tagName=="BODY"){
  139. $("html").addClass("panel-fit");
  140. }
  141. }
  142. }else{
  143. if(t.fitted){
  144. t.fitted=false;
  145. p.fcount=_10-1;
  146. if(p.fcount==0){
  147. $(p).removeClass("panel-noscroll");
  148. if(p.tagName=="BODY"){
  149. $("html").removeClass("panel-fit");
  150. }
  151. }
  152. }
  153. }
  154. return {width:$(p).width(),height:$(p).height()};
  155. };
  156. })(jQuery);
  157. (function($){
  158. var _11=null;
  159. var _12=null;
  160. var _13=false;
  161. function _14(e){
  162. if(e.touches.length!=1){
  163. return;
  164. }
  165. if(!_13){
  166. _13=true;
  167. dblClickTimer=setTimeout(function(){
  168. _13=false;
  169. },500);
  170. }else{
  171. clearTimeout(dblClickTimer);
  172. _13=false;
  173. _15(e,"dblclick");
  174. }
  175. _11=setTimeout(function(){
  176. _15(e,"contextmenu",3);
  177. },1000);
  178. _15(e,"mousedown");
  179. if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
  180. e.preventDefault();
  181. }
  182. };
  183. function _16(e){
  184. if(e.touches.length!=1){
  185. return;
  186. }
  187. if(_11){
  188. clearTimeout(_11);
  189. }
  190. _15(e,"mousemove");
  191. if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
  192. e.preventDefault();
  193. }
  194. };
  195. function _17(e){
  196. if(_11){
  197. clearTimeout(_11);
  198. }
  199. _15(e,"mouseup");
  200. if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
  201. e.preventDefault();
  202. }
  203. };
  204. function _15(e,_18,_19){
  205. var _1a=new $.Event(_18);
  206. _1a.pageX=e.changedTouches[0].pageX;
  207. _1a.pageY=e.changedTouches[0].pageY;
  208. _1a.which=_19||1;
  209. $(e.target).trigger(_1a);
  210. };
  211. if(document.addEventListener){
  212. document.addEventListener("touchstart",_14,true);
  213. document.addEventListener("touchmove",_16,true);
  214. document.addEventListener("touchend",_17,true);
  215. }
  216. })(jQuery);