zujuan.js 3.2 KB

1
  1. $(document).ready(function(){function a(){for(var a=0,c=0;c<$(".set-useclass dt input").length;c++)$(".set-useclass dt input").eq(c).attr("checked")&&a++;a==$(".set-useclass dt input").length?$(".set-useclass h2 input").attr("checked",!0):$(".set-useclass h2 input").attr("checked",!1)}$(".model-shadow").width($(window).width());$(".model-shadow").height($(window).height());$(".error-correction").each(function(){$(this).bind("click",function(){$(".model-test").show()})});$(".close-error-correction").each(function(){$(this).bind("click",function(){$(this).closest(".model-close").hide()})});$(".change-question").bind("click",function(){$(".model-change-test").show()});$(".replace-question").bind("click",function(){$(this).closest(".model-close").hide()});$(".editing-test dt").each(function(){$(this).find("font").html()!=$(this).find("span").html()?$(this).addClass("bg-red").removeClass("bg-gray"):$(this).addClass("bg-gray").removeClass("bg-red")});$("body").delegate(".editing-test dt","click",function(){$(this).closest("dl").find("dd").toggle()});$(".set-useclass h2 input").bind("click",function(){$(".set-useclass input").attr("checked",$(this).attr("checked"));$(".set-useclass dt input").attr("checked");$(".set-useclass dt input").closest("dt").next("dd").find("input").attr("checked",$(this).attr("checked"))});$(".set-useclass dt input").bind("click",function(){$(".set-useclass dt");$(this).closest("dt").next("dd").find("input").attr("checked",$(this).attr("checked"));a()});$(".set-useclass dd").each(function(){var b=$(this);$(this).find("input").bind("click",function(){for(var c=0,d=0;d<b.find("input").length;d++)1==b.find("input")[d].checked&&c++;c==b.find("input").length?$(this).closest("dl").find("dt input").attr("checked",!0):($(this).closest("dl").find("dt input").attr("checked",!1),$(".set-useclass h2 input").attr("checked",!1));a()})});$(".choose-test ol li").click(function(){0!=$(this).index()&&$(this).addClass("bg-hot").siblings("li").removeClass("bg-hot")});$(".topic-total").bind("mousedown",function(a){var c=$(this);a=a||event;var d=a.clientX-$(this).offset().left,e=a.clientY+$("body").scrollTop()-$(this).offset().top;$(document).bind("mousemove",function(a){var b=a||event;a=b.clientX-d;b=b.clientY-e;0>a&&(a=0);0>b&&(b=0);b>$(window).height()-c.height()&&(b=$(window).height()-c.height());a>$(window).width()-c.width()&&(a=a>$(window).width()-c.width());c.css({left:a+"px"});c.css({top:b+"px"})});$(document).mouseup(function(){$(document).unbind("mousemove");$(document).unbind("mouseup")});return!1});$("body").delegate(".choose-question .ellipsis","mouseover",function(){0==$(this).siblings(".ellipsis-html").length&&$(this).parent("ul").append('\x3cp class\x3d"ellipsis-html"\x3e'+$(this).html()+"\x3c/p\x3e")});$("body").delegate(".choose-question .ellipsis","mouseout",function(){$(this).parent("ul").children(".ellipsis-html").remove()})});function numToLetter(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),c="";1<=a&&26>=a&&(c=b[a-1]);return c}function numToUpper(a){a=a.toString();a=a.substr(0,2);var b="\u96f6\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d".split("");1==a.length?result=b[a]:10==a?result="\u5341":(result=20>a?"\u5341":b[a.substr(0,1)]+"\u5341","0"!=a.substr(1,1)&&(result+=b[a.substr(1,1)]));return result};