总结Js方法工具类库,总有你需要的方法

总结Js方法工具类库,总有你需要的方法

前言

实际开发工程中,会遇到一些重复的逻辑功能处理或者说是比较繁琐的前端函数。粗略整理了一下,希望对正在浏览的你有所帮助,也希望帮助新入行的小白们解决一下工作中的负担(毕竟谁都是从小白一步一步走过来的,所经受的苦在座的各位也不必我去言说)

 

前端工具类库源码(基于jQuery)

使用多年的前端工具类,适用于多个项目。可帮助快速开发 < jstool-1.0.5.js > 后续维护更新

/*!
 * JsTool v1.0.5
 * Date 2018-9-10 10:45:48
 * Author Parker
 */

/**
 * js常用工具
  * result
 */
var  Js_Tool={
    init:function (name) {
    },
    isNullByNum:function (val) {
        /**
         * 判断数字、浮点是否为空
         *  val
         * @returns
         */
        if (val == undefined || val == null) {
            return true;
        }
        return false;
    },
    isNull:function (val) {
        /**
         * 判断是否为空
         *  val
         * @returns
         */
        if (val == undefined || val == null || val == "" || val == ''
            || val == "undefined" || val == "null" || val == "NULL") {
            return true;
        }
        return false;
    },
    isEmpty:function (source){
        /**
         * 判断字符串是否为空,若为空则返回true否则返回false
         **/
        var str = source.replace(/(^\s*)|(\s*$)/g,"");
        if(str=="" || str.toLowerCase()=="null" || str.length<=0){
            return true;
        }else{
            return false;
        }
    },
    urlAddParmert:function (urls,parameter,value){
        /**
         * 给URL追加参数
         * url
         * parameter 参数名
         * value  参数值
         */
        var buf = '';
        if(!this.isEmpty(urls)){
            buf = urls;
            if(urls.indexOf("?") > -1){  //已经有参数
                buf+="&";
            }else{
                buf+="?";
            }
            buf+=parameter;
            buf+='=';
            buf+=value;
        }
        return buf.toString();
    },
    setNormalLoading:function(obj,urls){
        /**
         * 静态化ajax页面加载  无实时刷新
         *
         */
        var tempUrl = urls;
        tempUrl = this.urlAddParmert(tempUrl,'tempdata',new Date().getTime());
        obj.css('overflow','hidden');
        $.get(tempUrl, {}, function (res) {
            obj.html(res);
        });
    },
    setCyclicLoading:function(obj,urls,delaytime){
        /**
         * 静态化ajax页面加载  有实时刷新
         *
         */
        var tempUrl = urls;
        tempUrl = this.urlAddParmert(tempUrl,'tempdata',new Date().getTime());
        obj.css('overflow','hidden');
        $.get(tempUrl, {}, function (res) {
            obj.html(res);
        });
        window.setInterval(function () {
            var tempUrl2 = urls;
            tempUrl2 = Js_Tool.urlAddParmert(tempUrl2,'tempdata',new Date().getTime());
            $.get(tempUrl2, {}, function (res) {
                obj.html(res);
            });
        }, delaytime);
    },
    /**
          * 获取base 路径信息
          * result getCurWwwPath()	/	getPathName()	/	getLocalhostPath()	/	getProjectName()	/	getBasePath()
          */
    publicMethod:function () {
        //获取当前网址,如: http://localhost:8080/ems/Pages/Basic/Person.jsp
        var curWwwPath = window.document.location.href;
        //获取主机地址之后的目录,如: /ems/Pages/Basic/Person.jsp
        var pathName = window.document.location.pathname;
        var pos = curWwwPath.indexOf(pathName);
        //获取主机地址,如: http://localhost:8080
        var localhostPath = curWwwPath.substring(0, pos);
        //获取带"/"的项目名,如:/ems
        var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
        //获取项目的basePath   http://localhost:8080/ems/
        var basePath=localhostPath+projectName+"/";
        var baseF = [curWwwPath,pathName,pos,localhostPath,projectName,basePath];
        return baseF;
    },
    getCurWwwPath:function(){
        //获取当前网址
        return this.publicMethod()[0];
    },
    getPathName:function(){
        //获取主机地址之后的目录
        return this.publicMethod()[1];
    },
    getPos:function(){
        //获取终端
        return this.publicMethod()[2];
    },
    getLocalhostPath:function(){
        //获取主机地址
        return this.publicMethod()[3];
    },
    getProjectName:function(){
        //获取带"/"的项目名
        return this.publicMethod()[4];
    },
    getBasePath:function(){
        //获取项目的basePath
        return this.publicMethod()[5];
    },
    setRandomNum:function(l,m,t){
        //随机数   个数/最小数/最大数
        if(!t)t=0;
        var d=[];
        for(var i=0;i<l;i++){
            d.push(parseInt(t+Math.random()*(m-t+1)));
        }
        return d;
    },
    loadjscssfile:function(fileurl,filetype){
        /**
         * 方法说明:【动态加载js文件css文件】
         * 使用方法:loadUtil.loadjscssfile("http://libs.baidu.com/jquery/1.9.1/jquery.js","js")
         * @param fileurl 文件路径,
         * @param filetype 文件类型,支持传入类型,js、css
         */
        if(filetype == "js"){
            var fileref = document.createElement('script');
            fileref.setAttribute("type","text/javascript");
            fileref.setAttribute("src",fileurl);
        }else if(filetype == "css"){

            var fileref = document.createElement('link');
            fileref.setAttribute("rel","stylesheet");
            fileref.setAttribute("type","text/css");
            fileref.setAttribute("href",fileurl);
        }
        if(typeof fileref != "undefined"){
            document.getElementsByTagName("head")[0].appendChild(fileref);
        }else{
            console.log("loadjscssfile method error!");
        }
    },
    getQueryObject:function(url) {
        url = url == null ? window.location.href : url;
        var search = url.substring(url.lastIndexOf("?") + 1);
        var obj = {};
        var reg = /([^?&=]+)=([^?&=]*)/g;
        search.replace(reg, function (rs, $1, $2) {
            var name = decodeURIComponent($1);
            var val = decodeURIComponent($2);
            val = String(val);
            obj[name] = val;
            return rs;
        });
        return obj;
    },
    getTerminalVersions:function (){//判断是哪个终端
        var u = window.navigator.userAgent;
        return {
            trident: u.indexOf('Trident') > -1, //IE内核
            presto: u.indexOf('Presto') > -1, //opera内核
            webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
            gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
            mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/), //是否为移动终端
            ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
            android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
            iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者安卓QQ浏览器
            iPad: u.indexOf('iPad') > -1, //是否为iPad
            webApp: u.indexOf('Safari') == -1, //是否为web应用程序,没有头部与底部
            weixin: u.indexOf('MicroMessenger') == -1 //是否为微信浏览器
        };
    },
    chkCheckCha:function (chname) {
        /**
         * 判断指定名称的复选框是否被选中
         *
         *            chname复选框名称
         */
        var obj = jQuery("[name='" + chname + "']");
        var isCheck = false;
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].checked == true) {
                isCheck = true;
                break;
            }
        }
        return isCheck;
    },
    checkChangedOnly:function (chname) {
        /**
         * 得到指定名称的复选框被选中个数
         *
         *            chname
         * @return {}
         */
        var obj = jQuery("[name='" + chname + "']");
        var count = 0;
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].checked == true) {
                count++;
            }
        }
        return count;
    },
    getValueCheckOnly:function (chname) {
        /**
         * 得到指定名称的单个被选中的复选择框的值
         *
         *            chname
         */
        var str = "";
        jQuery("[name='" + chname + "'][checked]").each(function() {
            str += jQuery(this).val();
        });
        return str;
    },
    getCheckVals:function (chname) {
        /**
         * 得到多个复选框的值
         *
         *            chname
         */
        var str = "";
        jQuery("[name='" + chname + "'][checked]").each(function() {
            str += jQuery(this).val() + "@";
        });
        return str.substring(0, str.length - 1);
    },
    getSomeChVals:function (chname) {
        /**
         * 得到一些复选框的值 复选框的值中是否包含有","若无则用","将多个值组合 若有则先将值用","隔开再用","组合
         *
         *            chname
         */
        var str = "";
        jQuery("[name='" + chname + "'][checked]").each(function() {
            var temp = jQuery(this).val();
            if (temp.indexOf(",") == -1) {
                str += temp + ",";
            } else {
                var tempValue = temp.split(",");
                str += tempValue[0] + ",";
            }
        });
        return str.substring(0, str.length - 1);
    },
    getCheckValues:function (chname) {
        /**
         * 得到指定名称的有多个值的多个复选框的值
         *
         *  chname
         */
        var str = "";
        var sids = "";
        var snames = "";
        jQuery("[name='checkbox'][checked]").each(function() {
            var strval = jQuery(this).val();
            var temp = strval.split(",");
            var sid = temp[0];
            var sname = temp[1];
            sids += sid + ",";
            snames += sname + ", ";
        });
        str = sids.substring(0, sids.length - 1) + "|"
            + snames.substring(0, snames.length - 2);
        return str;
    },
    decideCheckState:function (chname) {
        /**
         * 判断复选框的状态
         *
         *            chname
         */
        var str = this.getCheckVals(chname);
        var tstr = str.split("@");
        var temp = "";
        for (var i = 0; i < tstr.length; i++) {
            var tval = tstr[i];
            var tem = tval.substring(tval.length - 1, tval.length);
            temp += tem;
        }
        return temp;
    },
    checkboxAll:function (chname) {
        /**
         * 复选框全选
         *
         *            chname
         */
        jQuery("[name='" + chname + "']").each(function() {
            jQuery(this).attr("checked", true);
        });
    },
    inverSelect:function (chname) {
        /**
         * 复选框反选
         *
         *            chname
         */
        jQuery("[name='" + chname + "']").each(function() {
            if (jQuery(this).attr("checked")) {
                jQuery(this).attr("checked", false);
            } else {
                jQuery(this).attr("checked", true);
            }
        });
    },
    clearSelect:function (chname) {
        /**
         * 取消全选或反选
         *
         *            chname
         */
        jQuery("[name='" + chname + "']").each(function() {
            jQuery(this).attr("checked", false);
        });
    },
    checkTime:function (timevale) {
        /**
         * 校验时间格式
         *
         *            timevale
         * @return {}
         */
        var regex = /^(([0-1][0-9])|([2][0-4]))(\:)[0-5][0-9](\:)[0-5][0-9]$/g;
        var b = regex.test(timevale);
        return b;
    },
    checkIp:function (ipvale) {
        /**
         * 校验Ip地址格式
         *
         *            ipvale
         */
        var regex = /^([1-9]|[1-9]\d|1\d{2}|2[0-1]\d|22[0-3])(\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){3}$/;
        var b = regex.test(ipvale);
        return b;
    },
    checkLetOrNum:function (letVale) {
        /**
         * 是否是由字母或数字组成的字符串
         *
         *            letVale
         */
        var regex = /^([a-zA-Z_]{1})([\w]*)$/g;
        var b = regex.test(letVale);
        return b;
    },
    interceptStr:function (source, index) {
        /**
         * 取字符串的第index的字符
         *
         *            source
         *            index
         */
        var temp = source.charAt(index);
        return parseInt(temp);
    },
    checkStr:function (source, targer, beindex, endindex) {
        /**
         * 检查字符串中beindex位置到endindex位置之间是否全由targer组成
         *
         *            source
         *            targer
         *            beindex
         *            endindex
         */
        var flag = false;
        for (var i = beindex; i <= endindex; i++) {
            var temp = source.charAt(i);
            if (targer == temp) {
                flag = true;
            }
        }
        return flag;
    },
    decideString:function (source, target) {
        /**
         * 判断两个字符串是否想等 相等返回true否则返回false
         *
         *            source
         *            target
         */
        return (source == target) ? true : false;
    },
    stringToNumber:function (val){
        /**
         * 将字符串转换成数字
         */
        return Number(val);
    },
    checkIntAndFloat:function (source){
        /**
         * 验证是否是整数或小数
         */
        var regex = /^[0-9]+(\.[0-9]+)?$/g;
        return regex.test(source);
    },
    checkFloat:function (source) {
        /**
         * 验证是否是整数或只有一位小数点的小数
         *
         */
            // var regex=/^[1-9]d*.d{1}|0.d{1}[1-9]d{1}$/g;
        var regex = /^[0-9]+\d*[\.\d]?\d{0,1}$/g;
        return regex.test(source);
    },
    checkTwoInt:function (source) {
        /**
         * 验证是否两位数以内的正整数
         */
        var regex = /^[1-9][0-9]?$/g;  //两位数以内的正整数
        return regex.test(source);
    },
    checkNumber:function (source) {
        /**
         * 验证数字
         *
         */
        var regex = /^(\-|\+)?\d+(\.\d+)?$/;
        return regex.test(source);
    },
    checkTowLenFloat:function (source) {
        /**
         * 验证是否是两位小数的正实数
         *
         */
        var regex = /^[0-9]+(.[0-9]{2})?$/g;//只能输入有两位小数的正实数
        return regex.test(source);
    },
    checkTowLenFloatt:function (source) {
        /**
         * 验证是否是两位或一位小数的正实数
         *
         */
        var regex = /^[0-9]+(.[0-9]{1,2})?$/g;//只能输入有两位小数的正实数
        return regex.test(source);
    },
    checkTowFloat:function (source) {
        /**
         * 验证是否是整数或只有2位小数的数
         *
         */
        var regex = /^[1-9]+\d*[\.\d]?\d{0,2}$/g;
        return regex.test(source);
    },
    checkSpace:function (source) {
        /**
         * 验证是否有空格
         *
         *            source
         */
        var regex = /\s/g;
        return regex.test(source);
    },
    checkIntLeng:function (source) {
        /**
         * 检查一个数是否是整数则位数在8以内
         *
         *            source
         */
        var regex = /^[1-9]{1}[0-9]{1,7}$/g;
        return regex.test(source);
    },
    checkIntTwoLeng:function (source) {
        /**
         * 检查一个数是否是整数则位数在2以内
         *
         *            source
         */
        var regex = /^[1-9]{1}[0-9]{1,2}$/g;
        return regex.test(source);
    },
    checkInt:function (source) {
        /**
         * 验证正整数
         *
         *            source
         */
            // var regex=/^[1-9]d*$/g
        var regex = /^[0-9]*[1-9][0-9]*$/g;
        return regex.test(source);
    },
    checkNegative:function (source) {
        /**
         * 验证非负数
         *
         *            source
         */
        var regex=/^[1-9]\d*|0$/g;
        return regex.test(source);
    },
    getIpNum:function (ipAddress) {
        /**
         * 分割IP地址
         *
         *            ipAddress
         */
        var ip = ipAddress.split(".");
        var a = parseInt(ip[0]);
        var b = parseInt(ip[1]);
        var c = parseInt(ip[2]);
        var d = parseInt(ip[3]);
        var ipNum = a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
        return ipNum;
    },
    decideIp:function (startIp, endIp) {
        /**
         * 判断IP大小
         */
        var ip1 = this.getIpNum(startIp);
        var ip2 = this.getIpNum(endIp);
        return (ip2 > ip1) ? true : false;
    },
    dateToString:function (source,addval){
        /**
         * 时间变化
         * source
         * addval
         */
        var paddval = parseInt(addval);//增量(秒)
        var temp = source.split(":");
        var thrs = parseInt(temp[0])*3600;//小时化成秒
        var tmis = parseInt(temp[1])*60;//分钟化成秒;
        var tss = parseInt(temp[2]);//秒
        var totals = parseInt(thrs)+parseInt(tmis)+parseInt(tss)+parseInt(paddval);
        var result = this.timeTohhmmss(totals);
        return result;
    },
    timeTohhmmss:function (seconds){
        /**
         * 由秒数转化成hh:mm:ss格式
         *seconds
         */
        var hh;
        var mm;
        var ss;
        if(seconds==null || seconds<0){
            return;
        }
        var pseconds = parseInt(seconds);
        //得到小时
        hh = pseconds/3600|0;
        pseconds = parseInt(pseconds)-parseInt(hh)*3600;
        if(parseInt(hh)<10){
            hh="0"+hh;
        }
        if(parseInt(hh)>=24){
            hh="00";
        }
        //得到分钟
        mm = parseInt(pseconds)/60|0;
        //得到秒
        ss = parseInt(pseconds)-parseInt(mm)*60;
        if(parseInt(mm)<10){
            mm = "0"+mm;
        }
        if(parseInt(ss)<10){
            ss = "0"+ss;
        }
        return hh+":"+mm+":"+ss;
    },
    isCardNo:function (num){
        /**
         验证身份证号是否正确
         **/
        if(isNaN(num)){
            console.log("输入的身份证号不是数字!");
            return false;
        }
        var len = num.length;
        if(len<15 || len>18){
            console.log("输入的身份证号码长度不正确定!应为15位或18位");
            return false;
        }
        var re15 = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/;
        var re18 = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/;
        var res = (re15.test(num) || re18.test(num));
        if(res==false){
            console.log("输入的身份证号格式不正确!");
            return false;
        }
        return res;
    },
    sTelephone:function (source) {
        /**
         * 验证是否为电话号码(座机)
         *
         *            source
         */
        var regex = /^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/;
        return regex.test(source);  //search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1
    },
    isMobilePhone:function (source) {
        /**
         * 验证是否为手机号码(移动手机)
         *
         *            source
         */
        var regex = /^((\(\d{3}\))|(\d{3}\-))?1\d{10}/;
        return regex.test(source);
    },
    isEmail:function (source) {
        /**
         * 验证是否为电子邮箱
         *
         *            source
         */
        var regex = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
        if(source.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
            return true;
        }else{
            console.log("电子邮箱格式不正确");
            return false;
        }
    },
    isZip:function (source){
        /**
         *
         *验证是否为邮编
         *
         *      source
         */
        var regex=/^[1-9]\d{5}$/;
        return regex.test(source);
    },
    isChines:function (source){
        /**
         *
         *验证字符串是否是中文
         *
         **/
        var regex = /^[\u4E00-\u9FA5]+$/;
        return regex.test(source);
    },
    jsContains:function (string,substr,isIgnoreCase){
        /*
         *判断包含关系
         *string:原始字符串
         *substr:子字符串
         *isIgnoreCase:忽略大小写
         */
        if(isIgnoreCase){
            string=string.toLowerCase();
            substr=substr.toLowerCase();
        }
        var startChar=substr.substring(0,1);
        var strLen=substr.length;
        for(var j=0;j<string.length-strLen+1;j++)
        {
            if(string.charAt(j)==startChar)//如果匹配起始字符,开始查找
            {
                if(string.substring(j,j+strLen)==substr)//如果从j开始的字符与str匹配,那ok
                {
                    return true;
                }
            }
        }
        return false;
    },
    makeUUID:function () {
        /**
         * 随机数UUID
         */
        var S4 = function () {
            return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
        };
        //return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
        return (S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4());
    },
    getFileExt:function (filename){
        /**
         * 得到文件的扩展名
         * filename
         */
        var d=/\.[^\.]+$/.exec(filename);
        var ext = new String(d);
        var s = ext.toLowerCase();
        return s;
    },
    strEncode:function (source){
        //字符串编码
        return encodeURIComponent(source);
    },
    strDencode:function (source){
        //字符串解码
        return decodeURIComponent(source);
    },
    strParseInt:function (source){
        /**
         * 字符串转正形
         *  source
         * @returns
         */
        if(this.isEmpty(source) || isNaN(source)){
            return 0;
        }
        return parseInt(source);
    },
    strParseFloat:function (source){
        /**
         * 字符串转Float形
         *  source
         * @returns
         */
        if(this.isEmpty(source) || isNaN(source)){
            return 0;
        }
        return parseFloat(source);
    },
    getTodayDate:function (){
        /**
         * 获取今天日期,星期几
         * @returns
         */
        var now = new Date();
        var yy = now.getFullYear();
        var mm = now.getMonth()+1;
        var dd=now.getDate();
        var day = new Array();
        day[0] = "星期日";
        day[1] = "星期一";
        day[2] = "星期二";
        day[3] = "星期三";
        day[4] = "星期四";
        day[5] = "星期五";
        day[6] = "星期六";
        return( yy + '年' + mm + '月'+ dd +'日 '+day[now.getDay()]);
    },
    getIntervalWeekends:function (beginDate,endDate) {
        /**
         * 获取一段时间中含有的周末数量
         */
        var weekends = 0;
        var dateDiffDays = this.dateDiff("d", beginDate, endDate)+1;
        if(dateDiffDays>0){
            for(var i=0;i<dateDiffDays;i++){
                var newDate = this.dateAdd("d",i,beginDate);
                if(newDate.getDay()==0 || newDate.getDay()==6){
                    weekends++;
                }
            }
        }
        return weekends;
    },
    timeStampString:function (time){
        /**
         * 时间戳转成时间
         *  time
         * @returns
         */
        var datetime = new Date();
        datetime.setTime(time);
        var year = datetime.getFullYear();
        var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
        var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
        var hour = datetime.getHours()< 10 ? "0" + datetime.getHours() : datetime.getHours();
        var minute = datetime.getMinutes()< 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
        var second = datetime.getSeconds()< 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
        return year + "-" + month + "-" + date+" "+hour+":"+minute+":"+second;
    },
    isLeapYear:function(date){
        /**
         * 判断闰年
         */
        return (0==date.getYear()%4&&((date.getYear()%100!=0)||(date.getYear()%400==0)));
    },
    numberLoader:function(obj,nums,times){
        /**
         * 数字加载动画
         */
        var k, i = 1;
        function isInteger(obj) {
            return obj%1 === 0
        }
        function counter() {
            var num = 100;
            if (i <= nums) {
                obj.html(i.toString());
                num = num - i;
                i++;
            } else {
                var numtep;
                if(isInteger(nums)){
                    numtep = nums;
                }else{
                    numtep = parseFloat(nums);
                }
                obj.html(numtep);
                window.clearInterval(k);
            }

        };

        function init() {
            var time = times ? times : 0,
                interval = time/100;
            k = window.setInterval(counter, interval);
        }
        init();
    },
    dateToStr:function(formatStr, date){
        /**
         * 日期对象转换为指定格式的字符串
         * f 日期格式,格式定义如下 yyyy-MM-dd HH:mm:ss
         *  date Date日期对象, 如果缺省,则为当前时间
         *
         * YYYY/yyyy/YY/yy 表示年份
         * MM/M 月份
         * W/w 星期
         * dd/DD/d/D 日期
         * hh/HH/h/H 时间
         * mm/m 分钟
         * ss/SS/s/S 秒
         * string 指定格式的时间字符串
         */
        formatStr = arguments[0] || "yyyy-MM-dd HH:mm:ss";
        date = arguments[1] || new Date();
        var str = formatStr;
        var Week = ['日','一','二','三','四','五','六'];
        str=str.replace(/yyyy|YYYY/,date.getFullYear());
        str=str.replace(/yy|YY/,(date.getYear() % 100)>9?(date.getYear() % 100).toString():'0' + (date.getYear() % 100));
        str=str.replace(/MM/,date.getMonth()>=9?(date.getMonth() + 1):'0' + (date.getMonth() + 1));
        str=str.replace(/M/g,date.getMonth());
        str=str.replace(/w|W/g,Week[date.getDay()]);

        str=str.replace(/dd|DD/,date.getDate()>9?date.getDate().toString():'0' + date.getDate());
        str=str.replace(/d|D/g,date.getDate());

        str=str.replace(/hh|HH/,date.getHours()>9?date.getHours().toString():'0' + date.getHours());
        str=str.replace(/h|H/g,date.getHours());
        str=str.replace(/mm/,date.getMinutes()>9?date.getMinutes().toString():'0' + date.getMinutes());
        str=str.replace(/m/g,date.getMinutes());

        str=str.replace(/ss|SS/,date.getSeconds()>9?date.getSeconds().toString():'0' + date.getSeconds());
        str=str.replace(/s|S/g,date.getSeconds());

        return str;
    },
    dateAdd:function(strInterval, num, date){
        /**
         * 日期计算
         *  strInterval string  可选值 y 年 m月 d日 w星期 ww周 h时 n分 s秒
         *  num int
         *  date Date 日期对象
         *  Date 返回日期对象
         */
        date =  arguments[2] || new Date();
        switch (strInterval) {
            case 's' :return new Date(date.getTime() + (1000 * num));
            case 'n' :return new Date(date.getTime() + (60000 * num));
            case 'h' :return new Date(date.getTime() + (3600000 * num));
            case 'd' :return new Date(date.getTime() + (86400000 * num));
            case 'w' :return new Date(date.getTime() + ((86400000 * 7) * num));
            case 'm' :return new Date(date.getFullYear(), (date.getMonth()) + num, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
            case 'y' :return new Date((date.getFullYear() + num), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds());
        }
    },
    dateDiff:function(strInterval, dtStart, dtEnd) { //如 'd',new Date("2016-8-22"),new Date("2016-8-25")
        /**
         * 比较日期差 dtEnd 格式为日期型或者有效日期格式字符串
         *  strInterval string  可选值 y 年 m月 d日 w星期 ww周 h时 n分 s秒
         *  dtStart Date  可选值 y 年 m月 d日 w星期 ww周 h时 n分 s秒
         *  dtEnd Date  可选值 y 年 m月 d日 w星期 ww周 h时 n分 s秒
         */
        switch (strInterval) {
            case 's' :return parseInt((dtEnd - dtStart) / 1000);
            case 'n' :return parseInt((dtEnd - dtStart) / 60000);
            case 'h' :return parseInt((dtEnd - dtStart) / 3600000);
            case 'd' :return parseInt((dtEnd - dtStart) / 86400000);
            case 'w' :return parseInt((dtEnd - dtStart) / (86400000 * 7));
            case 'm' :return (dtEnd.getMonth()+1)+((dtEnd.getFullYear()-dtStart.getFullYear())*12) - (dtStart.getMonth()+1);
            case 'y' :return dtEnd.getFullYear() - dtStart.getFullYear();
        }
    },
    strToDate:function(dateStr){
        /**
         * 字符串转换为日期对象
         *  date Date 格式为yyyy-MM-dd HH:mm:ss,必须按年月日时分秒的顺序,中间分隔符不限制
         */
        var data = dateStr;
        var reCat = /(\d{1,4})/gm;
        var t = data.match(reCat);
        t[1] = t[1] - 1;
        eval('var d = new Date('+t.join(',')+');');
        return d;
    },
    strFormatToDate:function(formatStr, dateStr){
        /**
         * 把指定格式的字符串转换为日期对象yyyy-MM-dd HH:mm:ss
         *
         */
        var year = 0;
        var start = -1;
        var len = dateStr.length;
        if((start = formatStr.indexOf('yyyy')) > -1 && start < len){
            year = dateStr.substr(start, 4);
        }
        var month = 0;
        if((start = formatStr.indexOf('MM')) > -1  && start < len){
            month = parseInt(dateStr.substr(start, 2)) - 1;
        }
        var day = 0;
        if((start = formatStr.indexOf('dd')) > -1 && start < len){
            day = parseInt(dateStr.substr(start, 2));
        }
        var hour = 0;
        if( ((start = formatStr.indexOf('HH')) > -1 || (start = formatStr.indexOf('hh')) > 1) && start < len){
            hour = parseInt(dateStr.substr(start, 2));
        }
        var minute = 0;
        if((start = formatStr.indexOf('mm')) > -1  && start < len){
            minute = dateStr.substr(start, 2);
        }
        var second = 0;
        if((start = formatStr.indexOf('ss')) > -1  && start < len){
            second = dateStr.substr(start, 2);
        }
        return new Date(year, month, day, hour, minute, second);
    },
    dateToLong:function(date){
        /**
         * 日期对象转换为毫秒数
         */
        return date.getTime();
    },
    longToDate:function(dateVal){
        /**
         * 毫秒转换为日期对象
         *  dateVal number 日期的毫秒数
         */
        return new Date(dateVal);
    },
    isDate:function(str, formatStr){
        /**
         * 判断字符串是否为日期格式
         *  str string 字符串
         *  formatStr string 日期格式, 如下 yyyy-MM-dd
         */
        if (formatStr == null){
            formatStr = "yyyyMMdd";
        }
        var yIndex = formatStr.indexOf("yyyy");
        if(yIndex==-1){
            return false;
        }
        var year = str.substring(yIndex,yIndex+4);
        var mIndex = formatStr.indexOf("MM");
        if(mIndex==-1){
            return false;
        }
        var month = str.substring(mIndex,mIndex+2);
        var dIndex = formatStr.indexOf("dd");
        if(dIndex==-1){
            return false;
        }
        var day = str.substring(dIndex,dIndex+2);
        if(!this.isNumber(year)||year>"2100" || year< "1900"){
            return false;
        }
        if(!this.isNumber(month)||month>"12" || month< "01"){
            return false;
        }
        if(day>this.getMaxDay(year,month) || day< "01"){
            return false;
        }
        return true;
    },
    getMaxDay:function(year,month) {
        /**
         *    输入年月 判断当下月的最大天数
         */
        if(month==4||month==6||month==9||month==11)
            return "30";
        if(month==2)
            if(year%4==0&&year%100!=0 || year%400==0)
                return "29";
            else
                return "28";
        return "31";
    },
    isNumber:function(str){
        /**
         *    变量是否为数字
         */
        var regExp = /^\d+$/g;
        return regExp.test(str);
    },
    toArray:function(myDate){
        /**
         * 把日期分割成数组 [年、月、日、时、分、秒]
         */
        myDate = arguments[0] || new Date();
        var myArray = Array();
        myArray[0] = myDate.getFullYear();
        myArray[1] = myDate.getMonth();
        myArray[2] = myDate.getDate();
        myArray[3] = myDate.getHours();
        myArray[4] = myDate.getMinutes();
        myArray[5] = myDate.getSeconds();
        return myArray;
    },
    datePart:function(interval, myDate){
        /**
         * 取得日期数据信息
         * 参数 interval 表示数据类型
         * y 年 M月 d日 w星期 ww周 h时 n分 s秒
         */
        myDate = arguments[1] || new Date();
        var partStr='';
        var Week = ['日','一','二','三','四','五','六'];
        switch (interval)
        {
            case 'y' :partStr = myDate.getFullYear();break;
            case 'M' :partStr = myDate.getMonth()+1;break;
            case 'd' :partStr = myDate.getDate();break;
            case 'w' :partStr = Week[myDate.getDay()];break;
            case 'ww' :partStr = myDate.WeekNumOfYear();break;
            case 'h' :partStr = myDate.getHours();break;
            case 'm' :partStr = myDate.getMinutes();break;
            case 's' :partStr = myDate.getSeconds();break;
        }
        return partStr;
    },
    maxDayOfDate:function(date){
        /**
         * 取得当前日期所在月的最大天数
         */
        date = arguments[0] || new Date();
        date.setDate(1);
        date.setMonth(date.getMonth() + 1);
        var time = date.getTime() - 24 * 60 * 60 * 1000;
        var newDate = new Date(time);
        return newDate.getDate();
    },
    get_weekData:function (dataNum){
        //往前推n天
        var numTemp = dataNum-1;
        var myDate = new Date();
        myDate.setDate(myDate.getDate() - numTemp);
        var dArray = [];
        var dateArray = [];
        var dateNumArray = [];
        var dateTemp;
        var flag = 1;
        for (var i = 0; i < (numTemp+1); i++) {
            var month = myDate.getMonth()+1;
            var day = myDate.getDate();
            if((month+'').length==1){
                month = "0"+month;
            }
            if((day+'').length==1){
                day = "0"+day
            }
            dateTemp = month+"-"+day;
            dateArray.push(dateTemp);
            dateNumArray.push(day);
            myDate.setDate(myDate.getDate() + flag);
        }
        dArray.push(dateArray);
        dArray.push(dateNumArray);
        return dArray;
    },
    get_weekHour:function (hourNum){
        //往前推n小时
        var numTemp = hourNum-1;
        var hArray = [];
        var hourArray = [];
        var hourNumArray = [];
        var hourTemp;
        var myDate = new Date();
        var hours = myDate.setHours(myDate.getHours() - numTemp);
        var hoursN = myDate.getHours(hours);
        if ((hoursN + '').length == 1) {
            hoursN = "0" + hoursN;
        }
        for (var i = 0; i < (numTemp + 1); i++) {
            datap = myDate.getDate();
            hours = myDate.setHours(myDate.getHours() + 1);
            hoursN = myDate.getHours(hours);
            if ((myDate.getHours(hours) + '').length == 1) {
                hoursN = "0" + hoursN;
            }
            hourTemp = datap + "-" + hoursN;
            hourArray.push(hourTemp);
            hourNumArray.push(hoursN);
        }
        hArray.push(hourArray);
        hArray.push(hourNumArray);
        return hArray;
    },
    numToStr:function (numbers) {
        /**
            * 数字转汉字
            * result (String)
            */
        var ary0=["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
        var ary1=["", "十", "百", "千"];
        var ary2=["", "万", "亿", "兆"];
        var $this = this;
        var ary = function () {
            var aryg = [];
            for (var i = numbers.length; i >= 0; i--) {
                aryg.push(numbers[i]);
            }
            return aryg.join("");
        };
        var zero = "";
        var newary = "";
        var i4 = -1;
        for (var i = 0; i < ary().length; i++) {
            if (i % 4 == 0) { //首先判断万级单位,每隔四个字符就让万级单位数组索引号递增
                i4++;
                newary = ary2[1] + newary; //将万级单位存入该字符的读法中去,它肯定是放在当前字符读法的末尾,所以首先将它叠加入$r中,
                zero = ""; //在万级单位位置的“0”肯定是不用的读的,所以设置零的读法为空

            }
            //关于0的处理与判断。
            if (ary()[i] == '0') { //如果读出的字符是“0”,执行如下判断这个“0”是否读作“零”
                switch (i % 4) {
                    case 0:
                        break;
                    //如果位置索引能被4整除,表示它所处位置是万级单位位置,这个位置的0的读法在前面就已经设置好了,所以这里直接跳过
                    case 1:
                    case 2:
                    case 3:
                        if (ary()[i - 1] != '0') {
                            zero = "零"
                        }
                        ; //如果不被4整除,那么都执行这段判断代码:如果它的下一位数字(针对当前字符串来说是上一个字符,因为之前执行了反转)也是0,那么跳过,否则读作“零”
                        break;

                }

                newary = zero + newary;
                zero = '';
            }
            else { //如果不是“0”
                newary = ary0[parseInt(ary()[i])] + ary1[i % 4] + newary; //就将该当字符转换成数值型,并作为数组ary0的索引号,以得到与之对应的中文读法,其后再跟上它的的一级单位(空、十、百还是千)最后再加上前面已存入的读法内容。
            }

        }
        if (newary.indexOf("零") == 0) {
            newary = newary.substr(1)
        }//处理前面的0
        return newary;
    },
    //金钱计算
    moneyMath:{
        //加
        add:function(a,b){
            var c, d, e;
            try {
                c = a.toString().split(".")[1].length;
            } catch (f) {
                c = 0;
            }
            try {
                d = b.toString().split(".")[1].length;
            } catch (f) {
                d = 0;
            }
            return e = Math.pow(10, Math.max(c, d)), (this.mul(a, e) + this.mul(b, e)) / e;
        },
        //减法
        sub:function(a,b){
            var c, d, e;
            try {
                c = a.toString().split(".")[1].length;
            } catch (f) {
                c = 0;
            }
            try {
                d = b.toString().split(".")[1].length;
            } catch (f) {
                d = 0;
            }
            return e = Math.pow(10, Math.max(c, d)), (this.mul(a, e) - this.mul(b, e)) / e;
        },
        //乘法
        mul:function (a,b) {
            var c = 0,
                d = a.toString(),
                e = b.toString();
            try {
                c += d.split(".")[1].length;
            } catch (f) {}
            try {
                c += e.split(".")[1].length;
            } catch (f) {}
            return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
        },
        //除法
        div:function (a,b) {
            var c, d, e = 0,
                f = 0;
            try {
                e = a.toString().split(".")[1].length;
            } catch (g) {}
            try {
                f = b.toString().split(".")[1].length;
            } catch (g) {}
            return c = Number(a.toString().replace(".", "")), d = Number(b.toString().replace(".", "")), this.mul(c / d, Math.pow(10, f - e));
        }
    },
    keepTwoDecimal:function(num) {
        var result = parseFloat(num);
        if (isNaN(result)) {
            alert('传递参数错误,请检查!');
            return false;
        }
        result = Math.round(num * 100) / 100;
        return result;
    },
    //数字转大写
    numSmalltoBIG:function (n){
        var fraction = ['角', '分'];
        var digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
        var unit = [ ['元', '万', '亿'], ['', '拾', '佰', '仟']  ];
        var head = n < 0? '负': '';
        n = Math.abs(n);

        var s = '';

        for (var i = 0; i < fraction.length; i++){
            s += (digit[Math.floor(this.moneyMath.mul(this.moneyMath.mul(n,10),Math.pow(10, i))) % 10] + fraction[i]).replace(/零./, '');
        }

        s = s || '整';

        n = Math.floor(n);

        for (var i = 0; i < unit[0].length && n > 0; i++){
            var p = '';
            for (var j = 0; j < unit[1].length && n > 0; j++){
                p = digit[n % 10] + unit[1][j] + p;
                n = Math.floor(this.moneyMath.div(n,10));
            }
            s = p.replace(/(零.)*零$/, '').replace(/^$/, digit[0])  + unit[0][i] + s;
        }
        var reslut = head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整');
        var array = reslut.split('元');
        if(array.length == 2 && array[1].indexOf("整") == -1){
            array[1] = '零'+array[1];
            reslut = array.join('元');
        }
        return reslut;
    },
    //验证当前页面 form 是否被修改过
    formIsDirty:function(form) {
        if(jsTool.isNull(form)){
            form = $("body");
        }
        var elements = form.find("input,select,textarea");				//获取输入框控件
        for (var i = 0; i < elements.length; i++) {
            var element = elements[i];
            var type = element.type;
            if (type == "checkbox" || type == "radio") {
                if (element.checked != element.defaultChecked) {
                    return true;
                }
            }else if (type == "hidden" || type == "password" || type == "text" || type == "textarea") {
                if (element.value != element.defaultValue) {
                    return true;
                }
            }else if (type == "select-one" || type == "select-multiple") {
                for (var j = 0; j < element.options.length; j++) {
                    if($(element.options[j]).attr("selected") == "selected"){
                        if (element.options[j].selected != element.options[j].defaultSelected) {
                            return true;
                        }
                    }

                }
            }
        }
        return false;
    },
    //字符串加密
    strEncryption:function ( str ) {
        return window.btoa(unescape(encodeURIComponent( str )));
    },
    //字符串解密
    strDecrypt:function ( str ) {
        return decodeURIComponent(escape(window.atob( str )));
    },
    TableSorter:function (data){
        /*使用说明  :    表格排序
        方法1:
            new jsToll.TableSorter(obj);
        效果:
            id为tb1的table的第一行任意单元格都可以点击进行排序.

        方法2:
            new jsToll.TableSorter(obj, 0, 1, 3);
        效果:
            id为tb1的table的第一行0,1,3单元格可以进行点击排序.
        */
        var TableSorter_Info={
            tableObject : data.obj,
            tableObj : data.obj[0],
            tableObjTem : data.obj[0].innerHTML,
            Rows : [],
            Header : [],
            ViewState : [],
            LastSorted : null,
            NormalCss : "NormalCss",
            SortAscCss : "SortAscCss",
            SortDescCss : "SortDescCss",
            HeaderTemp : "",
            ViewStateTemp : "",
            rowsp:[]
        };

        try {
            if (!jsTool.isNull(data.method)) {
                data.method();
            }
        } catch (e) {
            console.error('表格排序自定义方法错误: ',  e.message);
        }

        TableSorter_Info.init=function(){
            var me=this;
            TableSorter_Info.TableSorterSet(me.tableObj);
        };

        TableSorter_Info.InitSet = function(args)//初始化表格的信息和操作
        {
            var me=this;
            for(var x = 0; x < me.tableObj.rows.length; x++)
            {
                me.Rows.push(me.tableObj.rows[x]);
            }

            me.Header = me.Rows.shift().cells;

            for(var i=0;i<me.Rows.length;i++){
                TableSorter_Info.rowsp[i] = me.Rows[i]
            }

            for(var x = 0; x < (args.length ? args.length : me.Header.length); x++)
            {
                var rowIndex = args.length ? args[x] : x;
                if(rowIndex >= me.Header.length)
                {
                    continue;
                }
                me.ViewState[rowIndex] = "def";
                me.Header[rowIndex].style.cursor = "pointer";
                me.Header[rowIndex].onclick = me.GetFunction(me, "Sort", rowIndex);

                if ($(me.Header[rowIndex]).children("a").length > 0) {
                    $(me.Header[rowIndex]).children("a").remove();
                }
                var container_a = document.createElement('a');
                $(me.Header[rowIndex]).append(container_a);
                var container_a_div_top = document.createElement('div');
                $(container_a).append(container_a_div_top);
                var container_a_div_buttom = document.createElement('div');
                $(container_a).append(container_a_div_buttom);
                $(me.Header[rowIndex]).css("position","relative");
                $(container_a).css({
                    "display": "block",
                    "position": "absolute",
                    "top": "50%",
                    "right": "0",
                    "width": "1em",
                    "height": "1em",
                    "margin-top": "-.5em"
                });
                $(container_a_div_top).css({
                    "border-top": ".25em solid transparent",
                    "border-right": ".35em solid transparent",
                    "border-bottom": ".25em solid rgba(0,0,0,.25)",
                    "border-left": ".35em solid transparent",
                    "position": "absolute",
                    "left": "0",
                    "width": "0",
                    "height": "0",
                    "transition": ".125s ease-in-out",
                    "-webkit-box-sizing": "border-box",
                    "-moz-box-sizing": "border-box",
                    "box-sizing": "border-box"
                });
                $(container_a_div_buttom).css({
                    "border-top": ".25em solid rgba(0,0,0,.25)",
                    "border-right": ".35em solid transparent",
                    "border-bottom": ".25em solid transparent",
                    "border-left": ".35em solid transparent",
                    "position": "absolute",
                    "left": "0",
                    "width": "0",
                    "height": "0",
                    "transition": ".125s ease-in-out",
                    "-webkit-box-sizing": "border-box",
                    "-moz-box-sizing": "border-box",
                    "box-sizing": "border-box"
                });
                if (!jsTool.isNull(data.color)) {
                    $(container_a_div_top).css("border-bottom", ".25em solid "+data.color);
                    $(container_a_div_buttom).css("border-top", ".25em solid "+data.color);
                }

                $(container_a_div_top).css("top","-0.1em");
                $(container_a_div_top).css("opacity","1");

                $(container_a_div_buttom).css("bottom","-0.1em");
                $(container_a_div_buttom).css("opacity","1");
            }
        };
        TableSorter_Info.GetFunction = function(variable,method,param)//取得指定对象的指定方法.
        {
            return function()
            {
                variable[method](param);
            }
        };
        TableSorter_Info.Sort = function(column)//执行排序.
        {
            var me=this;
            var SortAsNumber = true;
            for(var x = 0; x < me.Rows.length && SortAsNumber; x++)
            {
                SortAsNumber = me.IsNumeric(me.Rows[x].cells[column].innerHTML);
            }
            me.Rows.sort(
                function(row1, row2)
                {
                    var result;
                    var value1,value2;
                    value1 = row1.cells[column].innerHTML;
                    value2 = row2.cells[column].innerHTML;
                    if(value1 == value2)
                    {
                        return 0;
                    }
                    if(SortAsNumber)
                    {
                        result = parseFloat(value1) > parseFloat(value2);
                    }
                    else
                    {
                        result = value1 > value2;
                    }
                    result = result ? 1 : -1;
                    return result;
                });
            if(me.ViewState[column] == "def"){
                me.ViewState[column] = "asc";
                if ($(me.Header[column]).children("a").length > 0) {
                    $(me.Header[column]).children("a").remove();
                }
                var container_a = document.createElement('a');
                $(me.Header[column]).append(container_a);
                var container_a_div_top = document.createElement('div');
                $(container_a).append(container_a_div_top);
                var container_a_div_buttom = document.createElement('div');
                $(container_a).append(container_a_div_buttom);
                $(me.Header[column]).css("position","relative");
                $(container_a).css({
                    "display": "block",
                    "position": "absolute",
                    "top": "50%",
                    "right": "0",
                    "width": "1em",
                    "height": "1em",
                    "margin-top": "-.5em"
                });
                $(container_a_div_top).css({
                    "border-top": ".25em solid transparent",
                    "border-right": ".35em solid transparent",
                    "border-bottom": ".25em solid rgba(0,0,0,.25)",
                    "border-left": ".35em solid transparent",
                    "position": "absolute",
                    "left": "0",
                    "width": "0",
                    "height": "0",
                    "transition": ".125s ease-in-out",
                    "-webkit-box-sizing": "border-box",
                    "-moz-box-sizing": "border-box",
                    "box-sizing": "border-box"
                });
                $(container_a_div_buttom).css({
                    "border-top": ".25em solid rgba(0,0,0,.25)",
                    "border-right": ".35em solid transparent",
                    "border-bottom": ".25em solid transparent",
                    "border-left": ".35em solid transparent",
                    "position": "absolute",
                    "left": "0",
                    "width": "0",
                    "height": "0",
                    "transition": ".125s ease-in-out",
                    "-webkit-box-sizing": "border-box",
                    "-moz-box-sizing": "border-box",
                    "box-sizing": "border-box"
                });

                if (!jsTool.isNull(data.color)) {
                    $(container_a_div_top).css("border-bottom", ".25em solid "+data.color);
                    $(container_a_div_buttom).css("border-top", ".25em solid "+data.color);
                }

                $(container_a_div_top).css("top","0.1em");
                $(container_a_div_buttom).css("opacity","0");

                me.LastSorted = me.Header[column];
                var frag = document.createDocumentFragment();
                for(var x = 0; x < me.Rows.length; x++)
                {
                    frag.appendChild(me.Rows[x]);
                }
                me.tableObj.tBodies[0].appendChild(frag);
                me.HeaderTemp = me.Header[column];
                me.ViewStateTemp = me.ViewState[column];
            }else if(me.ViewState[column] == "asc"){
                me.Rows.reverse();
                me.ViewState[column] = "desc";
                if ($(me.Header[column]).children("a").length > 0) {
                    $(me.Header[column]).children("a").remove();
                }
                var container_a = document.createElement('a');
                $(me.Header[column]).append(container_a);
                var container_a_div_top = document.createElement('a');
                $(container_a).append(container_a_div_top);
                var container_a_div_buttom = document.createElement('div');
                $(container_a).append(container_a_div_buttom);

                $(me.Header[column]).css("position","relative");
                $(container_a).css({
                    "display": "block",
                    "position": "absolute",
                    "top": "50%",
                    "right": "0",
                    "width": "1em",
                    "height": "1em",
                    "margin-top": "-.5em"
                });
                $(container_a_div_top).css({
                    "border-top": ".25em solid transparent",
                    "border-right": ".35em solid transparent",
                    "border-bottom": ".25em solid rgba(0,0,0,.25)",
                    "border-left": ".35em solid transparent",
                    "position": "absolute",
                    "left": "0",
                    "width": "0",
                    "height": "0",
                    "transition": ".125s ease-in-out",
                    "-webkit-box-sizing": "border-box",
                    "-moz-box-sizing": "border-box",
                    "box-sizing": "border-box"
                });
                $(container_a_div_buttom).css({
                    "border-top": ".25em solid rgba(0,0,0,.25)",
                    "border-right": ".35em solid transparent",
                    "border-bottom": ".25em solid transparent",
                    "border-left": ".35em solid transparent",
                    "position": "absolute",
                    "left": "0",
                    "width": "0",
                    "height": "0",
                    "transition": ".125s ease-in-out",
                    "-webkit-box-sizing": "border-box",
                    "-moz-box-sizing": "border-box",
                    "box-sizing": "border-box"
                });

                if (!jsTool.isNull(data.color)) {
                    $(container_a_div_top).css("border-bottom", ".25em solid "+data.color);
                    $(container_a_div_buttom).css("border-top", ".35em solid "+data.color);
                }

                $(container_a_div_top).css("opacity","0");
                $(container_a_div_buttom).css("bottom","0.1em");

                me.LastSorted = me.Header[column];
                var frag = document.createDocumentFragment();
                for(var x = 0; x < me.Rows.length; x++)
                {
                    frag.appendChild(me.Rows[x]);
                }
                me.tableObj.tBodies[0].appendChild(frag);
                me.HeaderTemp = me.Header[column];
                me.ViewStateTemp = me.ViewState[column];
            }else if(me.ViewState[column] == "desc"){
                me.Rows.sort(
                    function(row1, row2)
                    {
                        var value1,value2;
                        var rowsN = TableSorter_Info.rowsp;
                        for(var i=0;i<rowsN.length;i++){
                            if(rowsN[i] == row1){
                                value1 = i;
                                break;
                            }
                        }
                        for(var i=0;i<rowsN.length;i++){
                            if(rowsN[i] == row2){
                                value2 = i;
                                break;
                            }
                        }
                        var result;

                        if(value1 == value2)
                        {
                            return 0;
                        }
                        if(SortAsNumber)
                        {
                            result = parseFloat(value1) > parseFloat(value2);
                        }
                        else
                        {
                            result = value1 > value2;
                        }
                        result = result ? 1 : -1;
                        return result;
                    });


                me.ViewState[column] = "def";
                if ($(me.Header[column]).children("a").length > 0) {
                    $(me.Header[column]).children("a").remove();
                }
                var container_a = document.createElement('a');
                $(me.Header[column]).append(container_a);
                var container_a_div_top = document.createElement('a');
                $(container_a).append(container_a_div_top);
                var container_a_div_buttom = document.createElement('div');
                $(container_a).append(container_a_div_buttom);

                $(me.Header[column]).css("position","relative");
                $(container_a).css({
                    "display": "block",
                    "position": "absolute",
                    "top": "50%",
                    "right": "0",
                    "width": "1em",
                    "height": "1em",
                    "margin-top": "-.5em"
                });
                $(container_a_div_top).css({
                    "border-top": ".25em solid transparent",
                    "border-right": ".35em solid transparent",
                    "border-bottom": ".25em solid rgba(0,0,0,.25)",
                    "border-left": ".35em solid transparent",
                    "position": "absolute",
                    "left": "0",
                    "width": "0",
                    "height": "0",
                    "transition": ".125s ease-in-out",
                    "-webkit-box-sizing": "border-box",
                    "-moz-box-sizing": "border-box",
                    "box-sizing": "border-box"
                });
                $(container_a_div_buttom).css({
                    "border-top": ".25em solid rgba(0,0,0,.25)",
                    "border-right": ".35em solid transparent",
                    "border-bottom": ".25em solid transparent",
                    "border-left": ".35em solid transparent",
                    "position": "absolute",
                    "left": "0",
                    "width": "0",
                    "height": "0",
                    "transition": ".125s ease-in-out",
                    "-webkit-box-sizing": "border-box",
                    "-moz-box-sizing": "border-box",
                    "box-sizing": "border-box"
                });
                if (!jsTool.isNull(data.color)) {
                    $(container_a_div_top).css("border-bottom", ".25em solid "+data.color);
                    $(container_a_div_buttom).css("border-top", ".25em solid "+data.color);
                }

                $(container_a_div_top).css("top","-0.1em");
                $(container_a_div_top).css("opacity","1");

                $(container_a_div_buttom).css("bottom","-0.1em");
                $(container_a_div_buttom).css("opacity","1");

                me.LastSorted = me.Header[column];
                var frag = document.createDocumentFragment();
                for(var x = 0; x < me.Rows.length; x++)
                {
                    frag.appendChild(me.Rows[x]);
                }
                me.tableObj.tBodies[0].appendChild(frag);
                me.HeaderTemp = me.Header[column];
                me.ViewStateTemp = me.ViewState[column];
            }
        };
        TableSorter_Info.IsNumeric = function(num)//验证是否是数字类型.
        {
            return /^\d+(\.\d+)?$/.test(num);
        };

        TableSorter_Info.TableSorterSet=function(){
            var me=this;
            if(this.tableObj.rows.length <= 1)
            {
                return;
            }
            var args = [];
            if (!jsTool.isNull(data.order)) {
                args = data.order;
            }
            me.InitSet(args);
        };

        TableSorter_Info.init();
    }

};
//创建class类
function JsTool() {
    this.init.apply(this, arguments);
}
JsTool.prototype = Js_Tool;





//常用工具加载
var jsTool = new JsTool();
//# sourceURL=jsTool v1.0.5

压缩版 前端工具类库
压缩版 < jstool-1.0.5.min.js > 用于项目中 极少占用空间。

/*!
 * JsTool v1.0.5
 * Date 2018-9-10 10:45:48
 * Author Parker
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('p 32={2u:8(a){},7E:8(a){j 4a 0==a||1C==a?!0:!1},1F:8(a){j 4a 0==a||1C==a||""==a||""==a||"49"==a||"1C"==a||"7B"==a?!0:!1},2m:8(a){a=a.G(/(^\\s*)|(\\s*$)/g,"");j""==a||"1C"==a.2n()||0>=a.r?!0:!1},2w:8(a,b,c){p e="";o.2m(a)||(e=a,e=-1<a.z("?")?e+"&":e+"?",e=e+b+"="+c);j e.V()},7A:8(a,b){b=o.2w(b,"3r",(I O).1t());a.v("47","3q");$.3p(b,{},8(b){a.2a(b)})},7v:8(a,b,c){p e=o.2w(b,"3r",(I O).1t());a.v("47","3q");$.3p(e,{},8(b){a.2a(b)});1w.44(8(){p c=b;c=32.2w(c,"3r",(I O).1t());$.3p(c,{},8(b){a.2a(b)})},c)},1W:8(){p a=1w.Q.3o.3n,b=1w.Q.3o.7r,c=a.z(b),e=a.1f(0,c),f=b.1f(0,b.1z(1).z("/")+1);j[a,b,c,e,f,e+f+"/"]},7q:8(){j o.1W()[0]},7p:8(){j o.1W()[1]},7o:8(){j o.1W()[2]},7n:8(){j o.1W()[3]},7m:8(){j o.1W()[4]},7l:8(){j o.1W()[5]},7k:8(a,b,c){c||(c=0);E(p e=[],f=0;f<a;f++)e.1o(x(c+1d.42()*(b-c+1)));j e},41:8(a,b){C("7h"==b){p c=Q.1c("7g");c.23("3m","3l/7d");c.23("7c",a)}1R"v"==b&&(c=Q.1c("7b"),c.23("7a","79"),c.23("3m","3l/v"),c.23("3n",a));"49"!=78 c?Q.77("76")[0].1T(c):1X.27("41 3j 3R!")},6K:8(a){a=1C==a?1w.3o.3n:a;p b={};a.1f(a.6G("?")+1).G(/([^?&=]+)=([^?&=]*)/g,8(a,e,f){e=2H(e);f=2H(f);f=3N(f);b[e]=f;j a});j b},6E:8(){p a=1w.6D.6C;j{6A:-1<a.z("6o"),6b:-1<a.z("69"),62:-1<a.z("3c"),5A:-1<a.z("5y")&&-1==a.z("5x"),5w:!!a.2x(/3c.*5u.*/)||!!a.2x(/3c/),5k:!!a.2x(/\\(i[^;]+;( U;)? 4N.+40 4K X/),4A:-1<a.z("4z")||-1<a.z("4y"),3L:-1<a.z("3L")||-1<a.z("40"),3J:-1<a.z("3J"),4q:-1==a.z("4p"),4o:-1==a.z("4j")}},7N:8(a){a=T("[1y=\'"+a+"\']");E(p b=!1,c=0;c<a.r;c++)C(1==a[c].1l){b=!0;1u}j b},7M:8(a){a=T("[1y=\'"+a+"\']");E(p b=0,c=0;c<a.r;c++)1==a[c].1l&&b++;j b},7L:8(a){p b="";T("[1y=\'"+a+"\'][1l]").1S(8(){b+=T(o).2r()});j b},3z:8(a){p b="";T("[1y=\'"+a+"\'][1l]").1S(8(){b+=T(o).2r()+"@"});j b.1f(0,b.r-1)},7I:8(a){p b="";T("[1y=\'"+a+"\'][1l]").1S(8(){p a=T(o).2r();-1==a.z(",")?b+=a+",":(a=a.R(","),b+=a[0]+",")});j b.1f(0,b.r-1)},7H:8(a){p b=a="",c="";T("[1y=\'3y\'][1l]").1S(8(){p a=T(o).2r().R(","),f=a[1];b+=a[0]+",";c+=f+", "});j a=b.1f(0,b.r-1)+"|"+c.1f(0,c.r-2)},7F:8(a){a=o.3z(a).R("@");E(p b="",c=0;c<a.r;c++){p e=a[c];e=e.1f(e.r-1,e.r);b+=e}j b},7y:8(a){T("[1y=\'"+a+"\']").1S(8(){T(o).1Z("1l",!0)})},7x:8(a){T("[1y=\'"+a+"\']").1S(8(){T(o).1Z("1l")?T(o).1Z("1l",!1):T(o).1Z("1l",!0)})},7w:8(a){T("[1y=\'"+a+"\']").1S(8(){T(o).1Z("1l",!1)})},7t:8(a){j/^(([0-1][0-9])|([2][0-4]))(:)[0-5][0-9](:)[0-5][0-9]$/g.L(a)},4R:8(a){j/^([1-9]|[1-9]\\d|1\\d{2}|2[0-1]\\d|22[0-3])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}$/.L(a)},4t:8(a){j/^([a-7J-7D]{1})([\\w]*)$/g.L(a)},56:8(a,b){a=a.3a(b);j x(a)},5s:8(a,b,c,e){E(p f=!1;c<=e;c++){p g=a.3a(c);b==g&&(f=!0)}j f},5I:8(a,b){j a==b?!0:!1},7f:8(a){j 2b(a)},7G:8(a){j/^[0-9]+(\\.[0-9]+)?$/g.L(a)},4u:8(a){j/^[0-9]+\\d*[\\.\\d]?\\d{0,1}$/g.L(a)},4B:8(a){j/^[1-9][0-9]?$/g.L(a)},4C:8(a){j/^(\\-|\\+)?\\d+(\\.\\d+)?$/.L(a)},4D:8(a){j/^[0-9]+(.[0-9]{2})?$/g.L(a)},4H:8(a){j/^[0-9]+(.[0-9]{1,2})?$/g.L(a)},4J:8(a){j/^[1-9]+\\d*[\\.\\d]?\\d{0,2}$/g.L(a)},4M:8(a){j/\\s/g.L(a)},4P:8(a){j/^[1-9]{1}[0-9]{1,7}$/g.L(a)},57:8(a){j/^[1-9]{1}[0-9]{1,2}$/g.L(a)},59:8(a){j/^[0-9]*[1-9][0-9]*$/g.L(a)},5i:8(a){j/^[1-9]\\d*|0$/g.L(a)},37:8(a){p b=a.R(".");a=x(b[0]);p c=x(b[1]),e=x(b[2]);b=x(b[3]);j 5z*a+48*c+6g*e+b},6p:8(a,b){a=o.37(a);j o.37(b)>a?!0:!1},6z:8(a,b){b=x(b);p c=a.R(":");a=2N*x(c[0]);p e=60*x(c[1]);c=x(c[2]);b=x(a)+x(e)+x(c)+x(b);j o.4f(b)},4f:8(a){C(!(1C==a||0>a)){p b=x(a);a=b/2N|0;b=x(b)-2N*x(a);10>x(a)&&(a="0"+a);24<=x(a)&&(a="4l");p c=x(b)/60|0;b=x(b)-60*x(c);10>x(c)&&(c="0"+c);10>x(b)&&(b="0"+b);j a+":"+c+":"+b}},4s:8(a){C(2I(a))j 1X.27("\\2O\\2P\\2Q\\2R\\2S\\2T\\2U\\2G\\4O\\3W\\4Q\\2E"),!1;p b=a.r;C(15>b||18<b)j 1X.27("\\2O\\2P\\2Q\\2R\\2S\\2T\\2U\\4S\\4W\\53\\2G\\2V\\2W\\3u\\2E\\5d\\5h\\3w\\5r\\3w"),!1;b=/^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{4}$/;a=/^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$/.L(a)||b.L(a);j 0==a?(1X.27("\\2O\\2P\\2Q\\2R\\2S\\2T\\2U\\2X\\3V\\2G\\2V\\2W\\2E"),!1):a},5C:8(a){j/^(0[0-9]{2,3}\\-)?([2-9][0-9]{6,7})+(\\-[0-9]{1,4})?$/.L(a)},5J:8(a){j/^((\\(\\d{3}\\))|(\\d{3}\\-))?1\\d{10}/.L(a)},68:8(a){C(-1!=a.6f(/^\\w+((-\\w+)|(\\.\\w+))*@[A-2Y-2Z-9]+((\\.|-)[A-2Y-2Z-9]+)*\\.[A-2Y-2Z-9]+$/))j!0;1X.27("\\6F\\6H\\6I\\6J\\2X\\3V\\2G\\2V\\2W");j!1},6L:8(a){j/^[1-9]\\d{5}$/.L(a)},6M:8(a){j/^[\\6V-\\6W]+$/.L(a)},6X:8(a,b,c){c&&(a=a.2n(),b=b.2n());c=b.1f(0,1);E(p e=b.r,f=0;f<a.r-e+1;f++)C(a.3a(f)==c&&a.1f(f,f+e)==b)j!0;j!1},6Z:8(){p a=8(){j(48*(1+1d.42())|0).V(16).1f(1)};j a()+a()+a()+a()+a()+a()+a()+a()},74:8(a){a=/\\.[^\\.]+$/.75(a);j(I 3N(a)).2n()},7e:8(a){j 3v(a)},7i:8(a){j 2H(a)},7j:8(a){j o.2m(a)||2I(a)?0:x(a)},7s:8(a){j o.2m(a)||2I(a)?0:1Q(a)},7u:8(){p a=I O,b=a.1q(),c=a.13()+1,e=a.Z();j b+"\\7z"+c+"\\7C"+e+"\\2d "+"\\1V\\1U\\2d \\1V\\1U\\2v \\1V\\1U\\2t \\1V\\1U\\2s \\1V\\1U\\2p \\1V\\1U\\2o \\1V\\1U\\2j".R(" ")[a.26()]},4k:8(a,b){p c=0;b=o.3F("d",a,b)+1;C(0<b)E(p e=0;e<b;e++){p f=o.3I("d",e,a);0!=f.26()&&6!=f.26()||c++}j c},4m:8(a){p b=I O;b.4n(a);a=b.1q();p c=10>b.13()+1?"0"+(b.13()+1):b.13()+1,e=10>b.Z()?"0"+b.Z():b.Z(),f=10>b.19()?"0"+b.19():b.19(),g=10>b.1r()?"0"+b.1r():b.1r();b=10>b.1p()?"0"+b.1p():b.1p();j a+"-"+c+"-"+e+" "+f+":"+g+":"+b},4r:8(a){j 0==a.1Y()%4&&(0!=a.1Y()%1I||0==a.1Y()%3M)},4v:8(a,b,c){p e=1;p f=1w.44(8(){C(e<=b)a.2a(e.V()),e++;1R{p c=0===b%1?b:1Q(b);a.2a(c);1w.4w(f)}},(c?c:0)/1I)},4x:8(a,b){b=b||I O;a=(a||"2L-2K-2J 33:34:35").G(/2L|4E/,b.1q());a=a.G(/4F|4G/,9<b.1Y()%1I?(b.1Y()%1I).V():"0"+b.1Y()%1I);a=a.G(/2K/,9<=b.13()?b.13()+1:"0"+(b.13()+1));a=a.G(/M/g,b.13());a=a.G(/w|W/g,"\\2d\\2v\\2t\\2s\\2p\\2o\\2j".R("")[b.26()]);a=a.G(/2J|4I/,9<b.Z()?b.Z().V():"0"+b.Z());a=a.G(/d|D/g,b.Z());a=a.G(/3Z|33/,9<b.19()?b.19().V():"0"+b.19());a=a.G(/h|H/g,b.19());a=a.G(/34/,9<b.1r()?b.1r().V():"0"+b.1r());a=a.G(/m/g,b.1r());a=a.G(/35|4L/,9<b.1p()?b.1p().V():"0"+b.1p());j a=a.G(/s|S/g,b.1p())},3I:8(a,b,c){c=c||I O;2D(a){F"s":j I O(c.1t()+43*b);F"n":j I O(c.1t()+45*b);F"h":j I O(c.1t()+46*b);F"d":j I O(c.1t()+36*b);F"w":j I O(c.1t()+4e*b);F"m":j I O(c.1q(),c.13()+b,c.Z(),c.19(),c.1r(),c.1p());F"y":j I O(c.1q()+b,c.13(),c.Z(),c.19(),c.1r(),c.1p())}},3F:8(a,b,c){2D(a){F"s":j x((c-b)/43);F"n":j x((c-b)/45);F"h":j x((c-b)/46);F"d":j x((c-b)/36);F"w":j x((c-b)/4e);F"m":j c.13()+1+12*(c.1q()-b.1q())-(b.13()+1);F"y":j c.1q()-b.1q()}},4T:8(a){a=a.2x(/(\\d{1,4})/4U);--a[1];4V("p d = I O("+a.38(",")+");");j d},4X:8(a,b){p c=0,e=-1,f=b.r;-1<(e=a.z("2L"))&&e<f&&(c=b.1z(e,4));p g=0;-1<(e=a.z("2K"))&&e<f&&(g=x(b.1z(e,2))-1);p h=0;-1<(e=a.z("2J"))&&e<f&&(h=x(b.1z(e,2)));p k=0;(-1<(e=a.z("33"))||1<(e=a.z("3Z")))&&e<f&&(k=x(b.1z(e,2)));p l=0;-1<(e=a.z("34"))&&e<f&&(l=b.1z(e,2));p m=0;-1<(e=a.z("35"))&&e<f&&(m=b.1z(e,2));j I O(c,g,h,k,l,m)},4Y:8(a){j a.1t()},4Z:8(a){j I O(a)},51:8(a,b){1C==b&&(b="52");p c=b.z("2L");C(-1==c)j!1;c=a.1f(c,c+4);p e=b.z("2K");C(-1==e)j!1;e=a.1f(e,e+2);b=b.z("2J");C(-1==b)j!1;a=a.1f(b,b+2);j!o.39(c)||"54"<c||"55">c||!o.39(e)||"12"<e||"3S">e||a>o.3x(c,e)||"3S">a?!1:!0},3x:8(a,b){j 4==b||6==b||9==b||11==b?"30":2==b?0==a%4&&0!=a%1I||0==a%3M?"29":"28":"31"},39:8(a){j/^\\d+$/g.L(a)},58:8(a){a=a||I O;p b=[];b[0]=a.1q();b[1]=a.13();b[2]=a.Z();b[3]=a.19();b[4]=a.1r();b[5]=a.1p();j b},4i:8(a,b){b=b||I O;p c="",e="\\2d\\2v\\2t\\2s\\2p\\2o\\2j".R("");2D(a){F"y":c=b.1q();1u;F"M":c=b.13()+1;1u;F"d":c=b.Z();1u;F"w":c=e[b.26()];1u;F"5a":c=b.5b();1u;F"h":c=b.19();1u;F"m":c=b.1r();1u;F"s":c=b.1p()}j c},5c:8(a){a=a||I O;a.3b(1);a.5e(a.13()+1);a=a.1t()-36;j(I O(a)).Z()},5f:8(a){--a;p b=I O;b.3b(b.Z()-a);E(p c=[],e=[],f=[],g,h=0;h<a+1;h++){g=b.13()+1;p k=b.Z();1==(g+"").r&&(g="0"+g);1==(k+"").r&&(k="0"+k);g=g+"-"+k;e.1o(g);f.1o(k);b.3b(b.Z()+1)}c.1o(e);c.1o(f);j c},5g:8(a){--a;p b=[],c=[],e=[],f=I O;p g=f.3A(f.19()-a);f.19(g);E(p h=0;h<a+1;h++){3B=f.Z();g=f.3A(f.19()+1);p k=f.19(g);1==(f.19(g)+"").r&&(k="0"+k);g=3B+"-"+k;c.1o(g);e.1o(k)}b.1o(c);b.1o(e);j b},5j:8(a){E(p b="\\1g\\2v\\2t\\2s\\2p\\2o\\2j\\5l\\5m\\5n".R(""),c=["","\\5o","\\5p","\\5q"],e=["","\\3C","\\3D","\\5t"],f=8(){E(p b=[],c=a.r;0<=c;c--)b.1o(a[c]);j b.38("")},g="",h="",k=-1,l=0;l<f().r;l++)C(0==l%4&&(k++,h=e[1]+h,g=""),"0"==f()[l]){2D(l%4){F 1:F 2:F 3:"0"!=f()[l-1]&&(g="\\1g")}h=g+h;g=""}1R h=b[x(f()[l])]+c[l%4]+h;0==h.z("\\1g")&&(h=h.1z(1));j h},2y:{5v:8(a,b){p c;1v{p e=a.V().R(".")[1].r}1x(g){e=0}1v{p f=b.V().R(".")[1].r}1x(g){f=0}j c=1d.2c(10,1d.3E(e,f)),(o.1B(a,c)+o.1B(b,c))/c},5B:8(a,b){p c;1v{p e=a.V().R(".")[1].r}1x(g){e=0}1v{p f=b.V().R(".")[1].r}1x(g){f=0}j c=1d.2c(10,1d.3E(e,f)),(o.1B(a,c)-o.1B(b,c))/c},1B:8(a,b){p c=0;a=a.V();b=b.V();1v{c+=a.R(".")[1].r}1x(e){}1v{c+=b.R(".")[1].r}1x(e){}j 2b(a.G(".",""))*2b(b.G(".",""))/1d.2c(10,c)},1A:8(a,b){p c,e,f=0,g=0;1v{f=a.V().R(".")[1].r}1x(h){}1v{g=b.V().R(".")[1].r}1x(h){}j c=2b(a.V().G(".","")),e=2b(b.V().G(".","")),o.1B(c/e,1d.2c(10,g-f))}},5D:8(a){p b=1Q(a);j 2I(b)?(5E("\\5F\\5G\\5H\\3W\\3G\\3H\\5K\\5L\\5M\\5N\\2E"),!1):b=1d.5O(1I*a)/1I},5P:8(a){p b=["\\5Q","\\5R"],c="\\1g\\5S\\5T\\5U\\5V\\5W\\5X\\5Y\\5Z\\61".R(""),e=[["\\20","\\3C","\\3D"],["","\\63","\\64","\\65"]],f=0>a?"\\66":"";a=1d.67(a);E(p g="",h=0;h<b.r;h++)g+=(c[1d.3d(o.2y.1B(o.2y.1B(a,10),1d.2c(10,h)))%10]+b[h]).G(/\\1g./,"");g=g||"\\2l";a=1d.3d(a);E(h=0;h<e[0].r&&0<a;h++){b="";E(p k=0;k<e[1].r&&0<a;k++)b=c[a%10]+e[1][k]+b,a=1d.3d(o.2y.1A(a,10));g=b.G(/(\\1g.)*\\1g$/,"").G(/^$/,c[0])+e[0][h]+g}a=f+g.G(/(\\1g.)*\\1g\\20/,"\\20").G(/(\\1g.)+/g,"\\1g").G(/^\\2l$/,"\\1g\\20\\2l");c=a.R("\\20");2==c.r&&-1==c[1].z("\\2l")&&(c[1]="\\1g"+c[1],a=c.38("\\20"));j a},6a:8(a){1O.1F(a)&&(a=$("6c"));a=a.6d("6e,3e,3K");E(p b=0;b<a.r;b++){p c=a[b],e=c.3m;C("3y"==e||"6h"==e){C(c.1l!=c.6i)j!0}1R C("3q"==e||"6j"==e||"3l"==e||"3K"==e){C(c.6k!=c.6l)j!0}1R C("3e-6m"==e||"3e-6n"==e)E(e=0;e<c.2i.r;e++)C("3f"==$(c.2i[e]).1Z("3f")&&c.2i[e].3f!=c.2i[e].6q)j!0}j!1},6r:8(a){j 1w.6s(6t(3v(a)))},6u:8(a){j 2H(6v(1w.6w(a)))},6x:8(a){p b={6y:a.3g,1N:a.3g[0],6B:a.3g[0].2g,17:[],B:[],1s:[],2F:1C,3O:"3O",3P:"3P",3Q:"3Q",2C:"",2B:"",3h:[]};1v{1O.1F(a.3j)||a.3j()}1x(c){1X.3R("\\6N\\2X\\6O\\6P\\6Q\\3u\\6R\\6S\\6T\\3G\\3H: ",c.6U)}b.2u=8(){b.3T(o.1N)};b.3U=8(c){E(p e=0;e<o.1N.3i.r;e++)o.17.1o(o.1N.3i[e]);o.B=o.17.6Y().2A;E(e=0;e<o.17.r;e++)b.3h[e]=o.17[e];E(e=0;e<(c.r?c.r:o.B.r);e++){p f=c.r?c[e]:e;C(!(f>=o.B.r)){o.1s[f]="3k";o.B[f].70.71="72";o.B[f].73=o.3X(o,"3Y",f);0<$(o.B[f]).1D("a").r&&$(o.B[f]).1D("a").2q();p g=Q.1c("a");$(o.B[f]).1n(g);p h=Q.1c("1A");$(g).1n(h);p k=Q.1c("1A");$(g).1n(k);$(o.B[f]).v("14","2k");$(g).v({2h:"2e",14:"1m",P:"50%",1k:"0",1j:"1e",1h:"1e","2f-P":"-.2z"});$(h).v({"q-P":".N u J","q-1k":".Y u J","q-1b":".N u 1J(0,0,0,.25)","q-1a":".Y u J",14:"1m",1a:"0",1j:"0",1h:"0",1E:".1M 1G-1H-1K","-1P-t-K":"q-t","-1L-t-K":"q-t","t-K":"q-t"});$(k).v({"q-P":".N u 1J(0,0,0,.25)","q-1k":".Y u J","q-1b":".N u J","q-1a":".Y u J",14:"1m",1a:"0",1j:"0",1h:"0",1E:".1M 1G-1H-1K","-1P-t-K":"q-t","-1L-t-K":"q-t","t-K":"q-t"});1O.1F(a.1i)||($(h).v("q-1b",".N u "+a.1i),$(k).v("q-P",".N u "+a.1i));$(h).v("P","-0.1e");$(h).v("21","1");$(k).v("1b","-0.1e");$(k).v("21","1")}}};b.3X=8(a,b,f){j 8(){a[b](f)}};b.3Y=8(c){E(p e=!0,f=0;f<o.17.r&&e;f++)e=o.4b(o.17[f].2A[c].2g);o.17.4c(8(a,b){a=a.2A[c].2g;b=b.2A[c].2g;j a==b?0:(e?1Q(a)>1Q(b):a>b)?1:-1});C("3k"==o.1s[c]){o.1s[c]="4d";0<$(o.B[c]).1D("a").r&&$(o.B[c]).1D("a").2q();f=Q.1c("a");$(o.B[c]).1n(f);p g=Q.1c("1A");$(f).1n(g);p h=Q.1c("1A");$(f).1n(h);$(o.B[c]).v("14","2k");$(f).v({2h:"2e",14:"1m",P:"50%",1k:"0",1j:"1e",1h:"1e","2f-P":"-.2z"});$(g).v({"q-P":".N u J","q-1k":".Y u J","q-1b":".N u 1J(0,0,0,.25)","q-1a":".Y u J",14:"1m",1a:"0",1j:"0",1h:"0",1E:".1M 1G-1H-1K","-1P-t-K":"q-t","-1L-t-K":"q-t","t-K":"q-t"});$(h).v({"q-P":".N u 1J(0,0,0,.25)","q-1k":".Y u J","q-1b":".N u J","q-1a":".Y u J",14:"1m",1a:"0",1j:"0",1h:"0",1E:".1M 1G-1H-1K","-1P-t-K":"q-t","-1L-t-K":"q-t","t-K":"q-t"});1O.1F(a.1i)||($(g).v("q-1b",".N u "+a.1i),$(h).v("q-P",".N u "+a.1i));$(g).v("P","0.1e");$(h).v("21","0");o.2F=o.B[c];g=Q.3s();E(f=0;f<o.17.r;f++)g.1T(o.17[f]);o.1N.3t[0].1T(g);o.2C=o.B[c];o.2B=o.1s[c]}1R C("4d"==o.1s[c]){o.17.7K();o.1s[c]="4g";0<$(o.B[c]).1D("a").r&&$(o.B[c]).1D("a").2q();f=Q.1c("a");$(o.B[c]).1n(f);g=Q.1c("a");$(f).1n(g);h=Q.1c("1A");$(f).1n(h);$(o.B[c]).v("14","2k");$(f).v({2h:"2e",14:"1m",P:"50%",1k:"0",1j:"1e",1h:"1e","2f-P":"-.2z"});$(g).v({"q-P":".N u J","q-1k":".Y u J","q-1b":".N u 1J(0,0,0,.25)","q-1a":".Y u J",14:"1m",1a:"0",1j:"0",1h:"0",1E:".1M 1G-1H-1K","-1P-t-K":"q-t","-1L-t-K":"q-t","t-K":"q-t"});$(h).v({"q-P":".N u 1J(0,0,0,.25)","q-1k":".Y u J","q-1b":".N u J","q-1a":".Y u J",14:"1m",1a:"0",1j:"0",1h:"0",1E:".1M 1G-1H-1K","-1P-t-K":"q-t","-1L-t-K":"q-t","t-K":"q-t"});1O.1F(a.1i)||($(g).v("q-1b",".N u "+a.1i),$(h).v("q-P",".Y u "+a.1i));$(g).v("21","0");$(h).v("1b","0.1e");o.2F=o.B[c];g=Q.3s();E(f=0;f<o.17.r;f++)g.1T(o.17[f]);o.1N.3t[0].1T(g);o.2C=o.B[c];o.2B=o.1s[c]}1R C("4g"==o.1s[c]){o.17.4c(8(a,c){E(p f,g,h=b.3h,k=0;k<h.r;k++)C(h[k]==a){f=k;1u}E(k=0;k<h.r;k++)C(h[k]==c){g=k;1u}j f==g?0:(e?1Q(f)>1Q(g):f>g)?1:-1});o.1s[c]="3k";0<$(o.B[c]).1D("a").r&&$(o.B[c]).1D("a").2q();f=Q.1c("a");$(o.B[c]).1n(f);g=Q.1c("a");$(f).1n(g);h=Q.1c("1A");$(f).1n(h);$(o.B[c]).v("14","2k");$(f).v({2h:"2e",14:"1m",P:"50%",1k:"0",1j:"1e",1h:"1e","2f-P":"-.2z"});$(g).v({"q-P":".N u J","q-1k":".Y u J","q-1b":".N u 1J(0,0,0,.25)","q-1a":".Y u J",14:"1m",1a:"0",1j:"0",1h:"0",1E:".1M 1G-1H-1K","-1P-t-K":"q-t","-1L-t-K":"q-t","t-K":"q-t"});$(h).v({"q-P":".N u 1J(0,0,0,.25)","q-1k":".Y u J","q-1b":".N u J","q-1a":".Y u J",14:"1m",1a:"0",1j:"0",1h:"0",1E:".1M 1G-1H-1K","-1P-t-K":"q-t","-1L-t-K":"q-t","t-K":"q-t"});1O.1F(a.1i)||($(g).v("q-1b",".N u "+a.1i),$(h).v("q-P",".N u "+a.1i));$(g).v("P","-0.1e");$(g).v("21","1");$(h).v("1b","-0.1e");$(h).v("21","1");o.2F=o.B[c];g=Q.3s();E(f=0;f<o.17.r;f++)g.1T(o.17[f]);o.1N.3t[0].1T(g);o.2C=o.B[c];o.2B=o.1s[c]}};b.4b=8(a){j/^\\d+(\\.\\d+)?$/.L(a)};b.3T=8(){C(!(1>=o.1N.3i.r)){p b=[];1O.1F(a.4h)||(b=a.4h);o.3U(b)}};b.2u()}};8 2M(){o.2u.7O(o,7P)}2M.7Q=32;p 1O=I 2M;',62,487,'||||||||function|||||||||||return|||||this|var|border|length||box|solid|css||parseInt||indexOf||Header|if||for|case|replace||new|transparent|sizing|test||25em|Date|top|document|split||jQuery||toString|||35em|getDate||||getMonth|position|||Rows||getHours|left|bottom|createElement|Math|1em|substring|u96f6|height|color|width|right|checked|absolute|append|push|getSeconds|getFullYear|getMinutes|ViewState|getTime|break|try|window|catch|name|substr|div|mul|null|children|transition|isNull|ease|in|100|rgba|out|moz|125s|tableObj|jsTool|webkit|parseFloat|else|each|appendChild|u671f|u661f|publicMethod|console|getYear|attr|u5143|opacity||setAttribute|||getDay|log|||html|Number|pow|u65e5|block|margin|innerHTML|display|options|u516d|relative|u6574|isEmpty|toLowerCase|u4e94|u56db|remove|val|u4e09|u4e8c|init|u4e00|urlAddParmert|match|moneyMath|5em|cells|ViewStateTemp|HeaderTemp|switch|uff01|LastSorted|u4e0d|decodeURIComponent|isNaN|dd|MM|yyyy|JsTool|3600|u8f93|u5165|u7684|u8eab|u4efd|u8bc1|u53f7|u6b63|u786e|u683c|Za|z0|||Js_Tool|HH|mm|ss|864E5|getIpNum|join|isNumber|charAt|setDate|AppleWebKit|floor|select|selected|obj|rowsp|rows|method|def|text|type|href|location|get|hidden|tempdata|createDocumentFragment|tBodies|u5b9a|encodeURIComponent|u4f4d|getMaxDay|checkbox|getCheckVals|setHours|datap|u4e07|u4ebf|max|dateDiff|u9519|u8bef|dateAdd|iPad|textarea|iPhone|400|String|NormalCss|SortAscCss|SortDescCss|error|01|TableSorterSet|InitSet|u5f0f|u6570|GetFunction|Sort|hh|Mac|loadjscssfile|random|1E3|setInterval|6E4|36E5|overflow|65536|undefined|void|IsNumeric|sort|asc|6048E5|timeTohhmmss|desc|order|datePart|MicroMessenger|getIntervalWeekends|00|timeStampString|setTime|weixin|Safari|webApp|isLeapYear|isCardNo|checkLetOrNum|checkFloat|numberLoader|clearInterval|dateToStr|Linux|Android|android|checkTwoInt|checkNumber|checkTowLenFloat|YYYY|yy|YY|checkTowLenFloatt|DD|checkTowFloat|OS|SS|checkSpace|CPU|u662f|checkIntLeng|u5b57|checkIp|u7801|strToDate|gm|eval|u957f|strFormatToDate|dateToLong|longToDate||isDate|yyyyMMdd|u5ea6|2100|1900|interceptStr|checkIntTwoLeng|toArray|checkInt|ww|WeekNumOfYear|maxDayOfDate|u5e94|setMonth|get_weekData|get_weekHour|u4e3a15|checkNegative|numToStr|ios|u4e03|u516b|u4e5d|u5341|u767e|u5343|u621618|checkStr|u5146|Mobile|add|mobile|KHTML|Gecko|16777216|gecko|sub|sTelephone|keepTwoDecimal|alert|u4f20|u9012|u53c2|decideString|isMobilePhone|uff0c|u8bf7|u68c0|u67e5|round|numSmalltoBIG|u89d2|u5206|u58f9|u8d30|u53c1|u8086|u4f0d|u9646|u67d2|u634c||u7396|webKit|u62fe|u4f70|u4edf|u8d1f|abs|isEmail|Presto|formIsDirty|presto|body|find|input|search|256|radio|defaultChecked|password|value|defaultValue|one|multiple|Trident|decideIp|defaultSelected|strEncryption|btoa|unescape|strDecrypt|escape|atob|TableSorter|tableObject|dateToString|trident|tableObjTem|userAgent|navigator|getTerminalVersions|u7535|lastIndexOf|u5b50|u90ae|u7bb1|getQueryObject|isZip|isChines|u8868|u6392|u5e8f|u81ea|u4e49|u65b9|u6cd5|message|u4E00|u9FA5|jsContains|shift|makeUUID|style|cursor|pointer|onclick|getFileExt|exec|head|getElementsByTagName|typeof|stylesheet|rel|link|src|javascript|strEncode|stringToNumber|script|js|strDencode|strParseInt|setRandomNum|getBasePath|getProjectName|getLocalhostPath|getPos|getPathName|getCurWwwPath|pathname|strParseFloat|checkTime|getTodayDate|setCyclicLoading|clearSelect|inverSelect|checkboxAll|u5e74|setNormalLoading|NULL|u6708|Z_|isNullByNum|decideCheckState|checkIntAndFloat|getCheckValues|getSomeChVals|zA|reverse|getValueCheckOnly|checkChangedOnly|chkCheckCha|apply|arguments|prototype'.split('|'),0,{}))
 //# sourceURL=jsTool v1.0.5

本文由 在码圈 创作,如果您觉得本文不错,请随意赞赏
采用 知识共享署名4.0 国际许可协议进行许可
您可以自由的转载和修改,但请务必注明文章来源并且不可用于商业目的。
本站部分内容收集于互联网,如果有侵权内容、不妥之处,请联系我们删除。敬请谅解!
原文链接:https://www.bedebug.com/archives/jstools
最后更新于:2020-06-15 14:14:05

请博主喝咖啡 ☕.