// public
/*
*  格式化 
*/
String.prototype.format = function () {
    var args = arguments;
    return this.replace(/\{(\d+?)\}/g, function (g0, g1) {
        return args[+g1];
    });
};

/*
* Array.prototype.forEach
*/
Array.prototype.forEach = Array.prototype.forEach || function (callback) {
    callback = callback || function () { };
    for (var i = 0, len = this.length; i < len; i++) {
        callback.call(this[i], this[i], i);
    }
};

/*
* Date.prototype.format
*/
Date.prototype.format = function (format) {
    var dict = {
        "y+": this.getFullYear(),
        "M+": this.getMonth() + 1,
        "d+": this.getDate(),
        "H+": this.getHours(),
        "h+": this.getHours() - 12,
        "m+": this.getMinutes(),
        "s+": this.getSeconds()
    };
    for (var k in dict) {
        var reg = new RegExp(k, "g");
        format = format.replace(reg, function (g0) {
            return ("000000" + dict[k]).slice(-g0.length);
        });
    }
    return format;
}

//public end

// module
$(function () {
    module.inits.forEach(function (item, index) {   //所有模块初始化
        $.type(item) == "function" && item();
    });
});

var module = (function (my) {  //template
    my.inits = my.inits || [];
    
    return my;
})(module || {});

 
                    
            
                

相关文章:

  • 2021-11-14
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2021-04-27
  • 2021-10-16
  • 2021-09-28
  • 2022-12-23
猜你喜欢
  • 2022-01-05
  • 2021-10-25
  • 2022-12-23
  • 2021-12-18
  • 2021-09-01
  • 2021-12-31
  • 2022-02-08
相关资源
相似解决方案