You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
20 KiB
1 lines
20 KiB
var g_db={SupportLocalStorage:function(){"use strict";return typeof localStorage!="undefined"},SetItem:function(n,t){"use strict";var i=!1;return this.SupportLocalStorage()&&(localStorage.setItem(n,t),i=!0),i},GetItem:function(n){"use strict";var t=null;return this.SupportLocalStorage()&&(t=localStorage.getItem(n)),t},RemoveItem:function(n){"use strict";var t=!1;return this.SupportLocalStorage()&&(localStorage.removeItem(n),t=!0),t},GetDic:function(n){"use strict";var i=null,t;return this.SupportLocalStorage()&&(t=localStorage.getItem(n),null!==t&&(i=JSON.parse(t))),i},SetDic:function(n,t){"use strict";var i=!1;return this.SupportLocalStorage()&&(localStorage.setItem(n,JSON.stringify(t)),i=!0),i}},g_gd={webapilonginurl:"/api/Service/GetLogin",webapiurl:"/api/Cmd/GetData",projectname:"Eurotran",projectver:"Origtek",orgid:"TE",userid:"EUROTRAN",relpath:"",debugmode:window.location.host==="192.168.1.105",debugcolor:"#732C6B",IsEDU:g_db.GetItem("isedu")==="true"},g_ul={GetToken:function(){"use strict";return g_db.GetItem("token")},SetToken:function(n){"use strict";g_db.SetItem("token",n)},GetSignature:function(){"use strict";return g_db.GetItem("signature")},SetSignature:function(n){"use strict";g_db.SetItem("signature",n)},SetLang:function(n){"use strict";g_db.SetItem("lang",n)},GetLang:function(){"use strict";return g_db.GetItem("lang")},IsEDU:function(){"use strict";return g_db.GetItem("isedu")}},g_api={ConnectLite:function(n,t,i,r,u,f,e){return window.IsWaiting=e,this.ConnectLiteWithoutToken(n,t,i,r,u,f)},ConnectService:function(n,t,i,r,u,f,e){return window.IsWaiting=e,this.ConnectWebLiteWithoutToken(n,t,i,r,u,f)},ConnectLiteWithoutToken:function(n,t,i,r,u,f){var o={},e={},s=g_ul.GetToken(),h=g_ul.GetLang(),c=g_ul.GetSignature();return e.ORIGID=g_gd.orgid,e.USERID=g_gd.userid,e.MODULE=n,e.TYPE=t,e.PROJECT=g_gd.projectname,e.PROJECTVER=g_gd.projectver,e.TRACEDUMP=null,i=i||{},g_db.GetItem("dblockDict")!==null&&(i.dblockDict=g_db.GetItem("dblockDict")),e.DATA=i,h!==null&&(e.LANG=h),s!==null&&(e.TOKEN=s),c!==null&&(e.SIGNATURE=c),e.CUSTOMDATA={},window.sProgramId&&(e.CUSTOMDATA.program_id=sProgramId),e.CUSTOMDATA.module_id="WebSite",o.url=i.hasOwnProperty("url")?i.url:g_gd.webapiurl,o.successfunc=r,o.dicparameters=e,o.failfunc="function"==typeof u?u:function(n,t,i){alert("ConnectLite Fail jqXHR:"+n+" textStatus:"+t+" errorThrown:"+i)},o.useasync="boolean"==typeof f?f:!0,this.AjaxPost(o)},ConnectWebLiteWithoutToken:function(n,t,i,r,u,f){var o={},e={},s=g_ul.GetToken(),h=g_ul.GetLang(),c=g_ul.GetSignature();return e.ORIGID=g_gd.orgid,e.USERID=g_gd.userid,e.MODULE="",e.TYPE=t,e.PROJECT=g_gd.projectname,e.PROJECTVER=g_gd.projectver,e.TRACEDUMP=null,g_db.GetItem("dblockDict")!==null&&(i.dblockDict=g_db.GetItem("dblockDict")),e.DATA=i,h!==null&&(e.LANG=h),s!==null&&(e.TOKEN=s),c!==null&&(e.SIGNATURE=c),e.CUSTOMDATA={},window.sProgramId&&(e.CUSTOMDATA.program_id=sProgramId),e.CUSTOMDATA.module_id="WebSite",o.url=getWebServiceUrl(n,t),o.successfunc=r,o.dicparameters=e,o.failfunc="function"==typeof u?u:function(n,t,i){alert("ConnectLite Fail jqXHR:"+n+" textStatus:"+t+" errorThrown:"+i)},o.useasync="boolean"==typeof f?f:!0,this.AjaxPost(o)},AjaxPost:function(n){"use strict";var t=$.extend({useasync:!0,successfunc:null,failfunc:null,alwaysfunc:null,url:null,dicparameters:null},n),i=function(n){n.RESULT===-1||t.successfunc&&t.successfunc(n)};return $.ajax({type:"POST",url:t.url,data:"="+btoa2(encodeURIComponent(JSON.stringify(t.dicparameters))),success:i,error:t.failfunc,beforeSend:function(n){var i=g_ul.GetToken(),r=$.now(),u=rndnum();n.setRequestHeader("orgid",t.dicparameters.ORIGID);n.setRequestHeader("userid",t.dicparameters.USERID);n.setRequestHeader("token",i);n.setRequestHeader("timestamp",r);n.setRequestHeader("nonce",u)},async:!0!==t.useasync?!1:!0}).always(t.alwaysfunc)}};(function(n,t,r){function o(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b){var k=i18next.t("message.Tips")||'<span data-i18n="message.Tips"><\/span>',d;toastr.options={debug:l,newestOnTop:a,progressBar:v,positionClass:y||"toast-top-center",preventDuplicates:p,onclick:null};w&&(toastr.options.onclick=b);i&&(toastr.options.showDuration=i);r&&(toastr.options.hideDuration=r);u&&(toastr.options.timeOut=u);f&&(toastr.options.extendedTimeOut=f);e&&(toastr.options.showEasing=e);o&&(toastr.options.hideEasing=o);s&&(toastr.options.showMethod=s);h&&(toastr.options.hideMethod=h);c&&(toastr.options.tapToDismiss=!1);d=toastr[n](t,k)}function s(){var n=location.origin+"/";return window.location.origin||(gWebUrl=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")),n}function h(){showWaiting(typeof IsWaiting=="string"?IsWaiting:undefined)}function c(){closeWaiting();setTimeout(function(){IsWaiting=null},3e3)}if(t.gWebUrl=window.location.origin||s(),t.gServerUrl="http://localhost:3466","www.eurotran.com.tw|www.g-yi.com.cn".indexOf(window.location.hostname)>-1?t.gServerUrl="https://www.eurotran.com:9001":"www.origtek.com".indexOf(window.location.hostname)>-1?t.gServerUrl="https://www.origtek.com:8106":"192.168.1.105".indexOf(window.location.hostname)>-1&&(t.gServerUrl="https://192.168.1.105:9001"),window.location.pathname.indexOf("/TG/")>-1?g_gd.orgid="TG":window.location.pathname.indexOf("/SG/")>-1&&(g_gd.orgid="SG"),t.ComFn={GetOrgInfo:"GetOrgInfo",GetSysSet:"GetSysSet",GetArguments:"GetArguments",GetNewsCount:"GetNewsCount",GetNewsPage:"GetNewsPage",GetExhibitionPage:"GetExhibitionPage",GetNewsInfo:"GetNewsInfo",GetFileList:"GetUploadFiles"},t.Service={apiappcom:"Common",apite:"TEAPI",apitg:"TGAPI",apiwebcom:"Com"},t.onerror=function(n,t,i,r){console.log(t+" line:"+i+" colno:"+r+" "+n);parent.SysSet&&parent.SysSet.IsOpenMail==="Y"&&g_api.ConnectLite("Log","ErrorMessage",{ErrorSource:t,Errorlineno:i,Errorcolno:r,ErrorMessage:n},function(n){n.RESULT})},t.runByOrgInfo=function(n,t){t=t||!1;var i=g_db.GetDic("OrgInfo");!i||t?g_api.ConnectLite(Service.apiwebcom,ComFn.GetOrgInfo,{},function(t){t.RESULT&&(i=t.DATA.rel,g_db.SetDic("OrgInfo",i),typeof n=="function"&&n(i))}):typeof n=="function"&&n(i)},t.IsWaiting=null,t.transLang=function(t){i18next="undefined"==typeof i18next?parent.i18next:i18next;var i=t===undefined?n("[data-i18n]"):t.find("[data-i18n]"),r=t===undefined?n("[placeholderid]"):t.find("[placeholderid]");i.each(function(t,i){var u=n(i).attr("data-i18n"),r;u&&(r=i18next.t(u),i.nodeName=="INPUT"&&i.type=="button"?n(i).val(r):n(i).html(r))});r.each(function(t,i){var r=n(i).attr("placeholderid"),u;r&&(u=i18next.t(r),u!==r&&n(i).attr("placeholder",u))})},t.setLang=function(t,i,r){t&&(g_ul.SetLang(t),i18next="undefined"==typeof i18next?parent.i18next:i18next,n.getJSON(gServerUrl+"/Scripts/lang/"+(g_gd.orgid||"TE")+"/"+t+".json",function(n){var u={};u[t]={translation:n};i18next.init({lng:t,resources:u,useLocalStorage:!1,localStorageExpirationTime:864e5},function(n,t){transLang(i);typeof r=="function"&&r(t)})}).error(function(){g_api.ConnectLite("Language","CreateLangJson",{},function(n){n.RESULT&&setLang(t,i,r)})}))},t.showWaiting=function(i){n.blockUI({message:n('<div id="Divshowwaiting"><img src="/images/ajax_loading2.gif">'+(i||"Waiting...")+"<\/div>"),css:{"font-size":navigator.userAgent.match(/mobile/i)?"20px":"36px",border:"0px","border-radius":"10px","background-color":"#FFF",padding:"15px 15px",opacity:.5,color:"orange",cursor:"wait","z-index":1000000001},baseZ:1e9});t.setTimeout(n.unblockUI,6e4)},t.closeWaiting=function(t){n(function(){t==undefined&&(t=100);setTimeout(n.unblockUI,t)})},t.Jsonremove=function(t,i,r){return n.grep(t,function(n){return n[i]!=r})},t.Jsonget=function(t,i,r){return n.grep(t,function(n){return n[i]==r})},t.Tostr=function(n){return JSON.stringify(n)},t.DownLoadFile=function(n,t){var i=gServerUrl+"/Controller.ashx";i+="?action=downfile&path="+n;t&&(i+="&filename="+t);window.location.href=i;closeWaiting()},t.reFreshInput=function(t){t.find("[disabled]").each(function(){n(this).attr("hasdisable",1).removeAttr("disabled")})},t.reSetInput=function(t){t.find("[hasdisable]").each(function(){n(this).removeAttr("hasdisable").prop("disabled",!0)})},t.getFormSerialize=function(n,t){var i={};return reFreshInput(n),i=t?n.serializeJSON():n.serializeObject(),reSetInput(n),i},t.getUrlParam=function(n){var i=new RegExp("(^|&)"+n+"=([^&]*)(&|$)"),t=window.location.search.substr(1).match(i);return t!=null?unescape(t[2]):null},t.encodeURL=function(n){return encodeURIComponent(n).replace(/\'/g,"%27").replace(/\!/g,"%21").replace(/\(/g,"%28").replace(/\)/g,"%29")},t.decodeURL=function(n){return decodeURIComponent(n)},t.newDate=function(n,t,i){var r="";return n?(typeof n=="string"?(r=n.replace("T"," ").replaceAll("-","/"),r.indexOf(".")>-1&&(r=r.slice(0,r.indexOf(".")))):r=new Date(n),r=new Date(r)):i||(r=new Date),r===""?"":t?r.formate("yyyy/MM/dd"):r.formate("yyyy/MM/dd HH:mm")},t.guid=function(){var n=new Uint16Array(8),i=window.crypto||window.msCrypto,t=function(n){for(var t=n.toString(16);t.length<4;)t="0"+t;return t};return i.getRandomValues(n),t(n[0])+t(n[1])+"-"+t(n[2])+"-"+t(n[3])+"-"+t(n[4])+"-"+t(n[5])+t(n[6])+t(n[7])},rndnum=function(n){var i="",t;for(n=n||10,t=0;t<n;t++)i+=Math.floor(Math.random()*10);return i},t.stopBubble=function(n){n&&n.stopPropagation?n.stopPropagation():window.event.cancelBubble=!0},t.stopDefault=function(n){return n&&n.preventDefault?n.preventDefault():window.event.returnValue=!1,!1},t.createOptions=function(t,i,r,u,f,e){var s,h,c,o,l;if(e==e||!0,t=t||[],s=[],h=[],typeof t=="number")for(c=t;t>0;)o=c-t+1,o=n.trim(o),s.push(n("<option />",{value:o,title:o,html:o})),t--;else s=[n("<option />",{value:"",html:"請選擇..."})],l=t.length,l>0&&n.each(t,function(t,o){if(e!==!1||h.indexOf(n.trim(o[i]))<0&&e===!1){var c=n("<option />",{value:n.trim(o[i]),title:n.trim(o[r]),html:(u?n.trim(o[i])+"-":"")+n.trim(o[r])});f&&c.attr(f,o[f]);s.push(c)}h.push(n.trim(o[i]))});return n("<div />").append(s).html()},t.createRadios=function(t,i,r,u,f){t=t||[];var e="",o=t.length;return o>0&&n.each(t,function(t,o){var s=n("<input />",{type:"radio",id:u+"_"+t,name:u,value:n.trim(o[i])}).attr("val",n.trim(o[i]));e+='<label for="'+u+"_"+t+'">'+s[0].outerHTML+((f?n.trim(o[i])+"-":"")+n.trim(o[r]))+"<\/label>"}),e},t.createCheckList=function(t,i,r,u,f){t=t||[];var e="",o=t.length;return o>0&&n.each(t,function(t,s){var h=n("<input />",{type:"checkbox",id:i+(f===undefined?"":f)+"_"+t,name:u+"[]",value:n.trim(s[i]),"class":"input-mini"});e+="<label for='"+i+(f===undefined?"":f)+"_"+t+"' style='"+(o==t+1?"":"float:left;")+"padding-left: 10px'>"+h[0].outerHTML+n.trim(s[r])+"<\/label>"}),e},t.getJsonVal=function(n,t){for(var i=n,u=t.split("_"),r=0;r<u.length;r++){if(!i[u[r]]){i="";break}i=i[u[r]]}return i},t.setFormVal=function(t,i){t.find("[name]").each(function(){var u=this.id,e=this.name?this.name.replace("[]",""):"",o=this.type,t=i[e]||getJsonVal(i,u)||"",r,f;if(t){switch(o){case"text":case"email":case"url":case"number":case"range":case"date":case"search":case"color":case"textarea":case"select-one":case"select":case"hidden":r=n(this).attr("data-type");r&&r=="pop"?(f=i[e+"Name"]||t,n(this).attr("data-value",t),f&&n(this).val(f)):(n(this).hasClass("date-picker")?t=newDate(t,"date"):(n(this).hasClass("date-picker")||n(this).hasClass("datetime-picker")||n(this).hasClass("date"))&&(t=newDate(t)),t&&n(this).val(t),n(this).data("old",t),r&&r=="int"&&t&&n(this).attr("data-value",t.toString().replace(/[^\d.]/g,"")));r==="select2"&&n(this).trigger("change");break;case"checkbox":typeof t=="object"?t.indexOf(this.value)>-1&&(this.checked=t):this.checked=typeof t=="string"?t==this.value:t;break;case"radio":this.checked=this.value===t}(u=="ModifyUser"||u=="CreateUser")&&"select-one".indexOf(this.type)===-1?n(this).text(t):(u=="ModifyDate"||u=="CreateDate")&&n(this).text(newDate(t))}})},t.Trim=function(n,t){var i;return i=n.replace(/(^\s+)|(\s+$)/g,""),t.toLowerCase()=="g"&&(i=i.replace(/\s/g,"")),i},t.clone=function(n){var i,t,r;if(typeof n!="object"||n===null)return n;if(n instanceof Array)for(i=[],t=0,r=n.length;t<r;t++)i[t]=typeof n[t]=="object"&&n[t]!=null?arguments.callee(n[t]):n[t];else{i={};for(t in n)i[t]=typeof n[t]=="object"&&n[t]!=null?arguments.callee(n[t]):n[t]}return i},t.moneyInput=function(t,i,r){if(t.length>0){var u=new FormatNumber;t.each(function(){for(var f=this.value,e="",t=0;t<f.length;t++)isNaN(f[t])||(e+=f[t]);this.value==e;u.init({trigger:n(this),decimal:i||0,minus:r||!1})})}},t.keyIntp=function(n,t,i){if(n.keyCode!=8&&n.keyCode!=37&&n.keyCode!=39&&n.keyCode!=46)t.value=t.value.replace(/[^\d.-]/g,""),t.value=t.value.replace(/\.{2,}/g,"."),t.value=t.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."),t.value=t.value.replace({1:/^(\-)*(\d+)\.(\d).*$/,2:/^(\-)*(\d+)\.(\d\d).*$/,3:/^(\-)*(\d+)\.(\d\d\d).*$/}[i],"$1$2.$3"),t.value.indexOf(".")<0&&t.value!==""&&t.value!=="-"&&(t.value=t.value.indexOf("-")===0?0-parseFloat(t.value.replace("-","")):parseFloat(t.value))},t.fnGetWebSiteSetting=function(n,t,i,r,u,f){var e={SetType:t,LangId:i};return r&&(e.ParentId=r),u&&(e.HasChild=u),f&&(e.Single=f),g_api.ConnectLite(Service.apiwebcom,"GetWebSiteSetting",e,function(t){t.RESULT&&typeof n=="function"&&n(t.DATA.rel)})},t.fnGetWebSiteSettingPage=function(n){return g_api.ConnectLite(Service.apiwebcom,"GetWebSiteSettingPage",n,function(t){t.RESULT&&typeof n.CallBack=="function"&&n.CallBack(t.DATA.rel)})},t.goToJys=function(t,i){n("html,body").animate({scrollTop:t.offset().top+(i||0)},500)},t.goTop=function(){var t=n("<div>",{"class":"gotop",html:'<img src="../images/gotop_1.png" />',click:function(){return n("body,html").animate({scrollTop:0},120),!1}});n("body").append(t.hide());n(window).on("scroll",function(){var i=(n(r).height(),n(this).scrollTop()),u=-40;i>0?t.show():t.hide();i>40?(u=i-80,n("#Toolbar").addClass("toolbar-float").removeClass("toolbar-fix")):n("#Toolbar").removeClass("toolbar-float").addClass("toolbar-fix");n("#Toolbar").css("margin-top",u+"px")})},t.getExplorer=function(){var n="",t=window.navigator.userAgent;t.indexOf("MSIE")>=0?n="ie":t.indexOf("Firefox")>=0?n="firefox":t.indexOf("Chrome")>=0?n="chrome":t.indexOf("Opera")>=0?n="opera":t.indexOf("Safari")>=0&&(n="safari")},t.fMoney=function(n,t,r){var e=t>0&&t<=20?t:2;r&&r==="NTD"&&(n=Math.round(n));n=parseFloat(((n||0)+"").replace(/[^\d\.-]/g,"")).toFixed(e)+"";var u=n.split(".")[0].split("").reverse(),o=n.split(".")[1]||Array(t+1).join(0),f="";for(i=0;i<u.length;i++)f+=u[i]+((i+1)%3==0&&i+1!=u.length?",":"");return f.split("").reverse().join("")+(t===0?"":"."+o)},t.keyInput=function(){if(n("[data-keyint]").length>0)n("[data-keyint]").on("keyup blur",function(){this.value=this.value.replace(/\D/g,"")});if(n("[data-keyeng]").length>0)n("[data-keyeng]").on("keyup blur",function(){this.value=this.value.replace(/[^a-zA-Z]/g,"")});if(n("[data-keyeng]").length>0)n("[data-keyeng]").on("keyup blur",function(){this.value=this.value.replace(/[^\u4E00-\u9FA5]/g,"")});if(n("[data-keytelno]").length>0)n("[data-keytelno]").on("keyup blur",function(n){n.keyCode!=8&&n.keyCode!=37&&n.keyCode!=39&&n.keyCode!=46&&(this.value=this.value.replace(/[^0-9\-\+\#\ ]/g,""))});if(n("[data-keyintg]").length>0)n("[data-keyintg]").on("keyup blur",function(){this.value=this.value.replace(/[^0-9\-\+\#]/g,"")});if(n("[data-keyintp1]").length>0)n("[data-keyintp1]").on("keyup blur",function(n){keyIntp(n,this,1)});if(n("[data-keyintp2]").length>0)n("[data-keyintp2]").on("keyup blur",function(n){keyIntp(n,this,2)});if(n("[data-keyintp3]").length>0)n("[data-keyintp3]").on("keyup blur",function(n){keyIntp(n,this,3)});if(n("[data-keyeng]").length>0)n("[data-keyeng]").on("keyup blur",function(){this.value=this.value.replace(/[^\a-\z\A-\Z]/g,"")});if(n("[data-keyinteng]").length>0)n("[data-keyinteng]").on("keyup blur",function(){this.value=this.value.replace(/[^0-9\a-\z\A-\Z\_]/g,"")});if(n("[data-keycneng]").length>0)n("[data-keycneng]").on("keyup blur",function(){this.value=this.value.replace(/[/d]/g,"")});if(n("[data-keymemberid]").length>0)n("[data-keymemberid]").on("keyup blur",function(){this.value=this.value.replace(/[^\w\.\/]/ig,"")})},t.isEmail=function(n){return/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(n)?!0:!1},t.showMsg=function(n,t){var t=t||"info";o(t,n,"300","1000","3000","1000","swing","linear","fadeIn","fadeOut",!1,!1,!0,!1,"toast-edit-center",!0,!0,null)},!t.browser){var f=navigator.userAgent.toLowerCase(),u;window.browser={};function e(){return"ActiveXObject"in window}u||(u=f.match(/chrome\/([\d.]+)/),u!=null&&(window.browser.name="chrome",window.browser.version=u[1]));u||(u=f.match(/firefox\/([\d.]+)/),u!=null&&(window.browser.name="firefox",window.browser.version=u[1]));u||(u=f.match(/opera.([\d.]+)/),u!=null&&(window.browser.name="opera",window.browser.version=u[1]));u||(u=f.match(/safari\/([\d.]+)/),u!=null&&(window.browser.name="safari",window.browser.version=u[1]));u||(f.match(/msie ([\d.]+)/)!=null?(u=f.match(/msie ([\d.]+)/),window.browser.name="ie",window.browser.version=u[1]):(e()&&!!r.attachEvent&&function(){"use strict";return!this}()&&(window.browser.name="ie",window.browser.version="10"),e()&&!r.attachEvent&&(window.browser.name="ie",window.browser.version="11")));n.isIE||n.extend({isIE:function(){return window.browser.name=="ie"}});n.isChrome||n.extend({isChrome:function(){return window.browser.name=="chrome"}});n.isFirefox||n.extend({isFirefox:function(){return window.browser.name=="firefox"}});n.isOpera||n.extend({isOpera:function(){return window.browser.name=="opera"}});n.isSafari||n.extend({isSafari:function(){return window.browser.name=="safari"}})}n.datepicker!==undefined&&(n.datepicker.regional["zh-TW"]={dayNames:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayNamesMin:["日","一","二","三","四","五","六"],monthNames:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthNamesShort:["01","02","03","04","05","06","07","08","09","10","11","12"],prevText:"上月",nextText:"次月",weekHeader:"週",showMonthAfterYear:!0,dateFormat:"yy/mm/dd"},n.datepicker.setDefaults(n.datepicker.regional["zh-TW"]));n(r).ajaxStart(h).ajaxStop(c)})(jQuery,window,document);Date.prototype.dateAdd=function(n,t){var r=this,i={y:"FullYear",q:"Month",m:"Month",w:"Date",d:"Date",h:"Hours",n:"Minutes",s:"Seconds",ms:"MilliSeconds"};return eval("r.set"+i[n]+"(r.get"+i[n]+"()+"+({q:3,w:7}[n]||1)*t+")"),r};Date.prototype.diff=function(n){return(this.getTime()-n.getTime())/864e5};Date.prototype.formate=function(n){var i={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12==0?12:this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()},t;/(y+)/.test(n)&&(n=n.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));/(E+)/.test(n)&&(n=n.replace(RegExp.$1,(RegExp.$1.length>1?RegExp.$1.length>2?"星期":"周":"")+{"0":"日","1":"一","2":"二","3":"三","4":"四","5":"五","6":"六"}[this.getDay()+""]));for(t in i)new RegExp("("+t+")").test(n)&&(n=n.replace(RegExp.$1,RegExp.$1.length==1?i[t]:("00"+i[t]).substr((""+i[t]).length)));return n};String.prototype.replaceAll=function(n,t){return this.replace(new RegExp(n,"gm"),t)};String.prototype.toPoint=function(){return this.replace("%","")/100};String.prototype.toMoney=Number.prototype.toMoney=function(){return this.toString().replace(/\d+?(?=(?:\d{3})+$)/g,function(n){return n+","})};String.prototype.toFloat=Number.prototype.toFloat=function(n){n=n?parseInt(n):0;var t=this;return n<=0?Math.round(t):Math.round(t*Math.pow(10,n))/Math.pow(10,n)};Array.prototype.clear=function(){for(var t=[],n=0;n<this.length;n++)this[n]&&t.push(this[n]);return t};Array.prototype.insert=function(n,t){this.splice(n,0,t)};jQuery.whenArray=function(n){return jQuery.when.apply(this,n)};
|