function page(url, updateid) { if (url.indexof("admin") > -1) loadingadmin("内容加载中..."); else loading("加载中..."); $.get(url, function(data) { $("#" + updateid).html(data); closeloading(); }); } function mytoggleactive(jq) { jq.siblings().removeclass('active'); jq.addclass('active'); } function mydelete(curl, cid, func) { $.confirm("是否确认删除", function() { $.ajax({ type : "post", url : curl, data : { id : cid, }, datatype : "json", success : function(data) { $.ajaxsetup({ cache : false }); alert(data.msg); func(); }, error : function() { alert("系统异常,请稍后重试!"); } }); }); } function showmask() { $('#mask').remove(); $('body').prepend('
').find('#mask').css({ opacity : 0.4, cursor : 'pointer', background : 'white', position : 'fixed', _position : "absolute", zindex : 1001, width : '100%', height : $(document).height() }); } function loadingadmin(msg) { showmask(); if ($("#divmsg").length == 0) $("body").append(""); $("#divmsg").removeclass().html("" + msg + ""); $("#divmsg").css({ "top" : (($(window).height() - $("#divmsg").height()) / 2 - 50) + "px", "left" : (($(window).width() - $("#divmsg").width()) / 2) + "px" }).show(); } function loading(msg) { showmask(); if ($("#divmsg").length == 0) $("body").append(""); $("#divmsg").removeclass().html("" + msg + ""); $("#divmsg").css({ "top" : (($(window).height() - $("#divmsg").height()) / 2 - 50) + "px", "left" : (($(window).width() - $("#divmsg").width()) / 2) + "px" }).show(); } function closeloading() { $("#divmsg,#mask").html("").hide(); } function alert(msg) { if ($("#alertdialog").length == 0) { $("body").append("
" + "
" + "" + "

提醒

" + "
" + "
"); } $(".alert-body").text(msg); $("#alertdialog").modal(); } (function($) { $.confirm = function(msg, callback) { if ($("#confirmdialog").length == 0) { $("body").append("
" + "
" + "" + "

请确定

" + "
" + "" + "
"); } $(".confirm-body").text(msg); $("#confirm_ok").unbind("click").click(function() { if (typeof (callback) == 'function') { callback(); } }); $("#confirmdialog").modal(); } })(jquery) string.prototype.endwith = function(str) { if (str == null || str == "" || this.length == 0 || str.length > this.length) return false; if (this.substring(this.length - str.length) == str) return true; else return false; return true; }