socialforge/public/javascripts/project.js

234 lines
6.2 KiB
JavaScript
Raw Normal View History

//验证搜索时输入字
function regexName(content) {
var name = $.trim($("#name").val());
if (name.length == 0) {
$("#project_name_span").text(content);
$("#project_name_span").css('color', '#ff0000');
$("#project_name_span").focus();
return false;
}
else {
$("#project_name_span").text("");
return true;
}
}
function submitSerch(content)
{
if(regexName(content)){$("#project_search_form").submit();}
}
// 项目描述超过展开
//$(function(){
// $(".subNav").click(function(){
//
// })
//})
function expand_tools_expand()
{
$("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd");
$("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
// 修改数字控制速度, slideUp(500)控制卷起速度
$("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
}
// 描述显示更多信息
function show_more_msg(){
$("#course_description").toggleClass("course_description_none");
var information = $("#expend_more_information");
var arrow = $("#arrow");
var val = information.attr("value");
if (val=="展开更多信息" )
{
$("#expend_more_information").text("收起描述信息");
information.attr("value","收起描述信息");
arrow.attr("src","/images/jiantouup.jpg")
}
else
{
$("#expend_more_information").text("展开更多信息");
information.attr("value","展开更多信息");
arrow.attr("src","/images/jiantou.jpg")
}
}
///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////项目讨论区
function regexSubject()
{
var content = $.trim($("#message_subject").val());
if(content.length ==0)
{
$("#subject_span").text("主题不能为空");
$("#subject_span").css('color','#ff0000');
return false;
}
else
{
$("#subject_span").text("填写正确");
$("#subject_span").css('color','#008000');
return true;
}
return false;
}
function regexContent()
{
var content = $.trim($("#message_content").val());
if(content.length ==0)
{
$("#message_content_span").text("描述不能为空");
$("#message_content_span").css('color','#ff0000');
return false;
}
else
{
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color','#008000');
return true;
}
return false;
}
// 项目编辑和提交
function submitProjectsBoard()
{
if(regexSubject()&&regexContent()){$("#message-form").submit();}
}
// 提交新闻
function regexTitle()
{
var name = $("#news_title").val();
if(name.length ==0)
{
$("#title_notice_span").text("标题不能为空");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
else if(name.length <= 60)
{
$("#title_notice_span").text("填写正确");
$("#title_notice_span").css('color','#008000');
return true;
}
else
{
$("#title_notice_span").text("标题超过60个字符");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
}
function regexDescription()
{
var name = $("#news_description").val();
if(name.length ==0)
{
$("#description_notice_span").text("描述不能为空");
$("#description_notice_span").css('color','#ff0000');
$("#description_notice_span").focus();
return false;
}
else
{
$("#description_notice_span").text("填写正确");
$("#description_notice_span").css('color','#008000');
return true;
}
}
function submitNews()
{
if(regexTitle() && regexDescription())
{
$("#news-form").submit();
}
}
function submitFocus(obj)
{
$(obj).focus();
}
//当项目描述长度小于112px时不显示更多按钮
$(function(){
// alert($("#course_description_content").height());
if($("#course_description_content").height()>112)
{
$("#lg-foot").show();
}
});
//配置项目信息
function course_setting(id)
{
//alert(id);
$('#tb_'+id).removeClass().addClass("hwork_hovertab");
$('#tbc_0'+id).removeClass().addClass("dis");
$('#tb_'+(3-id)).removeClass().addClass("hwork_normaltab");
$('#tbc_0'+(3-id)).removeClass().addClass("undis");
}
//项目类型
function show_window () {
$('#light').css('display','block');
$('#fade').css('display','block');
}
function close_window(type){
$('#light').css('display','none');
$('#fade').css('display','none');
$("#" + type).attr("checked","checked");
}
//弹框l
/////////////////////////////////////////////
//项目配置
function project_setting(n)
{
for(var i = 1;i < 9; i++)
{
if(i == n)
{
$("#pro_st_tb_"+i).removeClass().addClass("pro_st_hovertab");
$("#pro_st_tbc_0"+i).removeClass().addClass("pro_st_dis");
}
else
{
2015-04-11 17:28:18 +08:00
$("#pro_st_tb_"+i).removeClass().addClass("pro_st_normaltab");
$("#pro_st_tbc_0"+i).removeClass().addClass("pro_st_undis");
}
}
}
//配置--成员---申请列表--拒绝
function refusal_applied_member()
{
$('#new_membership').append("<input name = 'refusal_button' style='display: none;'>");
$('#new_membership').submit();
}
//新闻描述显示更多信息
function news_show_more_des(id)
{
$('#news_description_' + id).toggleClass("news_description_none");
2015-04-15 16:34:34 +08:00
}
$(document).ready(function(){
$("#issue_project_id").css("width","100%");
$("#issue_project_id").css("overflow ","hidden");
// $(".jstEditor").css("margin-left ","80px");
//issue_project_id
});
function showAndScrollTo(id, focus) {
$('#'+id).show();
if (focus !== null) {
$('#'+focus).focus();
}
$('html, body').animate({scrollTop: $('#'+id).offset().top}, 400);
}