From 689ec5cdfc0038b523ec8916c49106832f756734 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Thu, 21 May 2015 15:57:58 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E6=9B=B4=E5=A4=9A=E5=8A=9F=E8=83=BDbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/news/_course_news.html.erb | 4 +-
public/javascripts/course.js | 578 ++++++++++++---------------
2 files changed, 251 insertions(+), 331 deletions(-)
diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb
index 947b95076..7877782f6 100644
--- a/app/views/news/_course_news.html.erb
+++ b/app/views/news/_course_news.html.erb
@@ -36,9 +36,9 @@
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
+
作品提交还剩:
"); -} -//验证新建作业的名字 -function regex_bid_name() -{ +function show_bid_dead_line(year, month, day, divname) { + var now = new Date(); + var endDate = new Date(year, month - 1, day); + var leftTime = endDate.getTime() - now.getTime(); + var leftsecond = parseInt(leftTime / 1000); + var day1 = Math.floor(leftsecond / (60 * 60 * 24)); + var hour = Math.floor((leftsecond - day1 * 24 * 60 * 60) / 3600); + var minute = Math.floor((leftsecond - day1 * 24 * 60 * 60 - hour * 3600) / 60); + var second = Math.floor(leftsecond - day1 * 24 * 60 * 60 - hour * 3600 - minute * 60); + $("#" + divname).html("" + "作品提交还剩:
"); + } + //验证新建作业的名字 + +function regex_bid_name() { var name = $.trim($("#bid_name").val()); - if(name=="") - { + if (name == "") { $("#bid_name_span").text("名称不能为空"); return false; - } - else - { + } else { $("#bid_name_span").text(""); return true; } } //验证匿评数量 -function regex_evaluation_num() -{ +function regex_evaluation_num() { var evaluation_num = $.trim($("#bid_evaluation_num").val()); var regex = /^\d+$/; - if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") - { - if(evaluation_num=="") - { + if ($("#bid_open_anonymous_evaluation").attr("checked") == "checked") { + if (evaluation_num == "") { $("#bid_evaluation_num_span").text("匿评分配数量不能为空"); return false; - } - else if(regex.test(evaluation_num)) - { - if(evaluation_num > 0) - { + } else if (regex.test(evaluation_num)) { + if (evaluation_num > 0) { $("#bid_evaluation_num_span").text(""); return true; - } - else - { + } else { $("#bid_evaluation_num_span").text("匿评分配数量必须为大于0"); return false; } - } - else - { + } else { $("#bid_evaluation_num_span").text("匿评分配数量只能为数字"); return false; } - } - else - { + } else { return true; } } //点击是否开启匿评单选框效果 -$(function(){ - $("#bid_open_anonymous_evaluation").click(function(){ - if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") - { +$(function() { + $("#bid_open_anonymous_evaluation").click(function() { + if ($("#bid_open_anonymous_evaluation").attr("checked") == "checked") { $("#bid_evaluation_num_li").slideDown(); - } - else - { + } else { $("#bid_evaluation_num_li").slideUp(); } }); }); //老师提交新建作业 -function submit_new_bid(id) -{ - if(regex_bid_name()&®ex_evaluation_num()) - { +function submit_new_bid(id) { + if (regex_bid_name() && regex_evaluation_num()) { bid_description_editor.sync(); - $("#"+id).submit(); + $("#" + id).submit(); } } -function show_window (id1,id2,top,left) { - $('#'+ id1).css('top',top); - $('#'+ id1).css('left',left); - $('#'+ id1).css('display','block'); - $('#' + id2).css('display','block'); +function show_window(id1, id2, top, left) { + $('#' + id1).css('top', top); + $('#' + id1).css('left', left); + $('#' + id1).css('display', 'block'); + $('#' + id2).css('display', 'block'); } -function close_window(id1,id2){ - $('#' + id1).css('display','none'); - $('#' + id2).css('display','none'); +function close_window(id1, id2) { + $('#' + id1).css('display', 'none'); + $('#' + id2).css('display', 'none'); } //隐藏提示狂 -function hidden_atert_form(cur_page,cur_type) -{ +function hidden_atert_form(cur_page, cur_type) { hideModal($("#popbox")); } //当课程描述长度小于112px时,不显示更多按钮 -$(function(){ - if($("#course_description_content").height()>112) - { +$(function() { + if ($("#course_description_content").height() > 112) { $("#lg-foot").show(); } }); //将右侧的最小高度设置成左侧高度,美化界面 // firefox pre标签换行 -$(document).ready(function () { - $("#RSide").css("min-height",$("#LSide").height()-30); +$(document).ready(function() { + $("#RSide").css("min-height", $("#LSide").height() - 30); var userAgent = navigator.userAgent.toLowerCase(); var browser = { version: (userAgent.match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || [])[1], @@ -494,50 +415,55 @@ $(document).ready(function () { msie: /msie/.test(userAgent) && !/opera/.test(userAgent), mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) }; - if (browser.mozilla || browser.opera){ + if (browser.mozilla || browser.opera) { $("pre").addClass("break_word_firefox"); - } - else{ + } else { $("pre").addClass("break_word"); } }); // 日历选择日期后关闭 -function regexDeadLine() -{ +function regexDeadLine() { ('#ui-datepicker-div').hide; } //新建、修改课程明码显示 -$(function(){ +$(function() { $("#psw_btn").click(function() { - alert("密码: "+$("#course_course_password").val()); + alert("密码: " + $("#course_course_password").val()); }); }); //课程通知更多按钮显示 -$(function(){ - $('.news_description').each(function () { - if($(this).height() >= 38) - { - $('#news_foot_'+$(this).attr('id').replace('news_description_','')).css("display","block"); - } +$(function() { + $('.news_description').each(function() { + if ($(this).height() >= 38) { + $('#news_foot_' + $(this).attr('id').replace('news_description_', '')).css("display", "block"); + } + }); + + $(".news_description img").one('load', function() { + var node = $(this).parents('.news_description'); + if (node && node.height() >= 38) { + $('#news_foot_' + node.attr('id').replace('news_description_', '')).css("display", "block"); + } + }).each(function() { + if (this.complete) { + $(this).load(); } - ) + }); }); //查找TAG资源 -function search_tag_attachment(url,tag_name,q,course_id,sort) -{ +function search_tag_attachment(url, tag_name, q, course_id, sort) { //alert("111"); $.get( - url, - { + url, { tag_name: tag_name, q: q, - course_id:course_id + course_id: course_id }, - function (data) { + function(data) { } ); @@ -546,27 +472,22 @@ function search_tag_attachment(url,tag_name,q,course_id,sort) // 课程讨论区 function showhelpAndScrollToMessage(id, id1, count) { $('#' + id).toggle(); - if(cookieget("repositories_visiable") == "true") - { - cookiesave("repositories_visiable", false,'','',''); - } - else - { - cookiesave("repositories_visiable", true,'','',''); + if (cookieget("repositories_visiable") == "true") { + cookiesave("repositories_visiable", false, '', '', ''); + } else { + cookiesave("repositories_visiable", true, '', '', ''); } var information = $(id1); var val = information.attr("value"); - if(val=="show_help") - { - $(id1).text("收起回复(" + count + ")" ); + if (val == "show_help") { + $(id1).text("收起回复(" + count + ")"); information.attr("value", "hide_help"); - } - else - { + } else { $(id1).text("展开回复(" + count + ")"); information.attr("value", "show_help"); } } + function show_more_reply(contentid, id2, id3) { $(contentid).toggleClass("course_description_none"); var information = $(id2); @@ -576,10 +497,9 @@ function show_more_reply(contentid, id2, id3) { $(id2).text("[收起]"); information.attr("value", "hide_more"); arrow.attr("src", "/images/jiantouup.jpg") - } - else { + } else { $(id2).text("[展开]"); information.attr("value", "show_more"); arrow.attr("src", "/images/jiantou.jpg") } -} \ No newline at end of file +}