重构代码:移除format方法,使用公共函数库的
This commit is contained in:
parent
6101a65620
commit
32224abd46
|
@ -1,24 +1,4 @@
|
|||
$(function () {
|
||||
$.extend({
|
||||
"format": function (source, params) {
|
||||
if (params === undefined) {
|
||||
return source;
|
||||
}
|
||||
if (arguments.length > 2 && params.constructor !== Array) {
|
||||
params = $.makeArray(arguments).slice(1);
|
||||
}
|
||||
if (params.constructor !== Array) {
|
||||
params = [params];
|
||||
}
|
||||
$.each(params, function (i, n) {
|
||||
source = source.replace(new RegExp("\\{" + i + "\\}", "g"), function () {
|
||||
return n;
|
||||
});
|
||||
});
|
||||
return source;
|
||||
}
|
||||
});
|
||||
|
||||
var ajax = function (options) {
|
||||
options = $.extend({
|
||||
test: false,
|
||||
|
|
Loading…
Reference in New Issue