jquery.parser.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /**
  2. * EasyUI for jQuery 1.5.5.6
  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. $.easyui={indexOfArray:function(a,o,id){
  12. for(var i=0,_1=a.length;i<_1;i++){
  13. if(id==undefined){
  14. if(a[i]==o){
  15. return i;
  16. }
  17. }else{
  18. if(a[i][o]==id){
  19. return i;
  20. }
  21. }
  22. }
  23. return -1;
  24. },removeArrayItem:function(a,o,id){
  25. if(typeof o=="string"){
  26. for(var i=0,_2=a.length;i<_2;i++){
  27. if(a[i][o]==id){
  28. a.splice(i,1);
  29. return;
  30. }
  31. }
  32. }else{
  33. var _3=this.indexOfArray(a,o);
  34. if(_3!=-1){
  35. a.splice(_3,1);
  36. }
  37. }
  38. },addArrayItem:function(a,o,r){
  39. var _4=this.indexOfArray(a,o,r?r[o]:undefined);
  40. if(_4==-1){
  41. a.push(r?r:o);
  42. }else{
  43. a[_4]=r?r:o;
  44. }
  45. },getArrayItem:function(a,o,id){
  46. var _5=this.indexOfArray(a,o,id);
  47. return _5==-1?null:a[_5];
  48. },forEach:function(_6,_7,_8){
  49. var _9=[];
  50. for(var i=0;i<_6.length;i++){
  51. _9.push(_6[i]);
  52. }
  53. while(_9.length){
  54. var _a=_9.shift();
  55. if(_8(_a)==false){
  56. return;
  57. }
  58. if(_7&&_a.children){
  59. for(var i=_a.children.length-1;i>=0;i--){
  60. _9.unshift(_a.children[i]);
  61. }
  62. }
  63. }
  64. }};
  65. $.parser={auto:true,onComplete:function(_b){
  66. },plugins:["draggable","droppable","resizable","pagination","tooltip","linkbutton","menu","sidemenu","menubutton","splitbutton","switchbutton","progressbar","radiobutton","checkbox","tree","textbox","passwordbox","maskedbox","filebox","combo","combobox","combotree","combogrid","combotreegrid","tagbox","numberbox","validatebox","searchbox","spinner","numberspinner","timespinner","datetimespinner","calendar","datebox","datetimebox","slider","layout","panel","datagrid","propertygrid","treegrid","datalist","tabs","accordion","window","dialog","form"],parse:function(_c){
  67. var aa=[];
  68. for(var i=0;i<$.parser.plugins.length;i++){
  69. var _d=$.parser.plugins[i];
  70. var r=$(".easyui-"+_d,_c);
  71. if(r.length){
  72. if(r[_d]){
  73. r.each(function(){
  74. $(this)[_d]($.data(this,"options")||{});
  75. });
  76. }else{
  77. aa.push({name:_d,jq:r});
  78. }
  79. }
  80. }
  81. if(aa.length&&window.easyloader){
  82. var _e=[];
  83. for(var i=0;i<aa.length;i++){
  84. _e.push(aa[i].name);
  85. }
  86. easyloader.load(_e,function(){
  87. for(var i=0;i<aa.length;i++){
  88. var _f=aa[i].name;
  89. var jq=aa[i].jq;
  90. jq.each(function(){
  91. $(this)[_f]($.data(this,"options")||{});
  92. });
  93. }
  94. $.parser.onComplete.call($.parser,_c);
  95. });
  96. }else{
  97. $.parser.onComplete.call($.parser,_c);
  98. }
  99. },parseValue:function(_10,_11,_12,_13){
  100. _13=_13||0;
  101. var v=$.trim(String(_11||""));
  102. var _14=v.substr(v.length-1,1);
  103. if(_14=="%"){
  104. v=parseFloat(v.substr(0,v.length-1));
  105. if(_10.toLowerCase().indexOf("width")>=0){
  106. v=Math.floor((_12.width()-_13)*v/100);
  107. }else{
  108. v=Math.floor((_12.height()-_13)*v/100);
  109. }
  110. }else{
  111. v=parseInt(v)||undefined;
  112. }
  113. return v;
  114. },parseOptions:function(_15,_16){
  115. var t=$(_15);
  116. var _17={};
  117. var s=$.trim(t.attr("data-options"));
  118. if(s){
  119. if(s.substring(0,1)!="{"){
  120. s="{"+s+"}";
  121. }
  122. _17=(new Function("return "+s))();
  123. }
  124. $.map(["width","height","left","top","minWidth","maxWidth","minHeight","maxHeight"],function(p){
  125. var pv=$.trim(_15.style[p]||"");
  126. if(pv){
  127. if(pv.indexOf("%")==-1){
  128. pv=parseInt(pv);
  129. if(isNaN(pv)){
  130. pv=undefined;
  131. }
  132. }
  133. _17[p]=pv;
  134. }
  135. });
  136. if(_16){
  137. var _18={};
  138. for(var i=0;i<_16.length;i++){
  139. var pp=_16[i];
  140. if(typeof pp=="string"){
  141. _18[pp]=t.attr(pp);
  142. }else{
  143. for(var _19 in pp){
  144. var _1a=pp[_19];
  145. if(_1a=="boolean"){
  146. _18[_19]=t.attr(_19)?(t.attr(_19)=="true"):undefined;
  147. }else{
  148. if(_1a=="number"){
  149. _18[_19]=t.attr(_19)=="0"?0:parseFloat(t.attr(_19))||undefined;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. $.extend(_17,_18);
  156. }
  157. return _17;
  158. }};
  159. $(function(){
  160. var d=$("<div style=\"position:absolute;top:-1000px;width:100px;height:100px;padding:5px\"></div>").appendTo("body");
  161. $._boxModel=d.outerWidth()!=100;
  162. d.remove();
  163. d=$("<div style=\"position:fixed\"></div>").appendTo("body");
  164. $._positionFixed=(d.css("position")=="fixed");
  165. d.remove();
  166. if(!window.easyloader&&$.parser.auto){
  167. $.parser.parse();
  168. }
  169. });
  170. $.fn._outerWidth=function(_1b){
  171. if(_1b==undefined){
  172. if(this[0]==window){
  173. return this.width()||document.body.clientWidth;
  174. }
  175. return this.outerWidth()||0;
  176. }
  177. return this._size("width",_1b);
  178. };
  179. $.fn._outerHeight=function(_1c){
  180. if(_1c==undefined){
  181. if(this[0]==window){
  182. return this.height()||document.body.clientHeight;
  183. }
  184. return this.outerHeight()||0;
  185. }
  186. return this._size("height",_1c);
  187. };
  188. $.fn._scrollLeft=function(_1d){
  189. if(_1d==undefined){
  190. return this.scrollLeft();
  191. }else{
  192. return this.each(function(){
  193. $(this).scrollLeft(_1d);
  194. });
  195. }
  196. };
  197. $.fn._propAttr=$.fn.prop||$.fn.attr;
  198. $.fn._size=function(_1e,_1f){
  199. if(typeof _1e=="string"){
  200. if(_1e=="clear"){
  201. return this.each(function(){
  202. $(this).css({width:"",minWidth:"",maxWidth:"",height:"",minHeight:"",maxHeight:""});
  203. });
  204. }else{
  205. if(_1e=="fit"){
  206. return this.each(function(){
  207. _20(this,this.tagName=="BODY"?$("body"):$(this).parent(),true);
  208. });
  209. }else{
  210. if(_1e=="unfit"){
  211. return this.each(function(){
  212. _20(this,$(this).parent(),false);
  213. });
  214. }else{
  215. if(_1f==undefined){
  216. return _21(this[0],_1e);
  217. }else{
  218. return this.each(function(){
  219. _21(this,_1e,_1f);
  220. });
  221. }
  222. }
  223. }
  224. }
  225. }else{
  226. return this.each(function(){
  227. _1f=_1f||$(this).parent();
  228. $.extend(_1e,_20(this,_1f,_1e.fit)||{});
  229. var r1=_22(this,"width",_1f,_1e);
  230. var r2=_22(this,"height",_1f,_1e);
  231. if(r1||r2){
  232. $(this).addClass("easyui-fluid");
  233. }else{
  234. $(this).removeClass("easyui-fluid");
  235. }
  236. });
  237. }
  238. function _20(_23,_24,fit){
  239. if(!_24.length){
  240. return false;
  241. }
  242. var t=$(_23)[0];
  243. var p=_24[0];
  244. var _25=p.fcount||0;
  245. if(fit){
  246. if(!t.fitted){
  247. t.fitted=true;
  248. p.fcount=_25+1;
  249. $(p).addClass("panel-noscroll");
  250. if(p.tagName=="BODY"){
  251. $("html").addClass("panel-fit");
  252. }
  253. }
  254. return {width:($(p).width()||1),height:($(p).height()||1)};
  255. }else{
  256. if(t.fitted){
  257. t.fitted=false;
  258. p.fcount=_25-1;
  259. if(p.fcount==0){
  260. $(p).removeClass("panel-noscroll");
  261. if(p.tagName=="BODY"){
  262. $("html").removeClass("panel-fit");
  263. }
  264. }
  265. }
  266. return false;
  267. }
  268. };
  269. function _22(_26,_27,_28,_29){
  270. var t=$(_26);
  271. var p=_27;
  272. var p1=p.substr(0,1).toUpperCase()+p.substr(1);
  273. var min=$.parser.parseValue("min"+p1,_29["min"+p1],_28);
  274. var max=$.parser.parseValue("max"+p1,_29["max"+p1],_28);
  275. var val=$.parser.parseValue(p,_29[p],_28);
  276. var _2a=(String(_29[p]||"").indexOf("%")>=0?true:false);
  277. if(!isNaN(val)){
  278. var v=Math.min(Math.max(val,min||0),max||99999);
  279. if(!_2a){
  280. _29[p]=v;
  281. }
  282. t._size("min"+p1,"");
  283. t._size("max"+p1,"");
  284. t._size(p,v);
  285. }else{
  286. t._size(p,"");
  287. t._size("min"+p1,min);
  288. t._size("max"+p1,max);
  289. }
  290. return _2a||_29.fit;
  291. };
  292. function _21(_2b,_2c,_2d){
  293. var t=$(_2b);
  294. if(_2d==undefined){
  295. _2d=parseInt(_2b.style[_2c]);
  296. if(isNaN(_2d)){
  297. return undefined;
  298. }
  299. if($._boxModel){
  300. _2d+=_2e();
  301. }
  302. return _2d;
  303. }else{
  304. if(_2d===""){
  305. t.css(_2c,"");
  306. }else{
  307. if($._boxModel){
  308. _2d-=_2e();
  309. if(_2d<0){
  310. _2d=0;
  311. }
  312. }
  313. t.css(_2c,_2d+"px");
  314. }
  315. }
  316. function _2e(){
  317. if(_2c.toLowerCase().indexOf("width")>=0){
  318. return t.outerWidth()-t.width();
  319. }else{
  320. return t.outerHeight()-t.height();
  321. }
  322. };
  323. };
  324. };
  325. })(jQuery);
  326. (function($){
  327. var _2f=null;
  328. var _30=null;
  329. var _31=false;
  330. function _32(e){
  331. if(e.touches.length!=1){
  332. return;
  333. }
  334. if(!_31){
  335. _31=true;
  336. dblClickTimer=setTimeout(function(){
  337. _31=false;
  338. },500);
  339. }else{
  340. clearTimeout(dblClickTimer);
  341. _31=false;
  342. _33(e,"dblclick");
  343. }
  344. _2f=setTimeout(function(){
  345. _33(e,"contextmenu",3);
  346. },1000);
  347. _33(e,"mousedown");
  348. if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
  349. e.preventDefault();
  350. }
  351. };
  352. function _34(e){
  353. if(e.touches.length!=1){
  354. return;
  355. }
  356. if(_2f){
  357. clearTimeout(_2f);
  358. }
  359. _33(e,"mousemove");
  360. if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
  361. e.preventDefault();
  362. }
  363. };
  364. function _35(e){
  365. if(_2f){
  366. clearTimeout(_2f);
  367. }
  368. _33(e,"mouseup");
  369. if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
  370. e.preventDefault();
  371. }
  372. };
  373. function _33(e,_36,_37){
  374. var _38=new $.Event(_36);
  375. _38.pageX=e.changedTouches[0].pageX;
  376. _38.pageY=e.changedTouches[0].pageY;
  377. _38.which=_37||1;
  378. $(e.target).trigger(_38);
  379. };
  380. if(document.addEventListener){
  381. document.addEventListener("touchstart",_32,true);
  382. document.addEventListener("touchmove",_34,true);
  383. document.addEventListener("touchend",_35,true);
  384. }
  385. })(jQuery);