window.Exx || (window.Exx = { Step: { 1: '学前班', 2: '幼儿园', 3: '小学', 4: '初中', 5: '高中', 6: '职业学校', 8: '特殊教育', 9: '其他' }, AddNote: function (val, note) { var s = ''; if (!this.IsEmpty(val)) s = val; if (!this.IsEmpty(note)) s += '[' + note + ']'; return s; }, IsUndefined: function (value) { return typeof value === 'undefined' }, IsFunction: function (value) { return typeof value === 'function' }, IsEmpty: function (val) { if (this.IsUndefined(val)) return true; if (val == null) return true; if (typeof val == "string" && $.trim(val) == '') return true; return false; }, IsArray: function (val) { return val && typeof val === 'object' && Array == val.constructor; }, IsObj: function (val) { return val && typeof val === 'object' && Object == val.constructor; }, BtnClick: function (obj, dofun, callback, time, showtime) { var disabled = $(obj).prop("disabled"); if (this.IsUndefined(disabled)) return; $(obj).attr("disabled", true); if (typeof dofun === 'function') { var data = dofun(); if (!this.IsUndefined(data) && !data) { $(obj).attr("disabled", false); return false; } } var val = $(obj).val(); if (typeof time !== 'undefined' && time > 0) { time = parseInt(time); if (showtime) { $(obj).val(val + '(' + time + ')'); } this.countDown(time, function (t) { if (showtime) { $(obj).val(val + '(' + t + ')'); } }, function () { if (showtime) { $(obj).val(val); } $(obj).attr("disabled", false); if (typeof callback === 'function') callback(); }); } return true; }, countDown: function (t, dofun, callback) { if (t <= 0) { if (typeof callback === 'function') { callback(); } return; } if (typeof dofun === 'function') { dofun(t); } setTimeout(function () { Exx.countDown(--t, dofun, callback); }, 1000); }, UpFile: function (url, fun) { var self = this; layer.open({ type: 2, btn: ['确定', '取消'], yes: function (index, layero) { var list = layero.find('iframe')[0].contentWindow.btnok(); if (list) { if (self.IsFunction(fun)) { fun(list) } layer.close(index); } }, title: '上传请假凭证图片', closeBtn: 0, shadeClose: false, shade: 0.8, maxmin: false, //开启最大化最小化按钮 area: ['670px', '490px'], content: url }); }, GoTo: function (url, time) { if (typeof url != 'undefined' && url.trim() != '') { if (typeof time != 'undefined' && time > 0) { setTimeout(function () { location.href = url; }, time); } else { location.href = url; } } }, GetUrlParams: function (e) { var t = {}; if (-1 != e.indexOf("?")) { var n = e.substr(1); if (-1 === n.indexOf("&")) { var r = n.split("="); if (r.length >= 2) t[r[0]] = decodeURI(r[1]); else t[r[0]] = ""; } else { $.each(n.split("&"), function (n, e) { var r = e.split("="); if (r.length >= 2) t[r[0]] = decodeURI(r[1]); else t[r[0]] = ""; }); } } return t; }, ShowLoad: function () { return layer.load(); }, //关闭加载提示 closeLoading: function (cfg) { var defcfg = { index: null, opentime: new Date(), istop: true, mintime: 0, callback: null }; var _c = $.extend({}, defcfg, cfg); var t; if (!!_c.istop) t = top.layer; else t = layer; var jg = 0; if (_c.mintime > 0) { jg = _c.mintime - (new Date().getTime()) + _c.opentime.getTime(); } if (typeof _c.index != 'undefined' && _c.index != null) setTimeout(function () { t.close(_c.index); if (typeof _c.callback == 'function') { _c.callback(); } }, jg); else setTimeout(function () { t.closeAll(_c.index); if (typeof _c.callback == 'function') { _c.callback(); } }, jg); }, //打开加载广告 oprnLoading(图片路径,显示文字,图片链接) openLoading: function (cfg) { var defcfg = { src: '', text: '', url: '', istop: true, maxtime: 0, mintime: 0 }; var _c = $.extend({}, defcfg, cfg); //生成弹层代码 var html = ""; html += '
'; html += '
'; if (_c.url == "" || typeof (_c.url) == "undefined") { html += ''; } else { html += ''; html += ''; html += ''; } html += '
'; html += '
' + _c.text + '
'; html += '
'; if (typeof time == 'undefined') time = 0; var t; if (!!_c.istop) t = top.layer; else t = layer; //打开弹层 var ind = t.open({ type: 1, title: false, closeBtn: false, shade: 0.3, resize: 0, area: ['400px', '250px'], fixed: true, content: html, time: _c.maxtime }); return { index: ind, opentime: new Date(), istop: !!_c.istop, mintime: _c.mintime }; }, openLoading2: function (cfg) { var self = this; var defcfg = { istop: true, maxtime: 0, mintime: 0 }; var _c = $.extend({}, defcfg, cfg); if (typeof time == 'undefined') time = 0; var t; if (!!_c.istop) t = top.layer; else t = layer; //打开弹层 var r = null; var ind = t.load(0, { time: _c.maxtime, success: function (layero, index) { if (self.IsFunction(_c.success)) { r = { index: index, opentime: new Date(), istop: !!_c.istop, mintime: _c.mintime }; setTimeout(function () { _c.success(layero, index, r); }, 500); } } }); if (r) return r; return { index: ind, opentime: new Date(), istop: !!_c.istop, mintime: _c.mintime }; }, ajax: function (cfg) { var _c = { type: 'POST', cache: false, async: false, dataType: 'json', error: function (d) { layer.alert('网络异常,或服务器忙...'); } }; var c = $.extend({}, _c, cfg); return $.ajax(c); }, dodata: function (d, cfg) { var self = this; if (self.IsFunction(cfg[d.Code])) { cfg[d.Code](d, cfg); } else { switch (d.Code) { case -1: self.alerterr(d.Data.info, 3000, function (ind) { location.href = '/user/login.aspx'; }); break; case 0: self.alertsuc('成功', 3000, function (ind) { top.layer.close(ind); //location.reload(); }); break; case 2: var obj; if (cfg.contentid) { obj = $(cfg.contentid); } if (!obj || obj.length <= 0) { obj = $('#maincontent'); } if (obj && obj.length > 0) { var h = self.GetTeaError(d.Data.errortype, d.Data.title, d.Data.msg, d.Data.users); obj.html(h); } else { self.alerterr(d.Data, 3000); } break; default: //console.log(d.Data); if (self.IsUndefined(d.Data.info)) { self.alerterr(d.Data, 3000); } else { self.alerterr(d.Data.info, 3000); } break; } } }, alertsuc: function (msg, time, callback) { layer.alert(msg, { icon: 1, time: time, end: callback }); }, alerterr: function (msg, time, callback) { layer.alert(msg, { icon: 2, time: time, end: callback }); }, selteacher: function (title, getoption) { return top.layer.open({ type: 2, title: title, shadeClose: false, shade: 0.8, closeBtn: 0, area: ['850px', '553px'], scrollbar: false, content: '/teacher/selteacher.aspx', success: function (layero, index) { layero.find("iframe")[0].contentWindow.setpfun(getoption); } }); }, selgroupteacher: function (title, getoption) { return top.layer.open({ type: 2, title: title, shadeClose: false, shade: 0.8, closeBtn: 0, area: ['850px', '553px'], scrollbar: false, content: '/teacher/selgroupteacher.aspx', success: function (layero, index) { layero.find("iframe")[0].contentWindow.setpfun(getoption); } }); }, seldept: function (title, opt) { var c = $.extend({ r: 0, leaf: 1, chkone: 0 }, opt) return top.layer.open({ type: 2, title: title, shadeClose: false, shade: 0.8, closeBtn: 0, area: ['320px', '390px'], scrollbar: false, content: '/common/node/selnode.aspx?code=Dept&r=' + c.r + '&leaf=' + c.leaf + '&chkone=' + c.chkone, success: function (layero, index) { layero.find("iframe")[0].contentWindow.setcallback(opt.callback); } }); }, InitEditor: function (a) { var self = this; var b = { editorid: undefined,//编辑器ID files: undefined,//上传文件数组 afteraddimg: undefined,//添加文件后执行方法 uppic: true }; var c = $.extend({}, b, a); if (c.uppic) { c.serverUrl = "/common/upload2017/upload.ashx"; EUE.image('/common/upload2017/upload_editor.aspx', undefined, c.editorid); } var ue = UE.getEditor(c.editorid, c); ue.addListener('afterinsertimage', function (t, arg) { if (self.IsArray(c.files)) { for (var i = 0; i < arg.length; i++) { console.log(arg); c.files.push({ title: arg[i].title, url: arg[i].src }); } a.files = c.files; } if (self.IsFunction(c.afteraddimg)) { c.afteraddimg(t, arg); } }); return ue; }, SmallEditor: { toolbars: [[ 'undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'directionalityltr', 'directionalityrtl', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|', 'link', 'unlink', 'anchor', '|', 'pagebreak', 'template', '|', 'horizontal', 'date', 'time', 'spechars', '|', 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|', 'drafts' ]] }, InitAttach: function (a) { var self = this; var b = { title: '上传附件', single: false,//单文件上传 btnok: undefined,//确定按钮执行方法 btndel: undefined,//删除按钮执行方法 attachdiv: '#div_attach', attachbtn: '#btn_selattach',//选择附件按钮 totalfiles: undefined,//总上传文件集 realfiles: undefined,//真实附件集 afteradd: undefined, afterdel: undefined, uptype: 1//1、附件 2、图片 }; var url = '/common/upload2017/upload_attach.aspx'; var c = $.extend({}, b, a); switch (c.uptype) { case 2: url = '/common/upload2017/upload_photo.aspx'; break; } var ReturnVal = function () { if (self.IsArray(a.totalfiles)) c.totalfiles = a.totalfiles; if (self.IsArray(a.realfiles)) c.realfiles = a.realfiles; } ReturnVal();//不能去 var AddAttach = function (list) { if (c.single) { if (list && list.length > 0) { var file = list[0]; $(c.attachdiv).html(''); if (self.IsArray(c.realfiles)) { c.realfiles.clear(); c.realfiles.push($.extend({}, file)); } if (self.IsArray(c.totalfiles)) { $.each(list, function (d, b) { c.totalfiles.push({ title: b.title, url: b.url }); }); } $(c.attachdiv).append(''); } } else { $.each(list, function (d, file) { $(c.attachdiv).append(''); if (self.IsArray(c.totalfiles)) { c.totalfiles.push($.extend({}, file)); } if (self.IsArray(c.realfiles)) { c.realfiles.push($.extend({}, file)); } }); } if (self.IsFunction(c.afteradd)) { c.afteradd(list, c); } }; var DelAttach = function (obj) { layer.confirm('确定删除?', function (index) { if (self.IsArray(c.realfiles)) { var url = $(obj).parent().parent().find('.title a').attr('href'); $.each(c.realfiles, function (n, a) { if (a.url == url) { c.realfiles.remove(a); } }); } $(obj).parent().parent().remove(); if (self.IsFunction(c.afterdel)) { c.afterdel(obj, c); } layer.close(index); }); }; if (c.single) { url += '?single=1'; } $(document).on('click', c.attachdiv + " .del a", function () { if (self.IsFunction(c.btndel)) { c.btndel(this); } else { DelAttach(this); } }); $(document).on('click', c.attachbtn, function () { layer.open({ type: 2, btn: ['确定', '取消'], yes: function (index, layero) { var list = layero.find('iframe')[0].contentWindow.btnok(); if (self.IsFunction(c.btnok)) { c.btnok(list, index, layero); } else { AddAttach(list); layer.close(index); } }, closeBtn: 0, title: c.title, shadeClose: false, shade: 0.8, maxmin: false, //开启最大化最小化按钮 area: ['670px', '490px'], content: url }); }); return { DelAttach: DelAttach, AddAttach: AddAttach }; }, ajustphoto: function (cfg) { //自动调整图片尺寸 //sel:选择进行图片尺寸调整的区域 w:目标宽度 var defcfg = { sel: "", w: 620 }; var _c = $.extend({}, defcfg, cfg); $(_c.sel).find("img").each(function (index, element) { var img = new Image(); img.src = $(element).attr("src"); img.onload = function () { var imgWidth = img.width; //图片原始宽度 if (imgWidth > _c.w) { $(element).removeAttr("width").removeAttr("height"); //去除宽、高设置 $(element).css({ width: "auto", height: "auto" }); //去除宽、高设置 $(element).width(_c.w); $(element).prop("outerHTML", "" + $(element).prop("outerHTML") + ""); } } }); }, BindStep: function (id) { var self = this; var sel = $(id); if (sel.length <= 0) { return; } sel.html(''); self.ajax({ cache: true, type: 'GET', url: '/pub/schoolstep.shtml', success: function (D) { self.dodata(D, { 0: function (d) { $.each(sel, function (sa, sb, sm) { $.each(d.Data[0], function (b, a, m) { sb.options.add(new Option(a.stepname, a.stepid)); }); }); } }) } }); }, Str2Date: function (obj) { var s = obj.replace(/-/gi, '/'); var s1 = s.substr(0, 19); var s2 = ''; var t = new Date(); if (s.length > 19) { t = new Date(s1); s2 = s.substr(20, 3); if (s2 != '' && s2 > 0) t.setMilliseconds(s2); } else { t = new Date(s1); } return t; }, GetPager: function (cfg) { var self = this; var defc = { buttons: 5, showempty: true, showitem: true, showpages: true, itemunit: '条', itemname: '记录', changesize: false, showgo: false, showfl: true, showpn: true, total: 0, pagesize: 10, curpage: 1, cssclass: 'ExxPager', getdata: undefined }; var c = $.extend({}, defc, cfg); if (c.pagesize <= 0) { c.pagesize = 10; } if (c.curpage <= 0) { c.curpage = 1; } if (c.total <= 0) { c.total = 0; } c.pagecount = Math.ceil(c.total / c.pagesize); if (c.total <= 0) { if (c.showempty) { return '
对不起,沒有查询到相关记录!
'; } return ''; } var h = '
'; h += ""; if (c.showitem) { h += ""; } if (c.showpages) { h += ""; } if (c.changesize) { h += ""; } if (c.showfl) { h += ""; } if (c.showpn) { h += ''; } var links = []; if (c.pagecount <= c.buttons) { for (var i = 1; i <= c.pagecount; i++) { var _h = ''; links.push(_h); } } else { if (c.curpage > ((c.buttons + 1) / 2)) { if (c.curpage <= (c.pagecount - (c.buttons + 1) / 2)) { for (var i = 1; i <= c.buttons; i++) { var page = c.curpage - Math.floor((c.buttons + 1) / 2) + i; var _h = ''; links.push(_h); } } else { for (var i = 1; i <= c.buttons; i++) { var page = c.pagecount - c.buttons + i; var _h = ''; links.push(_h); } } if (c.buttons > 1) { var page = 0; if (c.curpage <= c.buttons + (c.buttons + 1) / 2) { page = Math.floor((c.buttons + 1) / 2); } else { page = c.curpage - c.buttons; } links.unshift(''); } } else { for (var i = 1; i <= c.buttons; i++) { var _h = ''; links.push(_h); } } if (c.curpage + c.buttons / 2 < c.pagecount && c.buttons > 1) { var page = 0; if (c.curpage + c.buttons > c.pagecount - c.buttons / 2) { page = c.pagecount - Math.floor(c.buttons / 2); } else { page = c.curpage + c.buttons; } links.push(''); } } $.each(links, function (b, a, m) { h += a; }); if (c.showpn) { h += ''; } if (c.showfl) { h += ""; } if (c.showgo) { h += ''; } h += "
" + c.total + "" + c.itemunit + c.itemname + "" + c.pagecount + "每页"; h += ''; h += "首页上一页下一页尾页转至第
"; var r = $(h); if (self.IsFunction(c.getdata)) { r.find("a[data-type]").not('.aspNetDisabled').off('click').on('click', function () { var t = $(this).data('type'); var d = { pagesize: 10, curpage: 1 }; switch (t) { case 'first': d.curpage = 1; break; case 'last': d.curpage = c.pagecount; break; case 'pre': d.curpage = c.curpage - 1; break; case 'next': d.curpage = c.curpage + 1; break; case 'curlink': case 'link': d.curpage = $(this).data('value'); break; default: return; } c.getdata(d); }); r.find("input:text[data-type]").not('.aspNetDisabled').off('change').on('change', function () { var t = $(this).data('type'); var d = { pagesize: 10, curpage: 1 }; switch (t) { case 'go': d.curpage = $(this).val(); if (isNaN(d.curpage)) return; break; default: return; } c.getdata(d); }); } return r; }, Load1: function (mint) { var self = this; mint = parseInt(mint); mint = isNaN(mint) ? 2000 : mint; return self.openLoading({ src: '/pub/images/loading/app_img.jpg', text: '正在加载内容', mintime: mint }); }, Load2: function (mint) { var self = this; mint = parseInt(mint); mint = isNaN(mint) ? 1000 : mint; return self.openLoading2({ mintime: mint }); }, Load3: function (callback, mint) { var self = this; mint = parseInt(mint); mint = isNaN(mint) ? 2000 : mint; return self.openLoading({ src: '/pub/images/loading/app_img.jpg', text: '正在加载内容', mintime: mint, success: callback }); }, Load4: function (callback, mint) { var self = this; mint = parseInt(mint); mint = isNaN(mint) ? 1000 : mint; return self.openLoading2({ mintime: mint, success: callback }); }, ChkSingle: function (sel) { $(sel).click(function (ev) { if ($(this).prop('checked')) { $(sel).prop('checked', false); $(this).prop('checked', true); } var oEvent = ev || event; oEvent.stopPropagation(); }) }, GetDate: function (type, getend) { var now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getFullYear(); //当前年 switch (type) { case 'week': if (getend) return [new Date(nowYear, nowMonth, nowDay - nowDayOfWeek), new Date(nowYear, nowMonth, nowDay + 6 - nowDayOfWeek)]; return [new Date(nowYear, nowMonth, nowDay - nowDayOfWeek), now]; case 'month': if (getend) return [new Date(nowYear, nowMonth, 1), new Date(nowYear, nowMonth + 1, 0)]; return [new Date(nowYear, nowMonth, 1), now]; case 'jidu': var bm = (nowMonth / 3) * 3; if (getend) return [new Date(nowYear, bm, 1), new Date(nowYear, bm + 3, 0)]; return [new Date(nowYear, bm, 1), now]; case 'year': if (getend) return [new Date(nowYear, 0, 1), new Date(nowYear + 1, 0, 0)]; return [new Date(nowYear, 0, 1), now]; } return null; }, GetTeaError: function (errortype, errortitle, errormsg, users) { var title = errortitle ? errortitle : "发生错误"; var content = errormsg ? errormsg : "很抱歉,此页面无法访问,请联系管理员"; var dotcssname = "errortype" + (errortype ? errortype : "1"); var h = ""; h += "
"; h += "
" + title + "
"; h += "
"; h += "
" + content + "
"; if (errortype == 1) { h += "
"; h += "
下列人员有权限
"; if (users && users.length > 0) { h += "
"; } else { h += "
管理员还没有配置
"; } } h += "
"; return h; }, keepaction: function () { setInterval(function () { $.ajax({ url: '/teacher/ajax.ashx' }); }, 1000 * 60 * 5); }, loadplayjs: false, //插入多个视频 openVideo(sel:选择器,url:[视频地址数组],width:宽度,height:高度,h5first:是否优先使用H5 video播放器) insertVideo: function (cfg) { var self = this; var defcfg = { sel: "", url: [], width: 600, height: 400, h5first: true }; var _c = $.extend({}, defcfg, cfg); if (typeof CKobject === 'undefined') { if (!self.loadplayjs) { self.loadplayjs = true; this.loadJs("/pub/ckplayer/ckplayer.js"); } setTimeout(function () { self.insertVideo(cfg); }, 500); return; } for (var i = _c.url.length - 1; i >= 0; i--) { $(_c.sel).prepend("
"); var flashvars = { f: _c.url[i], c: 0, p: 2 }; var params = { bgcolor: '#FFF', allowFullScreen: true, allowScriptAccess: 'always', wmode: 'transparent' }; var video = [_c.url[i] + '->video/mp4']; CKobject.embed('/pub/ckplayer/ckplayer.swf', 'ckvideo' + i, 'ckplayer_ckvideo' + i, _c.width, _c.height, _c.h5first, flashvars, video, params); } }, //全屏漂浮图片 FullScreenAd({selid:id选择器,src:图片路径,url:跳转路径,speed:速度,closebtn:是否有关闭按钮}) FullScreenAd: function (cfg) { var defcfg = { selid: "", src: "", url: "", speed: 10, closebtn: false, target: "_blank" }; var _c = $.extend({}, defcfg, cfg); var temp = ''; if (_c.url == "" && _c.closebtn) { temp = ''; } else if (_c.url == "" && !_c.closebtn) { temp = ''; } else if (_c.url != "" && _c.closebtn) { temp = ''; } else if (_c.url != "" && !_c.closebtn) { temp = ''; } $("body").append(temp.format(_c)); var obj = $("#" + _c.selid); $(obj).find(".closebtn").click(function () { $(obj).hide(); }); var max_left, max_top; var cs_w, cs_h; var offset, L, T; var wf, hf, time_opera; var img = new Image(); img.src = _c.src; img.onload = function () { max_left = $(window).width() - $(obj).width(); max_top = $(window).height() - $(obj).height(); L = cs_w = Math.round(Math.random() * max_left); T = cs_h = Math.round(Math.random() * max_top); $(obj).show(); $(obj).css({ "left": cs_w, "top": cs_h }); wf = Math.round(Math.random(1)) ? 1 : -1; hf = Math.round(Math.random(1)) ? 1 : -1; time_opera = window.setInterval(move, _c.speed); } function move() { if (L <= 0) { wf = 1; } else if (L >= max_left) { wf = -1; } if (T <= 0) { hf = 1; } else if (T >= max_top) { hf = -1; } L += wf; T += hf; $(obj).css({ "left": L + "px", "top": T + "px" }); } $(obj).hover( function () { clearInterval(time_opera); }, function () { time_opera = window.setInterval(move, _c.speed); }); }, //随机生成多张图片,插入选择器 //buildRandomPics(sel:容器选择器,data:备选数据,num:生成数量,temp:模板(url,picsrc,title)) buildRandomPics: function (cfg) { var def = { sel: "", data: [], num: 1, temp: "
  • {title}
  • " } var _c = $.extend({}, def, cfg); var l = _c.data.length; if ($(_c.sel).length <= 0) { return; } var h = ""; var indexs = []; while (_c.num > 0 && l > 0) { var i = Math.floor(Math.random() * l); if ($.inArray(i, indexs) < 0) { indexs.push(i); h += _c.temp.format(_c.data[i]); _c.num--; } } $(_c.sel).html(h); }, //标红文字 {sel:选择器,attr:属性名称(用于获取日期值),days:最近几天} setFontRed: function (option) { var _def = { sel: "", attr: "data-time", days: 2 }; var _c = $.extend({}, _def, option); if ($(_c.sel).filter("[" + _c.attr + "]").length == 0) { return; } _c.days = Number(_c.days); var now = new Date(); for (var i = 0; i < _c.days; i++) { var date = now.format("yyyyMMdd"); $(_c.sel).filter("[" + _c.attr + "='" + date + "']").css("color", "red"); now.setDate(now.getDate() - 1); } }, //内容分页 ArtPage: function (id, page, loadcss) { var self = this; var pageCount = 1;//总页数 var regExp = /_ueditor_page_break_tag_/;//根据某处字符来分页 var saveContent = "";//用于保存分页数据 var content = ""; var pageList = "";//保存全局ID var UePageContent = function (op) { content.html(''); pageList.html(""); var pageIndex = op.curpage; if (pageIndex >= 1 && pageIndex <= pageCount && saveContent != null && saveContent.length >= 0) { var pageHtml = pageList; if ((parseInt(pageIndex) - 1) <= saveContent.length) { content.html(saveContent[parseInt(pageIndex) - 1]); } if (pageCount > 1) { pageHtml.html(self.GetPager( { buttons: 5, showempty: true, showitem: false, showpages: true, itemunit: '条', itemname: '记录', changesize: false, showgo: false, showfl: true, showpn: true, total: saveContent.length, pagesize: 1, curpage: pageIndex, cssclass: 'ExxPager', getdata: UePageContent })); } } } if (loadcss) { self.loadStyles("/pub/css/ExxPager.css"); } var cTxt = $(id).html(); content = $(id); pageList = $(page); if (content.length <= 0 || pageList.length <= 0) { return; } saveContent = [cTxt]; pageCount = 1; if (cTxt != null && regExp.test(cTxt)) { saveContent = cTxt.split(regExp); pageCount = saveContent.length; } UePageContent({ pagesize: 1, curpage: 1 }); }, loadStyles: function (url) { var link = document.createElement("link"); link.type = "text/css"; link.rel = "stylesheet"; link.href = url; document.getElementsByTagName("head")[0].appendChild(link); }, loadJs: function (url) { var link = document.createElement("script"); link.type = "text/javascript"; link.src = url; document.getElementsByTagName("head")[0].appendChild(link); }, GetWeek: function (obj) { var d = null; var self = this; if (obj instanceof Date) { d = obj; } else { if (self.IsEmpty(obj)) return ''; var s = obj.replace(/-/gi, '/'); var s1 = s.substr(0, 19); var s2 = ''; if (s.length > 19) { d = new Date(s1); s2 = s.substr(20, 3); if (d && s2 != '' && s2 > 0) t.setMilliseconds(s2); } else { d = new Date(s1); } if (d == 'Invalid Date') { return ''; } } var myddy = d.getDay();//获取存储当前日期 var weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; return weekday[myddy]; } }); function showapp() { top.layer.open({ type: 1, title: ' ', shadeClose: false, shade: 0.8, scrollbar: false, area: ['410px', '481px'], //标题高度43 content: '

    ' }); } function showapplower() { top.layer.open({ type: 1, title: '', shadeClose: false, shade: 0.8, scrollbar: false, area: ['710px', '460px'], content: '

    ' }); } function getCookie(name) { var strCookie = document.cookie; var arrCookie = strCookie.split("; "); for (var i = 0; i < arrCookie.length; i++) { var arr = arrCookie[i].split("="); if (arr[0] == name) return arr[1]; } return ""; } function addCookie(name, value, path, expiresHours) { var cookieString = name + "=" + escape(value); if (path && path != "") cookieString = cookieString + "; path=" + path; else cookieString = cookieString + "; path=/"; if (expiresHours && expiresHours > 0) { var date = new Date(); date.setTime(date.getTime + expiresHours * 3600 * 1000); cookieString = cookieString + "; expires=" + date.toGMTString(); } else { var date = new Date(); date.setFullYear(date.getFullYear() + 1); cookieString = cookieString + "; expires=" + date.toGMTString(); } document.cookie = cookieString; } function delCookie(name) { var date = new Date(); date.setTime(date.getTime() - 10000); document.cookie = name + "=v; expires=" + date.toGMTString(); } /**************************************/ /************* 左侧导航 ***************/ /**************************************/ function SetMainMenu(f) { $(".main_menu" + f).removeClass().addClass('main_menuc' + f); } function SetMainMenu_teacher(f) { $(".ExxMenu " + f).removeClass('cur').addClass('cur'); } function SetMainMenu_student(f) { $("#" + f).addClass('on'); } function CreateSMenu1() { if ('undefined' != typeof (menus)) { var h = ''; $('.leftmenu').html(h); } } function HitMenu(obj) { $(obj).find('a:last')[0].click(); } function SetLink() { $('.limenu').bind('click', function () { $(this).find('a')[0].click(); }); } function dyniframesize(down) { var pTar = null; if (document.getElementById) { pTar = document.getElementById(down); } else { eval('pTar = ' + down + ';'); } if (pTar && !window.opera) { // begin resizing iframe pTar.style.display = "block"; if (pTar.contentDocument) { // ns6 syntax if (pTar.contentDocument.scrollingElement) { pTar.height = pTar.contentDocument.scrollingElement.scrollHeight + 10; pTar.width = pTar.contentDocument.scrollingElement.scrollWidth; } else if (pTar.contentDocument.body) { pTar.height = pTar.contentDocument.body.scrollHeight + 10; pTar.width = pTar.contentDocument.body.scrollWidth; } } else if (pTar.Document && pTar.Document.body.scrollHeight) { // ie5+ syntax pTar.height = pTar.Document.body.scrollHeight + 10; pTar.width = pTar.Document.body.scrollWidth; } } } function dyniframesizenowidth(down, minheight) { var pTar = null; if (document.getElementById) { pTar = document.getElementById(down); } else { eval('pTar = ' + down + ';'); } if (pTar && !window.opera) { // begin resizing iframe pTar.style.display = "block"; if (minheight) pTar.height = minheight; if (pTar.contentDocument) { // ns6 syntax if (pTar.contentDocument.scrollingElement) { if (minheight < pTar.contentDocument.scrollingElement.scrollHeight + 10) pTar.height = pTar.contentDocument.scrollingElement.scrollHeight + 10; } else if (pTar.contentDocument.body) { if (minheight < pTar.contentDocument.body.scrollHeight + 10) pTar.height = pTar.contentDocument.body.scrollHeight + 10; } } else if (pTar.Document && pTar.Document.body.scrollHeight) { // ie5+ syntax if (minheight < pTar.Document.body.scrollHeight + 10) pTar.height = pTar.Document.body.scrollHeight + 10; } } } function ChkBind(chkall, chkitems) { $(document).on('click', chkall, function () { $(chkitems).prop('checked', $(this).prop('checked')); }) $(document).on('click', chkitems, function () { var t = $(chkitems).length; if (t == $(chkitems).filter(':checked').length) { $(chkall).prop('checked', true); } else { $(chkall).prop('checked', false); } }) } function ExxShow(msg) { layer.closeAll(); if (typeof (msg) != 'undefined' && msg != "") layer.alert(msg); } function ExxConfirm(msg, obj) { top.layer.confirm(msg, function (index) { top.layer.close(index); obj[0].click(); }); } String.prototype.format = function (args) { var result = this; if (arguments.length > 0) { if (arguments.length == 1 && typeof (args) == "object") { if (Exx.IsArray(args)) { $.each(args, function (key, a) { if (a != undefined) { var reg = new RegExp("({)" + key + "(})", "g"); result = result.replace(reg, a); } }); } else { for (var key in args) { if (args[key] != undefined) { var reg = new RegExp("({)" + key + "(})", "g"); result = result.replace(reg, args[key]); } } } } else { for (var i = 0; i < arguments.length; i++) { if (arguments[i] != undefined) { var reg = new RegExp("({)" + i + "(})", "g"); result = result.replace(reg, arguments[i]); } } } } return result; } $(document).ready(function (e) { $('.xxk_list tr:even').addClass('odd'); //".datatable"涓簍able鐨刢lass灞炴€� //榧犳爣绉诲姩娣诲姞鑳屾櫙棰滆壊 $('.xxk_list tr').hover( //榧犳爣鎮仠鐨勮〃鏍煎姞涓婄壒瀹氱殑绫� function () { $(this).addClass('highlight'); }, function () { $(this).removeClass('highlight'); } ); }); function layerclose() { var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index); } function ExxCloseWindow() { window.opener = null; //window.opener=top; window.open("", "_self"); window.close(); } function exxcopy(val) { var txt = val; if (window.clipboardData) { window.clipboardData.clearData(); window.clipboardData.setData("Text", txt); if (layer) layer.alert("成功复制!到编辑窗口粘贴(Ctrl+v)即可", 9); else alert("成功复制!到编辑窗口粘贴(Ctrl+v)即可"); return true; } else if (navigator.userAgent.indexOf("Opera") != -1) { if (layer) layer.alert("此功能不支持Opera,请手工复制文本框中内容"); else alert("此功能不支持Opera,请手工复制文本框中内容"); return false; } else if (window.netscape) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { if (layer) layer.alert("您的firefox安全限制限制您进行剪贴板操作,请打开'about:config'将 signed.applets.codebase_principal_support'设置为true'之后重试"); else alert("您的firefox安全限制限制您进行剪贴板操作,请打开'about:config'将 signed.applets.codebase_principal_support'设置为true'之后重试"); return false; } var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); if (!clip) { return false; } var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); if (!trans) { return false; } trans.addDataFlavor('text/unicode'); var str = new Object(); var len = new Object(); var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); var copytext = txt; str.data = copytext; trans.setTransferData("text/unicode", str, copytext.length * 2); var clipid = Components.interfaces.nsIClipboard; if (!clip) { return false; } clip.setData(trans, null, clipid.kGlobalClipboard); if (layer) layer.alert("成功复制!到编辑窗口粘贴(Ctrl+v)即可", 9); else alert("成功复制!到编辑窗口粘贴(Ctrl+v)即可"); return true; } else { if (layer) layer.alert("浏览器不支持复制,请手工复制文本框中内容"); else alert("浏览器不支持复制,请手工复制文本框中内容"); return false; } } function ExxOkBtn(obj, msg, showloading) { if ($(obj).attr("ExxOkBtn") == 'ok') { return true; } top.layer.confirm(msg, function () { top.layer.closeAll(); $(obj).attr("ExxOkBtn", "ok"); if (showloading) top.layer.load(); $(obj)[0].click(); }); return false; } function ToDate(obj, format) { if (Exx.IsEmpty(obj)) return obj; var s = obj.replace(/-/gi, '/'); var s1 = s.substr(0, 19); var s2 = ''; var t = new Date(); if (s.length > 19) { t = new Date(s1); s2 = s.substr(20, 3); if (s2 != '' && s2 > 0) t.setMilliseconds(s2); } else { t = new Date(s1); } return t.format(format); } Date.prototype.format = function (fmt) { var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours() % 12 == 0 ? 12 : this.getHours() % 12, //小时 "H+": this.getHours(), //小时 "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds() //毫秒 }; var week = { "0": "/u65e5", "1": "/u4e00", "2": "/u4e8c", "3": "/u4e09", "4": "/u56db", "5": "/u4e94", "6": "/u516d" }; if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); } if (/(E+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "/u661f/u671f" : "/u5468") : "") + week[this.getDay() + ""]); } for (var k in o) { if (new RegExp("(" + k + ")").test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); } } return fmt; } Array.prototype.remove = function (val) { var index = $.inArray(val, this) while (index > -1) { this.splice(index, 1); index = this.indexOf(val); } }; Array.prototype.clear = function (val) { this.splice(0, this.length); }; function printArea(sel) { var newstr = $(sel).html();//获取指定打印区域 var oldstr = $("body").html();//获得原本页面的代码 document.body.innerHTML = newstr;//购建新的网页 window.print();//打印刚才新建的网页 document.body.innerHTML = oldstr;//将网页还原 } function showflow(flowid, taskgroupid, isgroup) { var g = isgroup ? 1 : 0; var layeri = top.layer.open({ type: 2, area: ['800px', '600px'], content: '/common/flow/show.aspx?flowid=' + $.trim(flowid) + '&taskgroupid=' + $.trim(taskgroupid) + "&isgroup=" + g }); return layeri; } $(document).on('focus', "[ExxDefClass]", function () { var s = $(this).attr('ExxDefClass'); var v = $(this).val(); $(this).removeClass(s); }); $(document).on('blur', "[ExxDefClass]", function () { var s = $(this).attr('ExxDefClass'); var v = $(this).val(); if (v == '') { $(this).addClass(s); } }); $(document).ready(function () { $("[ExxDefClass]").each(function () { var s = $(this).attr('ExxDefClass'); var v = $(this).val(); if (v == '') { $(this).addClass(s); } }); Exx_placeholder(); }); function Exx_placeholder() { if (!('placeholder' in document.createElement('input'))) { $('input[placeholder]').each(function (index, element) { var $element = $(this); var elementId = $element.attr('id'); var placeholder = $element.attr('placeholder'); if (!placeholder) return; if (!elementId) { var now = new Date(); elementId = 'lbl_placeholder' + now.getSeconds() + now.getMilliseconds(); $element.attr('id', elementId); } // 添加label标签,用于显示placeholder的值 var $label = $('