12 |
- //首页
- $(function(){$(".lblRect").click(function(){$(this).addClass("active").siblings(".active").removeClass("active")});$(".fcha").click(function(){$(this).parents("li").remove()})});$(function(){$(".jam").click(function(){$(this).parents(".tix").remove()})});$(function(){$(".vanish").click(function(){$(this).parents(".popup").fadeOut()})});$(function(){$change_li=$(".jlist li");$change_li.each(function(c){$(this).click(function(){$(this).addClass("active").siblings(".active").removeClass("active");$(".choice .volume").eq(c).show().siblings(".volume").hide()})})});$(function(){$("#caseContent").keyup(function(){var c=$(this),a=parseInt(c.attr("maxlength"),10);if(0<a){c.val().length>a&&c.val(c.val().substr(0,a));var b=c.val().length,c=a-c.val().length;$("#lyishu").html(b);$("#lsheng").html(c)}});$("#caseContent").blur(function(){var c=$(this),a=parseInt(c.attr("maxlength"),10);if(0<a){c.val().length>a&&c.val(c.val().substr(0,a));var b=c.val().length,c=a-c.val().length;$("#lyishu").html(b);$("#lsheng").html(c)}})});function changeCreateType(c){var a=parseInt($("input[name\x3d'grade']").val());!isNaN(a)&&1<=a&&3>=a?$.get("/exams/ajaxChangeCreateType",{type:c,grade:a},function(a){if(0==a.status)$.alert(a.error),$("#classes").html("");else{var d="",c;for(c in a)d+='\x3clabel class\x3d"cur ml10"\x3e\x3cinput type\x3d"checkbox" name\x3d"classId[]" value\x3d"'+a[c].class_id+'" style\x3d"vertical-align:calc();" /\x3e '+a[c].class_name+"\x3c/label\x3e";$("input[name\x3d'classIds']").val("");$("#classes").html(d);0<a.length?($("#checkClasses").show(),$("input#checkAll").prop("checked",!0),$("input[name\x3d'classId[]']").prop("checked",!0)):$("#checkClasses").hide()}}):$.alert("\u8bf7\u9009\u62e9\u5e74\u7ea7!")}function changeGrade(c){var a=parseInt($("input[name\x3d'createType']").val());!isNaN(c)&&0<=c&&3>=c?$.get("/exams/ajaxChangeCreateType",{type:a,grade:c},function(a){if(0==a.status)$.alert(a.error),$("#classes").html("");else{var d="",c;for(c in a)d+='\x3clabel class\x3d"cur ml10"\x3e\x3cinput type\x3d"checkbox" name\x3d"classId[]" value\x3d"'+a[c].class_id+'" style\x3d"vertical-align:calc();" /\x3e '+a[c].class_name+"\x3c/label\x3e";$("input[name\x3d'classIds']").val("");$("#classes").html(d);0<a.length?($("#checkClasses").show(),$("input#checkAll").prop("checked",!0),$("input[name\x3d'classId[]']").prop("checked",!0)):$("#checkClasses").hide()}}):$.alert("\u8bf7\u9009\u62e9\u751f\u6210\u65b9\u5f0f!")}$(function(){function c(){this.init.apply(this,arguments)}c.prototype={init:function(a){this.setOpts(a);this.o=this.getByClass(this.opt.TTContainer,document,"div");this.b=this.getByClass(this.opt.TTDiy_select_btn);this.t=this.getByClass(this.opt.TTDiy_select_txt);this.l=this.getByClass(this.opt.TTDiv_select_list);this.ipt=this.getByClass(this.opt.TTDiy_select_input);this.lengths=this.o.length;this.showSelect()},addClass:function(a,b){a.className=a.className?a.className+" "+b:b},removeClass:function(a,b){var d=new RegExp("\\b"+b+"\\b");a.className=a.className?a.className.replace(d,""):""},addEvent:function(a,b,d){return a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent("on"+b,d)},showSelect:function(){var a=this;this.addEvent(document,"click",function(){for(var b=0;b<a.lengths;b++)a.l[b].style.display="none"});for(var b=0;b<this.lengths;b++)this.l[b].index=this.b[b].index=this.t[b].index=b,this.t[b].onclick=this.b[b].onclick=function(b){b=window.event||b;var c=this.index;a.item=a.l[c].getElementsByTagName("li");a.l[c].style.display="block"==a.l[c].style.display?"none":"block";for(var e=0;e<a.lengths;e++)e!=c&&(a.l[e].style.display="none");a.addClick(a.item);b.stopPropagation?b.stopPropagation():b.cancelBubble=!0}},addClick:function(a){if(0<a.length)for(var b=this,d=0;d<a.length;d++)a[d].onmouseover=function(){b.addClass(this,b.opt.TTFcous)},a[d].onmouseout=function(){b.removeClass(this,b.opt.TTFcous)},a[d].onclick=function(){var a=this.parentNode.index,d=$(this).attr("type"),c=$(this).attr("name"),g=this.innerHTML.replace(/^\s+/,"").replace(/\s+&/,"");b.t[a].innerHTML=g;$("input[name\x3d'examName']").val(g);$("#createTypeName").html(c);b.ipt[a].value=d;b.l[a].style.display="none";changeCreateType(d)}},getByClass:function(a,b,d){a=new RegExp("\\b"+a+"\\b");var c=[];b=(b||document).getElementsByTagName(d||"*");for(d=0;d<b.length;d++)a.test(b[d].className)&&c.push(b[d]);return c},setOpts:function(a){this.opt={TTContainer:"diy_select",TTDiy_select_input:"diy_select_input",TTDiy_select_txt:"diy_select_txt",TTDiy_select_btn:"diy_select_btn",TTDiv_select_list:"diy_select_list",TTFcous:"focus"};for(var b in a)this.opt[b]=a[b]?a[b]:this.opt[b]}};new c({TTContainer:"diy_select",TTDiy_select_input:"diy_select_input",TTDiy_select_txt:"diy_select_txt",TTDiy_select_btn:"diy_select_btn",TTDiv_select_list:"diy_select_list",TTFcous:"focus"})});$(function(){function c(){this.init.apply(this,arguments)}c.prototype={init:function(a){this.setOpts(a);this.o=this.getByClass(this.opt.TTContainer,document,"div");this.b=this.getByClass(this.opt.TTDiy_select_btn);this.t=this.getByClass(this.opt.TTDiy_select_txt);this.l=this.getByClass(this.opt.TTDiv_select_list);this.ipt=this.getByClass(this.opt.TTDiy_select_input);this.lengths=this.o.length;this.showSelect()},addClass:function(a,b){a.className=a.className?a.className+" "+b:b},removeClass:function(a,b){var d=new RegExp("\\b"+b+"\\b");a.className=a.className?a.className.replace(d,""):""},addEvent:function(a,b,d){return a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent("on"+b,d)},showSelect:function(){var a=this;this.addEvent(document,"click",function(){for(var b=0;b<a.lengths;b++)a.l[b].style.display="none"});for(var b=0;b<this.lengths;b++)this.l[b].index=this.b[b].index=this.t[b].index=b,this.t[b].onclick=this.b[b].onclick=function(b){b=window.event||b;var c=this.index;a.item=a.l[c].getElementsByTagName("li");a.l[c].style.display="block"==a.l[c].style.display?"none":"block";for(var e=0;e<a.lengths;e++)e!=c&&(a.l[e].style.display="none");a.addClick(a.item);b.stopPropagation?b.stopPropagation():b.cancelBubble=!0}},addClick:function(a){if(0<a.length)for(var b=this,c=0;c<a.length;c++)a[c].onmouseover=function(){b.addClass(this,b.opt.TTFcous)},a[c].onmouseout=function(){b.removeClass(this,b.opt.TTFcous)},a[c].onclick=function(){var a=this.parentNode.index,c=$(this).attr("value");$(this).attr("name");var d=this.innerHTML.replace(/^\s+/,"").replace(/\s+&/,"");b.t[a].innerHTML=d;b.ipt[a].value=c;b.l[a].style.display="none";changeGrade(c)}},getByClass:function(a,b,c){a=new RegExp("\\b"+a+"\\b");var f=[];b=(b||document).getElementsByTagName(c||"*");for(c=0;c<b.length;c++)a.test(b[c].className)&&f.push(b[c]);return f},setOpts:function(a){this.opt={TTContainer:"diy_select2",TTDiy_select_input:"diy_select_input2",TTDiy_select_txt:"diy_select_txt2",TTDiy_select_btn:"diy_select_btn2",TTDiv_select_list:"diy_select_list2",TTFcous:"focus"};for(var b in a)this.opt[b]=a[b]?a[b]:this.opt[b]}};new c({TTContainer:"diy_select2",TTDiy_select_input:"diy_select_input2",TTDiy_select_txt:"diy_select_txt2",TTDiy_select_btn:"diy_select_btn2",TTDiv_select_list:"diy_select_list2",TTFcous:"focus"})});
|