function bindpagerclick(config) { var eventfunction = function () { if ($(this).attr("disabled") != undefined) { return false; } var url = $(this).attr("data-ajax-url") || undefined; url = url == undefined ? $(this).attr("href") : url; var formname = config == undefined || config == null || config.formid == null || config.formid == undefined || config.formid == "" ? "form[data-ajax]" : config.formid; if (config && !config.issubmit) { config.notsubmitcall(url); return false; } if (config != undefined && config != null && config.vaildate != null && config.vaildate != undefined) { if (!config.vaildate(formname)) { return false; } } var form = $(formname); form.attr("action", url); form.submit(); return false; }; $("a[data-pageindex]").on("click", this, eventfunction); }; // 将搜索页面的索引页设置为1 function resetpage(fromid) { var oldurl = $("#" + fromid).attr("action"); var newurl = replaceparamval(oldurl, "page", "1"); $("#" + fromid).attr("action", newurl); }; function replaceparamval(oldurl, paramname, replacewith) { var re = eval('/(' + paramname + '=)([^&]*)/gi'); var nurl = oldurl.replace(re, paramname + '=' + replacewith); return nurl; }; function formbegin(showload) { if ($("#loading").length == 0) { $("#" + showload).prepend("
loading...
"); } }; function showtips() { $("span[command=tip]").on("mouseover",this, function () { layer.tips($(this).attr("tip"), this, { tips: [4, '#28b9fb'], time: 0 }); }); $("span[command=tip]").on("mouseleave",this, function () { layer.tips("close"); }); }; date.prototype.format = function (format) { var o = { "m+": this.getmonth() + 1, //month "d+": this.getdate(), //day "h+": this.gethours(), //hour "m+": this.getminutes(), //minute "s+": this.getseconds(), //second "q+": math.floor((this.getmonth() + 3) / 3), //quarter "s": this.getmilliseconds() //millisecond } if (/(y+)/.test(format)) format = format.replace(regexp.$1, (this.getfullyear() + "").substr(4 - regexp.$1.length)); for (var k in o) if (new regexp("(" + k + ")").test(format)) format = format.replace(regexp.$1, regexp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); return format; };