PageSourceSearch

https://static.xycloud.com/www/assets/js/util.js

js xycloud.com collected 2026-10-09 17:03:53 UTC 29,609 bytes, 931 lines download raw bytes

1/**
2 * $util
3 * 前端公共方法和参数
4 * by 赵鹏 [email protected]
5 * Released on: March 21, 2018
6 *
7 */
8
9$.extend({
10    util: {
11
12        /*
13         * @Name 测试专用函数
14         * @Param
15         * @Return
16         * @Author [email protected]
17         * @Readme
18         */
19        lemonTest :function(){
20            console.log('lemon test');
21        },
22
23        /*
24         * @Name 深度克隆
25         * @Param
26         * @Return
27         * @Author [email protected]
28         * @Readme
29         */
30        deepClone: function(obj){
31            let newobj
32            if(typeof obj !== 'object' || !obj){
33                return obj;
34            }else {
35                newobj = obj.constructor === Array ? [] : {};
36                for(let i in obj){
37                    newobj[i] = typeof obj[i] === 'object' ? this.deepClone(obj[i]) : obj[i];
38                }
39            }
40            return newobj;
41        },
42
43        /*
44         * @Name 去掉字符串两边空格
45         * @Param
46         * @Return
47         * @Author [email protected]
48         * @Readme
49         */
50        trimSpace: function(str){
51            if (str === undefined){
52                return false;
53            };
54
55            var rule = /(^\s*)|(\s*$)/g;
56            var res = str.replace(rule,"");
57            return res;
58        },
59
60        /*
61         * @Name 去掉字符串两边换行
62         * @Param
63         * @Return
64         * @Author [email protected]
65         * @Readme
66         */
67        trimWrap: function(str){
68            if (str === undefined){
69                return false;
70            };
71
72            var rule = /(^\n*)|(\n*$)/g;
73            var res = str.replace(rule,"");
74            return res;
75        },
76
77        /*
78         * @Name 生成随机数
79         * @Param
80         * @Return
81         * @Author [email protected]
82         * @Readme 生成min~max的随机数
83         */
84        generateRandomNum: function(max,min){
85            if (!max || !min){
86                console.log("必须传入max和min")
87                return false;
88            };
89
90            let num = Math.floor(Math.random()*(max-min+1)+min);
91            return num;
92        },
93
94        /*
95         * @Name "1234567890.42545" 转化成 1,234,567,890.43
96         * @Param
97         * @Return
98         * @Author [email protected]
99         * @Readme https://segmentfault.com/a/1190000002884224
100         */
101        thousandStringFormat: function(num, digit){
102            var num = Number(num);
103            var numFormat = "";
104            var REG = /(\d)(?=(?:\d{3})+$)/g;
105
106            //要保留小数
107            if (digit && digit !== 0 ){
108                num = num.toFixed(digit);
109                var numList = num.split(".");
110                var integerPart = numList[0];
111                var decimalPart = numList[1];
112                numFormat = integerPart.replace(REG, '$1,') + "." + decimalPart;
113            }
114            else{
115                numFormat = num.toFixed(0).replace(REG, '$1,');
116            }
117                            //a.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
118            return numFormat;
119        },
120
121        /*
122         * @Name jquery.serializeArray获取到的Array转化成对象格式
123         * @Param
124         * @Return
125         * @Author [email protected]
126         * @Readme
127         */
128        ArrayDataFormatter: function(originData){
129            var dataObj = {};
130            if (!originData){
131                console.log("必须传入originData!")
132                return false;
133            };
134
135            originData.forEach(function(item,index,array){
136                var name = item.name;
137                var value = item.value;
138                dataObj[name] = value;
139            });
140            return dataObj;
141        },
142
143        /*
144         * @Name 设置表单中的错误提示
145         * @Param
146         * @Return
147         * @Author [email protected]
148         * @Readme
149         */
150        showInputTip: function(type,containerId,tipId,msg){
151            if (!containerId || !tipId){
152                console.log("showInputTip 必须传入containerId和tipId ")
153                return false;
154            };
155            var type = (type)?type:"info";
156            var msg = (msg)?msg:"default error";
157            var containerClass = "";
158            var containerClassMap = {
159                "info": "",
160                "error": "inpbox-err",
161                "success": "",
162            };
163            containerClass = containerClassMap[type];
164            $(containerId).addClass(containerClass);
165            $(tipId).text(msg);
166            $(tipId).slideDown(300);
167        },
168
169        /*
170         * @Name 隐藏表单中的错误提示
171         * @Param
172         * @Return
173         * @Author [email protected]
174         * @Readme
175         */
176        hideInputTip: function(type,containerId,tipId){
177            if (!containerId || !tipId){
178                console.log("hideInputTip 必须传入containerId和tipId ")
179                return false;
180            };
181            var type = (type)?type:"info";
182            var containerClass = "";
183            var containerClassMap = {
184                "info": "",
185                "error": "inpbox-err",
186                "success": "",
187            };
188            containerClass = containerClassMap[type];
189            $(containerId).removeClass(containerClass);
190            $(tipId).slideUp(300);
191        },
192
193        /*
194         * @Name 禁用button
195         * @Param
196         * @Return
197         * @Author [email protected]
198         * @Readme
199         */
200        disableButton: function(buttonId){
201            if (!buttonId){
202                console.log("disableButton 必须传入buttonId ")
203                return false;
204            };
205
206            $(buttonId).addClass("btn-disable");
207            $(buttonId).attr("disabled","true");
208        },
209
210        /*
211         * @Name 启用button
212         * @Param
213         * @Return
214         * @Author [email protected]
215         * @Readme
216         */
217        enableButton: function(buttonId){
218            if (!buttonId){
219                console.log("enableButton 必须传入buttonId ")
220                return false;
221            };
222
223            $(buttonId).removeClass("btn-disable");
224            $(buttonId).removeAttr("disabled");
225        },
226
227        /*
228         * @Name 键盘只能输入数字
229         * @Param
230         * @Return
231         * @Author [email protected]
232         * @Readme
233         * [48-57] 数字键
234         * [96-105] 数字小键盘
235         */
236        keyCodeIsNum: function(keyCode){
237            if (!keyCode){
238                return false;
239            };
240
241            if (keyCode >= 48 && keyCode <= 57){
242                return true;
243            };
244
245            if (keyCode >= 96 && keyCode <= 105){
246                return true;
247            };
248
249            return false;
250        },
251
252        /*
253         * @Name 键盘只能输入字母
254         * @Param
255         * @Return
256         * @Author [email protected]
257         * @Readme
258         * [65-90] 字母键
259         *
260         */
261        keyCodeIsLetter: function(keyCode){
262            if (!keyCode){
263                return false;
264            };
265
266            if (keyCode >= 65 && keyCode <= 90){
267                return true;
268            };
269
270            return false;
271        },
272
273        /*
274         * @Name 键盘只能输入操作键
275         * @Param
276         * @Return
277         * @Author [email protected]
278         * @Readme
279         * 8  Backspace
280         * 9  tab
281         * 46 delete
282         * 37 å·¦
283         * 39 右
284         */
285        keyCodeIsOperate: function(keyCode){
286            if (!keyCode){
287                return false;
288            };
289
290            if (keyCode == 8 || keyCode == 9 || keyCode == 46 || keyCode == 37 || keyCode == 39){
291                return true;
292            };
293
294            return false;
295        },
296
297        /*
298         * @Name 普通的 GET&POST AJAX
299         * @Param
300         * @Return
301         * @Author [email protected]
302         * @Readme
303         */
304        doAjax: function(url,type,data,successCallback,failedCallback,crossDomain){
305            let mySelf = this;
306            // let location = window.location.href;
307            if (!url){
308                console.log('URL不合法!');
309                return false;
310            };
311
312            if (!type || ["POST","GET"].indexOf(type) == -1){
313                console.log('ajax type不合法!默认设GET');
314                var type = 'POST';
315            };
316
317            var data = (data)?data:null;
318            var pro = new Promise(function(resolve,reject){
319                // eslint-disable-next-line
320                $.ajax({
321                    type: type,
322                    async: true,    //异步
323                    url: url,
324                    data: data,
325                    timeout : 30000,//设置超时时间
326                    dataType: 'json',
327                    success: function(res){
328                        var resCode = res.code;
329                        if (resCode === 0 || resCode === 1){
330                            if (successCallback){
331                                successCallback(res);
332                            }
333                            resolve(res);
334                        }
335                        else{
336                            var text = "接口报错: " + res.error;
337                            console.log(text);
338                            if (failedCallback){
339                                failedCallback(res);
340                            }
341                            resolve(res);
342                        }
343                    },
344                    error: function(XMLHttpRequest, status, errorThrown){
345                        // console.log(status);
346                        var obj = {
347                            XMLHttpRequest: XMLHttpRequest,
348                            status: status,
349                            errorThrown: errorThrown
350                        };
351                        var text = "接口报错状态: " + status + ";接口报错内容: " + errorThrown;
352                        console.log(text);
353                        if (failedCallback){
354                            failedCallback(obj);
355                        }
356                    }
357                });
358            });
359            return pro;
360        },
361
362        /*
363         * @Name 普通的 POST AJAX
364         * @Param
365         * @Return
366         * @Author [email protected]
367         * @Readme
368         */
369        doPostAjax: function(url,data,successCallback,failedCallback){
370
371            let mySelf = this;
372            if (!url){
373                console.log('URL不合法!');
374                return false;
375            };
376
377            var pro = new Promise(function(resolve,reject){
378                // eslint-disable-next-line
379                $.ajax({
380                    type: 'post',
381                    async: true,
382                    url: url,
383                    data: data,
384                    timeout : 30000,
385                    dataType: 'json',
386                    success: function(res) {
387                        //没有登录态
388                        if (res.code === 30002){
389                            let text = "登录超时,请重新登录!";
390                            console.log(text);
391                        }
392                        else if (res.code === 0 ){
393                            if (successCallback){
394                                successCallback(res);
395                            }
396                            resolve(res);
397                        }
398                        else{
399                            let text = "接口报错: " + res.message;
400                            console.log(text);
401                            if (failedCallback){
402                                failedCallback(res);
403                            }
404                        }
405                    },
406                    error: function(XMLHttpRequest, status, errorThrown){
407                        // console.log(status);
408                        let text = "接口报错状态: " + status + ";接口报错内容: " + errorThrown;
409                        console.log(text);
410                        if (failedCallback){
411                            failedCallback();
412                        }
413                    }
414                });
415            });
416            return pro;
417
418        },
419
420        /*
421         * @Name 写cookie
422         * @Param
423         * @Return
424         * @Author [email protected]
425         * @Readme
426         */
427        setCookie: function(c_name,value,expiremMinutes,domain,path){
428            // console.log(path);
429            var exdate = new Date();
430            exdate.setTime(exdate.getTime() + expiremMinutes * 60 * 1000);
431            document.cookie = c_name + "=" + escape(value) + ((expiremMinutes) ? ";expires=" + exdate.toGMTString():"") + ((domain)?";domain=" + domain:"") + ((path)?";path=" + path:"");
432        },
433
434        /*
435         * @Name 读cookie
436         * @Param
437         * @Return
438         * @Author [email protected]
439         * @Readme
440         */
441        getCookie: function(c_name){
442            if (document.cookie.length>0)
443            {
444                var c_start=document.cookie.indexOf(c_name + "=");
445                if (c_start!==-1)
446                {
447                c_start=c_start + c_name.length+1;
448                var c_end=document.cookie.indexOf(";",c_start);
449                if (c_end === -1)
450                    c_end = document.cookie.length
451                    return unescape(document.cookie.substring(c_start, c_end))
452                }
453            }
454            return ""
455        },
456
457        /*
458         * @Name 删除cookie
459         * @Param
460         * @Return
461         * @Author [email protected]
462         * @Readme
463         */
464        delCookie: function(c_name,domain,path){
465            var exp = new Date();
466            exp.setTime(exp.getTime() - 1);
467            // console.log(exp)
468            // console.log(exp.toGMTString())
469            var cval = this.getCookie(c_name);
470            if(cval !== null){
471                document.cookie = c_name + "=" + escape(cval) + ";expires=" + exp.toGMTString() + ((domain)?";domain=" + domain:"") + ((path)?";path=" + path:";path=/");
472            }
473        },
474
475        /*
476         * @Name 和PHP一样的时间戳格式化函数
477        // @param  {string} format    格式
478        // @param  {int}    timestamp 要格式化的时间 默认为当前时间 格式是秒的时间戳
479         * @Return {string} 格式化的时间字符串
480         * @Author [email protected]
481         * @reference http://www.daxueit.com/article/4603.html
482         * @Readme
483         * @e.g. $util.timeFormatter('Y-m-d H:i:s', new Date().getTime()/1000)
484         */
485        /* eslint-disable */
486        timeFormatter:  function ( format, timestamp ) {
487
488            var a, jsdate=((timestamp) ? new Date(timestamp*1000) : new Date());
489            var pad = function(n, c){
490                if( (n = n + "").length < c ) {
491                    return new Array(++c - n.length).join("0") + n;
492                } else {
493                    return n;
494                }
495            };
496            var txt_weekdays = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];
497
498            var txt_ordin = {1:"st",2:"nd",3:"rd",21:"st",22:"nd",23:"rd",31:"st"};
499
500            var txt_months = ["", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
500November", "December"];
501
502            var f = {
503                // Day
504                d: function(){
505                    return pad(f.j(), 2);
506                },
507                D: function(){
508                    var t = f.l(); return t.substr(0,3);
509                },
510                j: function(){
511                    return jsdate.getDate();
512                },
513                l: function(){
514                    return txt_weekdays[f.w()];
515                },
516                N: function(){
517                    return f.w() + 1;
518                },
519                S: function(){
520                    return txt_ordin[f.j()] ? txt_ordin[f.j()] : 'th';
521                },
522                w: function(){
523                    return jsdate.getDay();
524                },
525                z: function(){
526                    return (jsdate - new Date(jsdate.getFullYear() + "/1/1")) / 864e5 >> 0;
527                },
528
529                // Week
530                W: function(){
531                    var a = f.z(), b = 364 + f.L() - a;
532                    var nd2, nd = (new Date(jsdate.getFullYear() + "/1/1").getDay() || 7) - 1;
533
534                    if(b <= 2 && ((jsdate.getDay() || 7) - 1) <= 2 - b){
535                        return 1;
536                    } else{
537
538                        if(a <= 2 && nd >= 4 && a >= (6 - nd)){
539                            nd2 = new Date(jsdate.getFullYear() - 1 + "/12/31");
540                            return date("W", Math.round(nd2.getTime()/1000));
541                        } else{
542                            return (1 + (nd <= 3 ? ((a + nd) / 7) : (a - (7 - nd)) / 7) >> 0);
543                        }
544                    }
545                },
546
547                // Month
548                F: function(){
549                    return txt_months[f.n()];
550                },
551                m: function(){
552                    return pad(f.n(), 2);
553                },
554                M: function(){
555                    var t = f.F(); return t.substr(0,3);
556                },
557                n: function(){
558                    return jsdate.getMonth() + 1;
559                },
560                t: function(){
561                    var n;
562                    if( (n = jsdate.getMonth() + 1) == 2 ){
563                        return 28 + f.L();
564                    } else{
565                        if( n & 1 && n < 8 || !(n & 1) && n > 7 ){
566                            return 31;
567                        } else{
568                            return 30;
569                        }
570                    }
571                },
572
573                // Year
574                L: function(){
575                    var y = f.Y();
576                    return (!(y & 3) && (y % 1e2 || !(y % 4e2))) ? 1 : 0;
577                },
578                //o not supported yet
579                Y: function(){
580                    return jsdate.getFullYear();
581                },
582                y: function(){
583                    return (jsdate.getFullYear() + "").slice(2);
584                },
585
586                // Time
587                a: function(){
588                    return jsdate.getHours() > 11 ? "pm" : "am";
589                },
590                A: function(){
591                    return f.a().toUpperCase();
592                },
593                B: function(){
594                    // peter paul koch:
595                    var off = (jsdate.getTimezoneOffset() + 60)*60;
596                    var theSeconds = (jsdate.getHours() * 3600) +
597                        (jsdate.getMinutes() * 60) +
598                        jsdate.getSeconds() + off;
599                    var beat = Math.floor(theSeconds/86.4);
600                    if (beat > 1000) beat -= 1000;
601                    if (beat < 0) beat += 1000;
602                    if ((String(beat)).length == 1) beat = "00"+beat;
603                    if ((String(beat)).length == 2) beat = "0"+beat;
604                    return beat;
605                },
606                g: function(){
607                    return jsdate.getHours() % 12 || 12;
608                },
609                G: function(){
610                    return jsdate.getHours();
611                },
612                h: function(){
613                    return pad(f.g(), 2);
614                },
615                H: function(){
616                    return pad(jsdate.getHours(), 2);
617                },
618                i: function(){
619                    return pad(jsdate.getMinutes(), 2);
620                },
621                s: function(){
622                    return pad(jsdate.getSeconds(), 2);
623                },
624                //u not supported yet
625
626                // Timezone
627                //e not supported yet
628                //I not supported yet
629                O: function(){
630                    var t = pad(Math.abs(jsdate.getTimezoneOffset()/60*100), 4);
631                    if (jsdate.getTimezoneOffset() > 0) t = "-" + t; else t = "+" + t;
632                    return t;
633                },
634                P: function(){
635                    var O = f.O();
636                    return (O.substr(0, 3) + ":" + O.substr(3, 2));
637                },
638                //T not supported yet
639                //Z not supported yet
640
641                // Full Date/Time
642                c: function(){
643                    return f.Y() + "-" + f.m() + "-" + f.d() + "T" + f.h() + ":" + f.i() + ":" + f.s() + f.P();
644                },
645                //r not supported yet
646                U: function(){
647                    return Math.round(jsdate.getTime()/1000);
648                }
649            };
650
651            return format.replace(/[\\]?([a-zA-Z])/g, function(t, s){
652                var ret = null;
653                if( t!==s ){
654                    // escaped
655                    ret = s;
656                } else if( f[s] ){
657                    // a date function exists
658                    ret = f[s]();
659                } else{
660                    // nothing special
661                    ret = s;
662                }
663
664                return ret;
665            });
666
667        },
668        /* eslint-enable */
669
670        /*
671         * @Name JSON.parse
672         * @Param
673         * @Return
674         * @Author [email protected]
675         * @Readme 2018-01-03 15:19:53 => 1514963993000
676         */
677        stringTimeToUnixTimeStamp: function(timeStr){
678            if (!timeStr || typeof timeStr !== 'string'){
679                return false;
680            };
681
682            // console.log(timeStr)
683            let timeObj = timeStr.replace(/-/g,"/");
684            timeObj = new Date(timeObj);
685            let timeStamp = timeObj.getTime();
686            // console.log(date.getTime());
687            return timeStamp;
688        },
689
690        /*
691         * @Name JSON.parse
692         * @Param
693         * @Return
694         * @Author [email protected]
695         * @Readme
696         */
697        /* eslint-disable */
698        jsonParse: function(data, defaultValue){
699            var resData = "";
700            var defaultValue = defaultValue?defaultValue:false;
701            try{
702                var data = JSON.parse(data);
703                resData = data;
704            } catch(error){
705                resData = defaultValue;
706                console.log(data + " JSON.parse失败,报错日志是: " + error);
707            }
708            return resData
709        },
710        /* eslint-enable */
711
712        /*
713         * @Name JSON.stringify
714         * @Param
715         * @Return
716         * @Author [email protected]
717         * @Readme
718         */
719        /* eslint-disable */
720        jsonStringify: function(data, defaultValue){
721            var resData = "";
722            var defaultValue = defaultValue?defaultValue:false;
723            try{
724                var data = JSON.stringify(data);
725                resData = data;
726            } catch(error){
727                resData = defaultValue;
728                console.log(data + " JSON.parse失败,报错日志是: " + error);
729            }
730            return resData
731        },
732        /* eslint-enable */
733
734        /*
735         * @Name 判断obj是非空对象
736         * @Param
737         * @Return
738         * @Author [email protected]
739         * @Readme
740         */
741        isNotEmptyObj: function(obj){
742            for (var i in obj){
743                if (obj.hasOwnProperty(i)){
744                    // console.log(true) //不为空
745                    return true;
746                }
747            };
748            // console.log(false) //为空
749            return false;
750        },
751
752        /*
753         * @Name 判断obj是空对象
754         * @Param
755         * @Return
756         * @Author [email protected]
757         * @Readme
758         */
759        isEmptyObj: function(obj){
760            for (var i in obj){
761                if (obj.hasOwnProperty(i)){
762                    return false; //非空
763                }
764            };
765            return true //空
766        },
767
768        /*
769         * @Name 序列化url
770         * @Param
771         * @Return
772         * @Author [email protected]
773         * @Readme
774         */
775        /* eslint-disable */
776        parseURL: function(url){
777            var a =  document.createElement('a');
778            a.href = url;
779            return {
780                source: url,
781                protocol: a.protocol.replace(':',''),
782                host: a.hostname,
783                port: a.port,
784                query: a.search,
785                params: (function(){
786                    var ret = {},
787                        seg = a.search.replace(/^\?/,'').split('&'),
788                        len = seg.length, i = 0, s;
789                    for (;i<len;i++) {
790                        if (!seg[i]) { continue; }
791                        s = seg[i].split('=');
792                        ret[s[0]] = s[1];
793                    }
794                    return ret;
795                })(),
796                hashParams:(function(){
797                    var ret = {},
798                        str = a.href;
799                    var num = str.indexOf("?");
800                    str = str.substr(num+1);
801                    var arr=str.split("&");
802                    var len = arr.length;
803                    for (var i=0;i<len;i++) {
804                        if (!arr[i]) { continue; }
805                        var s = arr[i].split('=');
806                        ret[s[0]] = decodeURI(s[1]);
807                    }
808                    return ret;
809                })(),
810                file: (a.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1],
811                hash: a.hash.replace('#',''),
812                path: a.pathname.replace(/^([^\/])/,'/$1'),
813                relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [,''])[1],
814                segments: a.pathname.replace(/^\//,'').split('/')
815            };
816        },
817        /* eslint-enable */
818
819        /*
820         * @Name 下载csv
821         * @Param
822         * @Return
823         * @Author [email protected]
824         * @Readme
825         */
826        /* eslint-disable */
827        downloadCsv: function(linkId, header, content, fileName){
828            if (!linkId || !header || !content){
829                console.log("downloadCsv 参数 error");
830                return false;
831            }
832
833            var linkId = linkId;
834            var header = header;// ['ID','名字','职位','备注'];
835            var content = content;// [['1','lemon','FE','啦啦啦'],['2','lara','str','啊啊啊'],['3','nolan','FF','噜噜噜']];
836            var downloadLink = document.getElementById(linkId);
837            var context = "";
838            var context = header.join(',') + '\n'
839            for (var i=0;i<content.length;i++){
840                var item = content[i];
841                item.forEach(function(item,index,list){
842                    context = context + item + ','
843                })
844                context = context + '\n'
845            }
846
847            // console.log('---------------拼接的字符串---------------\n' + context)
848            //var context = "col1," + "反反\r复复" + ",col3\nvalue1,value2,value3"
849            context = encodeURIComponent(context)
850            downloadLink.download = fileName + '.csv' // 下载的文件名称
851            downloadLink.href = "data:text/csv;charset=utf-8,\ufeff" + context; //加上 \ufeff BOM 头
852            downloadLink.addEventListener("click",function(e){e.stopPropagation()},false); // 阻止冒泡事件
853
854            // setTimeout(function(){
855                // console.log(downloadLink.href)
856            downloadLink.click();
857            // },5000);
858            console.log('下载csv文件完成!')
859        },
860        /* eslint-enable */
861
862
863        /*
864         * @Name 正则表达部分
865         * @Param
866         * @Return
867         * @Author [email protected]
868         * @Readme
869         */
870        checkByRegular: function(type,value){
871
872            let REG = null;
873            let valid = false;
874            if (!type){
875                console.log('入参有误!');
876            };
877
878            //有空格 has_space
879            if (type === "hasSpace"){
880                REG = /\s+/;
881            }
882            //字段为空 is_empty
883            else if (type === "isEmpty"){
884                REG = /^$/;
885            }
886            //手机
887            else if (type === "phone"){
888                REG = /^1[3-9][0-9]{9}$/;
889            }
890            //邮箱
891            else if(type === "email"){
892                REG = /^(\w)+([-_.\w])*@((\w)+[-.])+(\w){2,7}$/;
893            }
894            //密码
895            else if(type === "password"){
896                REG = /^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[A-Za-z0-9~`!@#$%^&*()_\-+={}[\]|\\:;"'<>,.?/]{8,20}$/;
897            }
898            //数字
899            else if(type === "number"){
900                REG = /^[1-9]\d*$/;
901            }
902            //特权码
903            else if(type === "privilegeCode"){
904                REG = /^[A-Za-z0-9]{6}$/;
905            }
906            else{
907                console.log("没找到匹配!");
908                return false;
909            };
910
911            valid = REG.test(value);
912
913            if(!valid){
914                return false;
915            };
916
917            return true;
918        },
919
920
921
922    },
923    pars: {
924        "ajaxDomain": "",
925        "userInfo": {},
926        "crossDomain": "http://dev.galaxy.xycdn.com",
927    }
928});
929
930var $util = $.util;
931var $pars = $.pars;

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.