1// å è£ ççå¾ è½½å ¥ææã 2var isFF = navigator.userAgent.indexOf("Firefox")!=-1; 3var getLoad = { 4 setUrl : function(url,config){ 5 return function(fn){return typeof url!=='string' || !url ? alert('urlåæ°ç¼ºå¤±') : jQuery.ajax({ 6 url:url, 7 type:config.type || "POST", 8 dataType:config.process || "JSON", 9 timeout:50000, 10 data:config.data || {}, 11 beforeSend:function() { 12 loadBoard.open(); 13 }, 14 error:function() { 15 return loadBoard.close(),alert('æ°æ®å¼å¸¸'); 16 }, 17 success:function(data) { 18 loadBoard.close(); 19 jQuery.isFunction(fn) && fn(data,config); 20 } 21 }); 22 } 23 } 24} 25var dom = { 26 byId:function(s){ 27 return com.isString(s) ? document.getElementById(s) : null; 28 } 29 ,byTag:function(s){ 30 return com.isString(s) ? document.getElementsByTagName(s) : null; 31 } 32 ,byClass:function(s){ 33 return com.isString(s) ? function(o){ 34 if(document.getElementsClassName)return document.getElementsClassName(o); 35 var ele = dom.byTag('*'),bk=[]; 36 for(var i=0,l=ele.length;i<l;i++){ 37 ele[i].className == o && bk.push(ele[i]); 38 } 39 return bk; 40 }(s) : null; 41 } 42 ,domArr:function(o,cbk){ 43 if(!o)return []; 44 if(!cbk || !com.isFunction(cbk))return Array.prototype.slice.call(o); 45 var temp = []; 46 for(var i=0,l=o.length;i<l;i++){ 47 temp.push(cbk.call(null,o[i])); 48 } 49 return temp; 50 } 51 // 夿å è½½å®æ¯ï¼except:cssã 52 ,ifrIsReady:function(iframe,cbck,arg){ 53 if(!com.isFunction(cbck) || !iframe)return; 54 var arg = com.isArray(arg) ? arg : Array.prototype.slice.call(arguments,2); 55 if (window.attachEvent){ 56 iframe.onreadystatechange=function(){ 57 if(iframe.readyState == 'loaded' || iframe.readyState == 'complete'){cbck.apply(null,arg)} 58 } 59 } else { 60 iframe.onload = function(){cbck.apply(null,arg)}; 61 } 62 } 63 ,loadJs:function(url,cbk){ 64 if(!com.isString(url))return; 65 var server = document.createElement('script'); 66 server.src = url; 67 server.type = 'text/javascript'; 68 document.body.appendChild(server); 69 dom.ifrIsReady(server,cbk); 70 } 71 // 模æç»å®çå¬äºä»¶ã 72 ,bindLister : function(el,type,handle,arg){ 73 if(!el || !type ||!com.isFunction(handle))return; 74 var arg = com.isArray(arg) ? arg : Array.prototype.slice.call(arguments,3); 75 if(window.attachEvent){ 76 el.attachEvent('on'+type,function(){ 77 handle.apply(null,arg); 78 }) 79 }else if(window.addEventListerner){ 80 el.addEventListerner(type,function(){ 81 handle.apply(null,arg); 82 },false); 83 }else{ 84 el['on'+type] = function(){ 85 handle.apply(null,arg); 86 }; 87 } 88 } 89 ,stopPargation:function(){ 90 var e = window.event || arguments.callee.caller.arguments[0]; 91 if(e.stopPropagation){ 92 e.stopPropagation(); 93 }else{ 94 e.cancelBubble=true; 95 } 96 } 97} 98// \u4E00-\u9FA5 䏿æ£å 99var com = { 100 // éªè¯å½æ°ä¸çå®åå形忝å¦å¹é ï¼å¦æå¿ é¡»ä¸ä¸å¯¹åºæ¹å¯ä½¿ç¨ 101 ckArguments : function(){ 102 var undefined = void 0,o = arguments.callee.caller.arguments,f = arguments.callee.caller; 103 if(o === undefined || f===undefined || o.length!=f.length)return false; 104 for(var i=0,l=o.length;i<l;i++){ 105 if(!o[i])return false; 106 } 107 return true; 108 } 109 ,getType : function(o){ 110 return Object.prototype.toString.call(o).slice(8,-1); 111 } 112 // ææ°ç»æç §på¨ånå¨åçé¡ºåºæ¼æ¥æä¸ä¸ªå符串ã 113 ,warpSh:function(o,p,n){ 114 if(!top.com.isArray(o))return ''; 115 var p = top.com.isString(p) ? p : '',n = top.com.isString(n) ? n : ''; 116 return p+o.join(n+p)+n; 117 } 118 ,isArray : function(o){ 119 return this.getType(o)==='Array'; 120 } 121 ,isString : function(o){ 122 return typeof o === 'string'; 123 } 124 ,isFunction : function(o){ 125 return this.getType(o)==='Function'; 126 } 127 ,isNumber:function(o){ 128 return typeof o === 'number'; 129 } 130 // å·æ°æä¸ªå¸§ 131 ,frameFresh:function(i){ 132 window.frames[i].location.reload(1); 133 } 134 // 模æç»§æ¿ï¼ké»è®¤æ¯å¯è¦çï¼å¦æä¸éè¦è¦ç设置为trueçè¡¨è¾¾å¼ 135 ,extend : function(o,b,k){ 136 if(!o || !b)return; 137 var k = k === void 0 || !k; 138 for(var s in b){ 139 if(b.hasOwnProperty(s)){ 140 if(o[s]!=void 0) 141 { 142 if(k){o[s] = b[s];}else{continue;} 143 } 144 o[s] = b[s]; 145 } 146 } 147 } 148 // æå¯¹è±¡è§£ææurlåæ° 149 ,parseParam : function(o){ 150 if(!o)return ''; 151 var s=[]; 152 for(var k in o){ 153 o.hasOwnProperty(k) && s.push(k+'='+o[k]); 154 } 155 return s.join('&'); 156 } 157 // å éå¯¹è±¡ãæ°ç»å对象é½å¯ä»¥ã 158 ,cloneObject : function(o){ 159 if(!o)return o; 160 switch(Object.prototype.toString.call(o)){ 161 case '[object Array]': 162 var t = []; 163 for(var i=0,l=o.length;i<l;i++){ 164 t.push(arguments.callee(o[i])); 165 } 166 return t; 167 case '[object Object]': 168 var t = {}; 169 for(var k in o){ 170 if(o.hasOwnProperty(k)){ 171 t[k]= arguments.callee(o[k]); 172 } 173 } 174 return t; 175 default: 176 return o; 177 } 178 }
179 // å¾å°urlåæ°çæä¸ªå¼ï¼é»è®¤æ¯åå½åçwindow 180 ,getParam : function(k,w,str){ 181 if(!com.isString(k))return; 182 var w = w || window; 183 return new RegExp('[&\\?]\\??'+k+'=([^&]*)').test(com.isString(str) ? str : w.location.search) ? RegExp.$1 : null; 184 } 185 // 廿形å¦urlåæ°ä¸çæä¸ªé®å¼ã 186 ,delParam : function(str,k){ 187 if(!com.isString(str))return; 188 return str.replace(new RegExp('[&\\?]\\??'+k+'=[^&]*','img'),''); 189 } 190 // 设置形å¦urlåæ°çå符串ã 191 ,setParam : function(str,k,v){ 192 if(com.getParam(k,null,str)){ 193 str = com.delParam(str,k); 194 } 195 return str+='&'+k+'='+v; 196 } 197 // æurlåæ°ä¸çgetå¼è½¬åæobjectã 198 ,parseParam:function(w){ 199 var w = w || window,search = w.location.search,o={}; 200 search.replace(/(?:[?&])\w+=[^&]+/g,function(a){ 201 var t = a.slice(1).split('='); 202 o[t[0]]=t[1]; 203 }) 204 return o; 205 } 206 ,objLen:function(o){ 207 // å¯ç¨ä¸ä¸ªéå 彿° 208 var d = function(o,s){ 209 if(Object.prototype.toString.call(o)!='[object Object]')return 0; 210 // åå§åè¿ä¸ªid 211 (s===void 0 || s) && (arguments.callee.id=0); 212 for(var k in o){ 213 if(o.hasOwnProperty(k)){ 214 // èªå¢å 215 ++arguments.callee.id; 216 if(Object.prototype.toString.call(o)=='[object Object]'){ 217 // éå½è°ç¨ã 218 arguments.callee(o[k],0) 219 } 220 } 221 } 222 } 223 d(o); 224 return d.id; 225 } 226 ,backNum:function(o){ 227 if(o===void 0)return 0; 228 switch(typeof o){ 229 case 'number': 230 return o; 231 case 'string': 232 return o.charAt() == '-' ? -o.replace(/[^.\d]/g,'') : +o.replace(/[^.\d]/g,''); 233 default: 234 return +!!o; 235 } 236 } 237 // æç§è½¬æ¢æå°æ¶ï¼åï¼ç§ 238 ,showTime : function(t){ 239 if(!com.isNumber(t))return "00:00:00"; 240 var t = t .toString().charAt() == '-' ? t .toString().slice(1) : t; 241 h = t>=3600 ? Math.floor(t/3600) : 0, 242 m = (t - h * 60) >60 ? Math.floor((t - h * 3600)/60) : 0, 243 s = t - h * 3600 - m*60; 244 return (h ===0 ? "00" : (h<10?("0"+h):h)) +":"+(m === 0 ? "00" : (m<10?("0"+m):m))+":"+ (s === 0 ? "00" : (s<10?("0"+s):s)) ; 245 } 246 // ææ¶é´æ³è½¬åæç¹å®çå符串 247 ,microToDate : function(m,d){ 248 if(typeof m !== 'number' || m .toString().length!=13)return m; 249 var date = new Date(m), 250 ret, 251 config; 252 if(typeof d !== 'string')return date.toLocaleString(); 253 config = {'y':date.getFullYear(), 'm':date.getMonth()+1, 'd':date.getDate(), 'h':date.getHours(), 'i':date.getMinutes(), 's':date.getSeconds()}; 254 return d.replace(/[ymdhis]/ig, function(k){ 255 k = k.toLowerCase(); 256 return config[k] || k; 257 }); 258 } 259 // å è£ JQ对象ï¼å¤±è´¥æ 对象å为false 260 ,warpJq : function(f){ 261 if(!f)return false; 262 var form = f instanceof jQuery ? f : $(f); 263 return form.length ? form : false; 264 } 265} 266var tabSelect = function(tab,cont,opts){ 267 if(!tab || !cont || !opts)return; 268 var self = this; 269 this.content = null; 270 this.tab = com.warpJq(tab); 271 this.cont = com.warpJq(cont); 272 this.pTab = this.tab.eq(0); 273 // this.pCont = null; 274 this.opts = opts || {}; 275 this.tab[opts.mouseType || 'mouseenter'](function(){ 276 var temp = $(this); 277 self.pTab && com.isString(self.opts.outStyle) && self.pTab.removeClass(self.opts.inStyle).addClass(self.opts.outStyle); 278 self.opts.inStyle && temp.addClass(self.opts.inStyle); 279 // 妿æå¤ä¸ªå®¹å¨ï¼å°±ç´æ¥æ¾éè 280 if(self.cont.length>1){ 281 self.cont.hide(); 282 self.cont.eq(temp.index()).show(); 283 // self.pCont = self.cont.eq(temp.index()); 284 }else{ 285 // å¦æåªæä¸ä¸ªå°±éè¿opts.stillContentå»ææ°æ®
286 self.opts.cont.html(self.content[temp.index()] || (self.content[temp.index()] = self.opts.stillContent(temp.index()))); 287 } 288 self.pTab = temp; 289 290 }) 291} 292var marquee = function(board,eles,config){ 293 if(!board || !eles || !config || !config.prevBtn || !config.nextBtn){ 294 throw new Error('Arguments is missed'); 295 return; 296 } 297 var self = this, board = com.warpJq(board) , eles = com.warpJq(eles), 298 config = $.extend({ 299 disLine:"inline", 300 showMax:3 301 },config), 302 recordNum = eles.length - com.backNum(config.showMax), 303 recordEle = eles.eq(0), 304 maxSize=0,allWidth=0, 305 driect= config.disLine === "inline" ? "outerWidth" : "outerHeight" , 306 scroll = config.disLine === "inline" ? "left" : "top", 307 prevBtn = com.warpJq(config.prevBtn.btn),nextBtn = com.warpJq(config.nextBtn.btn), 308 // ä¸ä¸ä¸ªæé®çæ´»å¨æ ·å¼ 309 prevActive = config.prevBtn.active, 310 // ä¸ä¸ä¸ªå°å¤´äºçæ ·å¼ 311 prevDisable =config.prevBtn.disable, 312 // ä¸ä¸ä¸ªæé®çæ´»å¨æ ·å¼ 313 nextActive = config.nextBtn.active, 314 // ä¸ä¸ä¸ªå°å¤´äºçæ ·å¼ 315 nextDisable = config.nextBtn.disable; 316 317 if(!eles.length || !board.length){ 318 throw new Error('Arguments is invaild'); 319 return; 320 } 321 eles.each(function(){ 322 var self = $(this); 323 allWidth+=com.backNum(self[driect]())+(config.offset || 0); 324 if(self.index()<recordNum){ 325 maxSize+=com.backNum(self[driect]())+(config.offset || 0); 326 } 327 }); 328 board[config.disLine==='inline' ? 'width' : 'height'](100000000); 329 // åå§åå®¹å¨ 330 board.css(scroll,0); 331 if(eles.length <= config.showMax) return function(){ 332 prevBtn.removeClass(prevActive).addClass(prevDisable); 333 nextBtn.removeClass(nextActive).addClass(nextDisable); 334 }(); 335 com.isFunction(config.initFun) && config.initFun(board,eles); 336 // ä¸ä¸ä¸ªæé® 337 prevBtn && prevBtn.length && prevBtn.removeClass(prevActive).addClass(prevDisable).die().live("click",function(){ 338 var self = $(this); 339 nextBtn.removeClass(nextDisable).addClass(nextActive); 340 if(com.backNum(board.css(scroll))==0){ 341 self.removeClass(prevActive).addClass(prevDisable); 342 return false 343 } 344 board.css(scroll,com.backNum(board.css(scroll))+com.backNum(recordEle.prev()[driect]())+(config.offset || 0)); 345 com.isFunction(config.clickFun) && config.clickFun(); 346 return false; 347 }); 348 // ä¸ä¸ä¸ªæé® 349 nextBtn && nextBtn.length && nextBtn.removeClass(nextDisable).addClass(nextActive).die().live("click",function(){ 350 prevBtn.removeClass(prevDisable).addClass(prevActive); 351 var self = $(this); 352 353 if(com.backNum(board.css(scroll)) == -maxSize){ 354 self.removeClass(nextActive).addClass(nextDisable); 355 return false; 356 } 357 board.css(scroll,com.backNum(board.css(scroll))-com.backNum(recordEle.next()[driect]())-(config.offset || 0)); 358 recordEle = recordEle.next(); 359 return false; 360 }); 361} 362 363// 表åéªè¯æä»¶ 364// å®ä¹è¡¨åç±» 365function setForms(f){ 366 this.f = com.warpJq(f); 367 this.sign = true; 368}; 369// æ©å±è¿ä¸ªç±». 370setForms.prototype = { 371 // å¾å°å¯ä»¥æ¾å ¥ææ¬å¼çå ç´ 372 getInputData : function(){ 373 var form , self = this; 374 if(!(form = self.f))return false; 375 return form.find("select[name],textarea[name],"+(function(){ 376 var temp = '', 377 res = [], 378 types = [':checkbox[checked]',':radio[checked]',':text',':hidden',':password']; 379 while(temp = types.pop()){ 380 res.push('input[name]'+temp); 381 } 382 return res.join(','); 383 })()); 384 } 385 // ç»å®äºä»¶ã 386 ,bindFromEvent : function(fn){ 387 var form , self = this , db; 388 if(!(form = self.f) || !(db=self.getInputData()) || !Object.prototype.toString.call(fn)=='[Object Function]')return false; 389 db.filter(function(){ 390 var s = $(this);
391 if(this.tagName != 'INPUT' || (this.type && /^text|password$/.test(this.type)))return s; 392 }).each(function(){ 393 var s = this; 394 s['on'+(s.tagName=="SELECT" ? "change" : "blur")] = function(){ 395 fn(s); 396 } 397 }); 398 } 399 // æè¡¨åéçå ç´ å ¨é¨è½¬å为json 400 ,getDataJson : function(){ 401 var form , self = this , db; 402 if(!(form = self.f) || !(db=self.getInputData()))return false; 403 var val ={}; 404 db.each(function(){ 405 val[this.getAttribute('name')]=this.value; 406 }); 407 return val; 408 } 409 // éªè¯è¡¨åéçå¼çåæ³æ§ï¼åªéè¦å¨è¡¨åå ç´ ä¸å å ¥ä¸ä¸ªregexpçèªå®ä¹å±æ§å³å¯,å¦æè¦æç¤ºä¿¡æ¯ï¼å°±å¨infoé设置ã 410 ,checkKindsDb : function(fn){ 411 var form, self = this, db, sign = true; 412 self.sign=true; 413 if(!(form = self.f) || !(db=self.getInputData(form)))return false; 414 db.each(function(){ 415 var sel = this; 416 if(sel.getAttribute("regexp") && !new RegExp(sel.getAttribute("regexp")).test(sel.value)){ 417 self.sign = false; 418 return Object.prototype.toString.call(fn) =='[object Function]' && fn(sel),false; 419 420 } 421 }) 422 return self.sign; 423 } 424} 425 426 427// æä½cookie 428var cookie = { 429 // 设置cookie 430 setCookie:function(a,b,o){ 431 if(typeof a !=='string' || typeof b !=='string')return false; 432 var str = ''; 433 if(o){ 434 for(var k in o){ 435 if(o.hasOwnProperty(k))str+=';'+k+'='+o[k]+'='; 436 } 437 str = str.slice(0,-1); 438 } 439 document.cookie = a+'='+encodeURIComponent(b)+str; 440 } 441 // å¾å°cookie 442 ,getCookie:function(b){ 443 if(typeof b !=='string')return ''; 444 var c = new RegExp('(?:^|;\\s?)'+b+'=([^;]*)'); 445 return c.test(document.cookie) ? decodeURIComponent(RegExp.$1) : ''; 446 } 447 // å é¤cookie 448 ,delCookie:function(b){ 449 if(typeof b !== 'string')return false; 450 document.cookie = b+'=;expires=-1'; 451 } 452} 453// çå¾ è£ è½½ä¸ææ. 454var loadBoard = { 455 board : null 456 ,open : function(){ 457 if(this.board)return; 458 var body = top.document.documentElement || top.document.body, 459 width = body.clientWidth, 460 height = body.clientHeight, 461 offset = top.document.documentElement.scrollTop 462 div = top.document.createElement('div'); 463 div.style.position = 'absolute'; 464 div.style.width = '40px'; 465 div.style.height = '40px'; 466 div.style.zIndex = 100000; 467 div.style.left = (width - 40) / 2 + 'px'; 468 div.style.top = (height - 40) / 2 + offset + 'px'; 469 div.innerHTML = '<img src="'+urls.resource_url+'/gta_common/images/load.gif">'; 470 top.document.body.appendChild(div); 471 this.board = div; 472 } 473 ,close:function(){ 474 if(!this.board)return; 475 top.document.body.removeChild(this.board); 476 this.board = null; 477 } 478}; 479 480// å¤å¶n份å符串 481String.prototype.c=function(n,fn){ 482 return new Array(++n).join(Object.prototype.toString.call(fn)=='[object Function]' ? fn(this.toString()) : this.toString()); 483} 484// æ¿æ¢å符串 485String.prototype.s=function(r,v){ 486 return this.toString().replace(new RegExp('%='+r+'%','img'),v); 487} 488String.prototype.include = function(o){ 489 if(!o)return false; 490 var self = this.toString(); 491 switch(Object.prototype.toString.call(o).slice(8,-1)){ 492 case 'Array': 493 return new RegExp('(^|_)'+self+'(_|$)').test(o.join('_')); 494 case 'String': 495 return self.indexOf(o)>-1; 496 case 'Object': 497 return o[self]!=void 0; 498 default: 499 return false; 500 } 501} 502String.prototype.limitLeft = function(n,add){ 503 var str = this.toString(); 504 if(typeof n != 'number')return ; 505 var temp = str.slice(0,n),old = str,rl; 506 if((rl=temp.replace(/[\u4E00-\u9FA5]/g,11).length) < n) return str; 507 temp.replace(/[\u4E00-\u9FA5]/g,function(){ 508 rl-=1.5; 509 }); 510 return str.slice(0,Math.ceil(rl))+(add || ''); 511} 512// éåæ°ç» 513Array.prototype.m=function(fn,i){ 514 for(var i=0,l=this.length;i<l;i++){ 515 com.isFunction(fn) && (this[i] = fn(this[i],i)); 516 } 517} 518// è¿ç»æ¨éæ°æ®å°æ°ç» 519Array.prototype.spush=function(s){ 520 this.push(s); 521 return this; 522} 523Array.prototype.fliter = function(o){ 524 var gt = com.getType(o); 525 for(var i=0,l=this.length;i<l;i++){ 526 switch(gt){ 527 case 'String': 528 this[i]==o && this.splice(i,1); 529 break; 530 case 'Number': 531 i==o && this.splice(i,1); 532 break; 533 case 'Array': 534 for(var k=0,n=o.length;k<n;k++){ 535 this[i]==o[k] && this.splice(i,1); 536 } 537 break; 538 default: 539 continue; 540 } 541 } 542 return this; 543} 544function require(){ 545 var ar = com.isArray(argument[0]) ? argument[0] : Array.prototype.slice.call(arguments), 546 s = ar.pop(),jsFrame; 547 if(!com.isString(s))return; 548 jsFrame = document.createElement('script'); 549 jsFrame.src = s; 550 jsFrame.type='text/javascript'; 551 (document.body || document.documentElement).append(jsFrame); 552 com.ifrIsReady(jsFrame,require,ar); 553} 554function require_once(){ 555 // å¾å°åæ°ï¼å¹¶è½¬åæarray 556 var far = com.isArray(argument[0]) ? argument[0] : Array.prototype.slice.call(arguments), 557 // è¿æ»¤æå·²ç»åå¨ççscriptæ ç¾ 558 ar = far.fliter(dom.domArr(document.getElementsByTagName('script'),function(o){return o.src;})); 559 require(ar); 560} 561$.fn.extend({ 562 roll:function(board,drag,offset,button,direct){ 563 564 if(!this instanceof jQuery || this.length!=1 || !board || !drag)return; 565 var self = this , board = $(board) , drag = $(drag), 566 line,padding,ipadding,moveDirect; 567 drag.attr('drag',false).css('position','absolute'); 568 direct=="inline" ? function(){ 569 line = "outerWidth",ipadding = "width" , moveDirect = "left"; 570 }() : function(){ 571 line = "outerHeight",ipadding = "height" , moveDirect = "top"; 572 }(), 573 record = null; 574 var margin = com.backNum(drag[ipadding]())/2; 575 if(!drag.length || !board.length)return; 576 drag.mousedown(function(e){ 577 // æè·ç¦ç¹ 578 if(this.setCapture){ 579 this.setCapture(); 580 }else if(window.captureEvents){ 581 window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP); 582 } 583 // ç»å®ææ½ 584 $(this).bind('mousemove',function(e){ 585 // åå»å触åç»å®äºä»¶ 586 var record = moveDirect == "left" ? e.pageX : e.pageY, 587 val = record-offset.min-margin; 588 if(val<offset.min || val>offset.max)return; 589 drag.css(moveDirect,val); 590 var ratio = (val-offset.min)/(offset.max-offset.min); 591 board.css(moveDirect,-ratio * (com.backNum(board[line]()) - $(self)[ipadding]())); 592 }); 593 }).mouseup(function(e){ 594 // éæ¾ç¦ç¹ã 595 if(this.releaseCapture){ 596 this.releaseCapture(); 597 }else if(window.captureEvents){ 598 window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); 599 } 600 // è§£é¤ç»å® 601 $(this).unbind('mousemove'); 602 }); 603 // ç¹å»åä¸ï¼ä¸ç§» 604 function setTop(s){ 605 if(com.backNum(drag.css(moveDirect))<=offset.min){ 606 window.recordTimer && window.clearInterval(window.recordTimer); 607 return false;
608 } 609 var temp = com.backNum(drag.css(moveDirect))-s, 610 val = temp >= offset.min ? temp : offset.min, 611 ratio = (val - offset.min)/(offset.max-offset.min); 612 drag.css(moveDirect,val); 613 board.css(moveDirect,-ratio * (com.backNum(board[line]()) - $(self)[ipadding]())); 614 return false; 615 } 616 function setBom(s){ 617 if(com.backNum(drag.css(moveDirect))>=offset.max){ 618 window.recordTimer && window.clearInterval(window.recordTimer); 619 return false; 620 } 621 console.log(s); 622 var temp = com.backNum(drag.css(moveDirect))+s, 623 val = temp <= offset.max ? temp : offset.max, 624 ratio = (val-offset.min)/(offset.max-offset.min); 625 drag.css(moveDirect,val); 626 board.css(moveDirect,-ratio * (com.backNum(board[line]()) - $(self)[ipadding]())); 627 return false; 628 } 629 isFF || new mousewheel(board[0]).bindEvent(function(){ 630 setTop(30); 631 },function(){ 632 setBom(30); 633 }).init(); 634 button && button.top && $(button.top).mousedown(function(){ 635 window.recordTimer = window.setInterval(setTop,100); 636 return false; 637 }).mouseup(function(){ 638 window.clearInterval(window.recordTimer); 639 return false; 640 }); 641 // ç¹å»åä¸ï¼ä¸ç§» 642 button && button.bottom && $(button.bottom).mousedown(function(){ 643 window.recordTimer = window.setInterval(function(){setBom(1)},100); 644 }).mouseup(function(){ 645 window.clearInterval(window.recordTimer); 646 }); 647 } 648 // å åæé® 649 ,numberAddReduce : function(board,add,reduce,config){ 650 if(!this instanceof jQuery || this.length!=1)return false; 651 var self = this , board = $(board,self),add = $(add,self), reduce = $(reduce,self); 652 if(board.length<0 || add.length<0 || reduce.length<0)return false; 653 var sck = /^input|textarea$/i.test(board[0].tagName) ? "val":"html"; 654 function ckBorder(m,v,s){ 655 if(typeof v!="number")return 0; 656 var s = s===void 0 || s; 657 return s ? m ? v>m ? 0 : 1 : 1 : m ? v<m ? 0 : 1 : 1; 658 } 659 add.unbind("click").click(function(){ 660 ckBorder((config && config.max),com.backNum(+board[sck?"val":"html"]())+1) && (board[sck](com.backNum(+board[sck?"val":"html"]())+1),$.isFunction(config.callBack) && config.callBack(board,"add")); 661 return false; 662 }); 663 reduce.unbind("click").click(function(){ 664 ckBorder((config && config.min),com.backNum(+board[sck?"val":"html"]())-1,0) && (board[sck](com.backNum(+board[sck?"val":"html"]())-1),$.isFunction(config.callBack) && config.callBack(board,"reduce")); 665 return false; 666 }) 667 } 668}); 669 670function SWFObject(swf,fid,width,height){ 671 var self = this; 672 var isie = document.all; 673 this.attr = {"allowScriptAccess":"always","quality":"high","movie":swf}; 674 self.addParam = function(key,val){ 675 self.attr[key] = val; 676 return self; 677 } 678 self.write = function(concatiner){ 679 var attrStr = ''; 680 $.each(self.attr,function(n,v){ 681 attrStr+='<param name="'+n+'" value="'+v+'" />'; 682 }); 683 if(isie){ 684 attrStr+='<embed allowScriptAccess="always" src="'+swf+'" quality="high" pluginspage="//www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" name="'+fid+'"></embed>'; 685 var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'" id="'+fid+'">'+attrStr+'</object>'; 686 }else{ 687 var html = '<object type="application/x-shockwave-flash" data="'+swf+'?v=111" width="'+width+'" height="'+height+'" id="'+fid+'" name="'+fid+'">'+attrStr+'</object>'; 688 } 689 $(concatiner).html(html); 690 } 691 return self; 692} 693function backFrame(o){ 694 var o = com.warpJq(o); 695 if(!o.length)return; 696 var leftOffset = o.offset().left+'px', 697 topOffset = o.offset().top+'px', 698 zIndex = o.css('zIndex')-1, 699 width = o.outerWidth() + 'px', 700 height = o.outerHeight() + 'px', 701 iframe = $('<iframe frameborder="0" \ 702 style="overflow:hidden; \ 703 position:absolute; \ 704 background:#fff; \ 705 z-index:'+zIndex+'; \ 706 width:'+width+'; \ 707 height:'+height+'; \ 708 left:'+leftOffset+'; \ 709 top:'+topOffset+'; \ 710 display:none" src="about:blank"></iframe>').appendTo(top.document.body || top.document.documentElement); 711 return iframe; 712} 713function background(o){ 714 var o = o || {}, 715 zIndex = o.zindex || 999999, 716 width = Math.max(document.body.clientWidth || document.documentElement.clientWidth) + 'px', 717 height = Math.max(document.body.clientHeight,document.documentElement.clientHeight) + 'px', 718 iframe = !$('#backgroundBoardId').length ? $('<iframe id="backgroundBoardId" scrolling="no" frameborder="0" \ 719 style="overflow:hidden; \ 720 position:fixed; \ 721 background:#000; \ 722 z-index:'+zIndex+'; \ 723 width:'+width+'; \ 724 left:0; \ 725 top:0; \ 726 height:'+height+'; \ 727 display:none" src="'+urls.resource_url+'/gta_common/js/bck.htm"></iframe>').appendTo(document.body || document.documentElement).css('opacity',(o.opacity || .7)) 728 : $('#backgroundBoardId').css({width:width,height:height}); 729 return iframe; 730} 731function autoMarquee(container,movetag,opts){ 732 if(!container || !movetag || !(this.container = com.warpJq(container)).length){ 733 // æåºå¼å¸¸ã 734 throw new Error('autoMarqueeåæ°ä¸å ¨'); 735 }; 736 737 this.recordIndexRule = {}; //æ¥å卿¯æ¬¡è¦ç§»å¨å¤å°ä¸ªåç´ ç¹. 738 (this.container = com.warpJq(container)).css('position')=='static' && this.container.css('position','absolute'); //åå§å 739 this.movetag = $(movetag,this.container); 740 this.timer = true; 741 this.turn = true; 742 this.opts = opts || {}; 743 var self = this, 744 per = this.opts.per || 1, 745 index = 0, //ç§»å¨çæé 746 max = Math.ceil(this.movetag.length / per), //计ç®è¦æ»å¨å 次. 747 getHeight = 0, //临æ¶åé,ä¸»è¦æ¯æ¥è®¡ç®æ¯æ¬¡è¦æ»å¨å¤å°ä¸ªåç´ ç. 748 initTop = this.container.css('top'); //è®°å½åå§ä½ç½®. 749 for(var i=0;i<max;i++){ 750 getHeight = 0; 751 // åå§åæ¯æ¬¡éè¦æ»å¨å¤å°åç´ ã 752 this.movetag.slice(index*per,(index+1)*per).each(function(){ 753 getHeight+=+$(this).outerHeight(); 754 }); 755 self.recordIndexRule[i] = getHeight; 756 } 757 this.run = function(){ 758 if(self.movetag.length<=per)return; 759 // 妿å°å¤´äº 760 if(index>=max-1){ 761 // åå§åéè¦è®°å½æ»å¨æ°æ®çæé 762 index=0; 763 self.container.css('top',initTop); 764 } 765 // å¼å§æ»å¨ 766 self.container.animate({top:com.backNum(self.container.css('top')) - self.recordIndexRule[index]},(self.opts.hps || 1) * 1000,function(){ 767 ++index; 768 self.turn && self.start(); 769 }); 770 }; 771 this.start = function(){ 772 var self = this; 773 self.turn =true; 774 self.timer = setTimeout(function(){ 775 self.run(); 776 },(self.opts.fps || 1) * 1000); 777 // this.run(); 778 } 779 this.stop = function(){ 780 this.turn =false; 781 this.timer && clearInterval(this.timer); 782 } 783} 784Date.prototype.getDaysInMonth = function(){ 785 return (new Date(this.getFullYear(),+this.getMonth()+1,0,0,0,0,0) - new Date(this.getFullYear(),this.getMonth(),0,0,0,0,0))/(24*60*60*1000); 786} 787Date.prototype.getWeekDays = function(){ 788 return this.getWeekDay ? this.getWeekDay() : 'æ¥ä¸äºä¸åäºå '.charAt(this.getDay()); 789} 790 791 792 793// é¼ æ æ»è½®äºä»¶ 794 795/*EXï¼ 796 new mousewheel(board).bindEvent(function(){ 797 console.log('up'); 798 },function(){ 799 console.log('down'); 800 }).init();
801*/ 802function mousewheel(dom){ 803 if(!dom){ 804 throw new Error('arguments is invalid'); 805 return; 806 } 807 var self = this; 808 self.dom = dom; 809 // ç»å®ä¸ä¸ç§»å¨äºä»¶ 810 self.bindEvent = function(up,down){ 811 com.isFunction(up) && (self.up = up); 812 com.isFunction(down) && (self.down = down); 813 return this; 814 } 815 // æ»è½®äºä»¶è§¦åååçå¨ä½ã 816 function selfEvent(){ 817 var eve = window.event || arguments[0]; 818 mov = (eve.wheelDelta || eve.detail) > 0 ? 'up' : 'down'; 819 self[mov] && self[mov](self.dom); 820 } 821 // åå§åã 822 self.init = function(){ 823 var rollEve = navigator.userAgent.indexOf("Firefox")==-1 ? 'mousewheel' : 'DOMMouseScroll'; 824 self.dom.addEventListener ? 825 self.dom.addEventListener(rollEve,selfEvent,false) : 826 (self.dom.onmousewheel = selfEvent); 827 } 828} 829var fade = { 830 record:null, 831 index:0, 832 timer : null, 833 ftimer : 3000, 834 init : function(pic,tab,opts){ 835 if(!pic || !tab)return; 836 this.pic = $(pic); 837 this.tab = $(tab); 838 this.count = this.tab.length; 839 this.opts = opts || {}; 840 opts.ftimer && (this.ftimer = opts.ftimer); 841 com.isFunction(opts.ready) && opts.ready(this); 842 this.tab[opts.type || 'mouseenter'](function(){ 843 var self = $(this); 844 fade.index = self.index(); 845 fade.pic.stop(true); 846 fade.selecte(self); 847 fade.timer && clearInterval(fade.timer); 848 }).mouseleave(function(){ 849 fade.autoPlay(); 850 }); 851 return this; 852 }, 853 selecte: function(o){ 854 if(!o)return; 855 fade.record && $.isFunction(this.opts.out) && this.opts.out(fade.record,this); 856 $.isFunction(this.opts.over) && this.opts.over(o,this); 857 fade.record = o; 858 }, 859 play:function(){ 860 if(fade.index>=fade.count) fade.index = 0; 861 this.selecte(fade.tab.eq(fade.index)); 862 }, 863 autoPlay:function(){ 864 fade.timer = setInterval(function(){ 865 ++fade.index; 866 fade.play(); 867 },fade.ftimer); 868 } 869} 870// eleå¾ççæ ç¾ï¼sizeå°±æ¯ç¨æ¥éå®å¾çç尺寸ãå¦æåªæ§å¶å®½å°±ç¨{width:123},é«å°±ç¨{height:130},宽é«å°±ç¨{width:123,height:130} 871function autoSizePic(ele,size,cbk){ 872 if(!ele || !com.isString(ele.src) || !size){
873 throw new Error('arguments is invalid'); 874 return; 875 } 876 var src = ele.src; 877 img = new Image(); 878 img.onload = function(){ 879 var hold,other; 880 if(size.width && size.height){ 881 hold = this.width>this.height ? 'width' : 'height'; 882 }else if(size.width){ 883 hold = 'width'; 884 }else{ 885 hold = 'height'; 886 } 887 other = hold == 'width' ? 'height' : 'width'; 888 if(+size[hold]<+this[hold] || (size[other] && +size[other]<+this[other])){ 889 var otherSize = size[hold] * this[other] / this[hold],one = size[hold],image = this; 890 size[other] && otherSize > size[other] && -function(){ 891 otherSize = size[other]; 892 one = image[hold] * otherSize / image[other]; 893 }() 894 ele.style[hold] = one + 'px'; 895 ele.style[other] = otherSize + 'px'; 896 com.isFunction(cbk) && cbk(ele); 897 } 898 } 899 img.onerror = function(){ 900 throw new Error('å¾ç'+src+'å 载失败'); 901 } 902 img.src = src; 903} 904 905// éªè¯èº«ä»½è¯å·ç æ£ç¡®æ§ã 906function checkIdCardNo(idcard) { 907 if(idcard.length!=15 && idcard.length!=18) return false; 908 var area = [11,12,13,14,15,21,22,23,31,32,33,34,35,36,37,41,42,43,44,45,46,50,51,52,53,54,61,62,63,64,65]; 909 var areaCode = idcard.substr(0,2); 910 var areaok = false; 911 for(i=0;i<area.length;i++){ 912 if(areaCode==area[i]){ 913 areaok = true; 914 break; 915 } 916 } 917 if(!areaok) return false; 918 var now = new Date(); 919 var nowYear = now.getFullYear(); 920 //身份å·ç 使°åæ ¼å¼æ£éª 921 switch(idcard.length){ 922 case 15: 923 var birthYear = 1900+parseInt(idcard.substr(6,2)); 924 var birthDay = idcard.substr(8,4); 925 break; 926 case 18: 927 var birthYear = parseInt(idcard.substr(6,4)); 928 var birthDay = idcard.substr(10,4); 929 //è®¡ç®æ ¡éªä½ 930 S = (parseInt(idcard.substr(0,1)) + parseInt(idcard.substr(10,1))) * 7 931 + (parseInt(idcard.substr(1,1)) + parseInt(idcard.substr(11,1))) * 9 932 + (parseInt(idcard.substr(2,1)) + parseInt(idcard.substr(12,1))) * 10 933 + (parseInt(idcard.substr(3,1)) + parseInt(idcard.substr(13,1))) * 5 934 + (parseInt(idcard.substr(4,1)) + parseInt(idcard.substr(14,1))) * 8 935 + (parseInt(idcard.substr(5,1)) + parseInt(idcard.substr(15,1))) * 4 936 + (parseInt(idcard.substr(6,1)) + parseInt(idcard.substr(16,1))) * 2 937 + parseInt(idcard.substr(7,1)) * 1 938 + parseInt(idcard.substr(8,1)) * 6 939 + parseInt(idcard.substr(9,1)) * 3 ; 940 Y = S % 11; 941 M = "F"; 942 JYM = "10X98765432"; 943 M = JYM.substr(Y,1);//å¤ææ ¡éªä½ 944 if(M.toLowerCase() != idcard.substr(17,1).toLowerCase()) return false; //æ£æµIDçæ ¡éªä½ 945 break; 946 default: 947 return false; 948 } 949 if(birthYear>nowYear || birthYear<nowYear-120) return false; 950 if((birthYear % 4 == 0 && birthYear % 100!=0) || (birthYear % 100==0 && birthYear % 4 == 0 )){ 951 ereg=/^((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))$/;//æµè¯åºçæ¥æçåæ³æ§ 952 } else { 953 ereg=/^((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))$/;//æµè¯åºçæ¥æçåæ³æ§ 954 } 955 if(ereg.test(birthDay)) return true; 956 else return false; 957}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.