This commit is contained in:
huang 2015-11-10 17:12:41 +08:00
commit bebda15582
4 changed files with 141 additions and 97 deletions

View File

@ -128,6 +128,11 @@
});
$mail.blur(function (event) {
if (/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
$('#mail_req').html( '<span style="color: red">邮件格式不对</span>').show();
$mail_correct = false;
return ;
}
if ($(this).is('#user_mail')) {
$.get('<%=account_valid_ajax_path%>',
{ valid: "mail",

View File

@ -1,4 +1,56 @@
<%= javascript_include_tag 'new_user','/assets/kindeditor/pasteimg','/assets/kindeditor/kindeditor' %>
<div class="postRightContainer">
<div id="create_memo_div" style="display: none">
<div id="error" class="red fl mb10" style="display: none">error</div>
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
<div>
<textarea type="text" name="memo[subject]" id="memo_subject" maxlength="50" onblur="check_memo_name();" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子标题" ></textarea>
<script>
var textarea1 = document.getElementById('memo_subject');
autoTextarea(textarea1);
</script>
</div>
<div class="mt15">
<%= kindeditor_tag 'memo[content]','',:height=>300,:editor_id=>'memo_content'%>
</div>
<div class="mt10">
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">上传附件</a>-->
<%= render :partial => 'file_form', :locals => {:container => @memo} %>
<div class="fr">
<a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit();">确定</a>
</div>
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="create_cancle();">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="postDetailBanner">
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class="sortArrowActiveD"></a><!--<a href="javascript:void(0);" class="sortArrowActiveD"></a>--></div>
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0);" id="reorder_time" class=""></a></div>
<div class="creatPost" id="create_memo_btn"><a href="javascript:void(0);" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#create_memo_div').slideToggle();$(this).parent().slideToggle();">发布新帖</a></div>
<div class="cl"></div>
</div>
<div id="topics_list">
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %>
</ul>
<!--<div class="pageRoll">-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>-->
<!--<div class="pageCell pageCellActive"><a href="javascript:void(0);" class="c_white">1</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">2</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">3</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">...</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">14</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">下一页</a></div>-->
<!--</div>-->
<!--<div class="cl"></div>-->
</div>
</div>
<script>
function add_class(id){
if($("#"+id).hasClass("sortArrowActiveD")){
@ -78,6 +130,7 @@
}
if(memo_content.html().length > 30000){
$("#error").html("内容 过长(最长为 30000 个字符)").show();
$("html,body").animate({scrollTop:$("#error").offset().top},1000)
return false;
}
return true;
@ -91,54 +144,3 @@
$('#error').html('').hide();
}
</script>
<div class="postRightContainer">
<div id="create_memo_div" style="display: none">
<div id="error" class="red fl mb10" style="display: none">error</div>
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
<div>
<textarea type="text" name="memo[subject]" id="memo_subject" maxlength="50" onblur="check_memo_name();" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子标题" ></textarea>
<script>
var textarea1 = document.getElementById('memo_subject');
autoTextarea(textarea1);
</script>
</div>
<div class="mt15">
<%= kindeditor_tag 'memo[content]','',:height=>300,:editor_id=>'memo_content'%>
</div>
<div class="mt10">
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">上传附件</a>-->
<%= render :partial => 'file_form', :locals => {:container => @memo} %>
<div class="fr">
<a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit();">确定</a>
</div>
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="create_cancle();">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="postDetailBanner">
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class="sortArrowActiveD"></a><!--<a href="javascript:void(0);" class="sortArrowActiveD"></a>--></div>
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0);" id="reorder_time" class=""></a></div>
<div class="creatPost" id="create_memo_btn"><a href="javascript:void(0);" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#create_memo_div').slideToggle();$(this).parent().slideToggle();">发布新帖</a></div>
<div class="cl"></div>
</div>
<div id="topics_list">
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %>
</ul>
<!--<div class="pageRoll">-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>-->
<!--<div class="pageCell pageCellActive"><a href="javascript:void(0);" class="c_white">1</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">2</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">3</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">...</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">14</a></div>-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">下一页</a></div>-->
<!--</div>-->
<!--<div class="cl"></div>-->
</div>
</div>

View File

@ -7,10 +7,11 @@
$("#error").html('主题不能超过50个字符').show();
return;
}
// if(memo_content.html().trim().length > 5000 ){
// $("#error").html('内容不能超过5000个字符').show();
// return;
// }
if(memo_content.html().length > 30000){
$("#error").html("内容 过长(最长为 30000 个字符)").show();
$("html,body").animate({scrollTop:$("#error").offset().top},1000)
return false;
}
memo_content.sync();
$("#edit_memo").submit();
}else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){

View File

@ -1,5 +1,10 @@
(function($){
$.fn.fix = function(options){
var u = navigator.userAgent;
if((u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 ||u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1)){
$("#scrollsidebar").css("display","none");
return;
}
var defaults = {
float : 'right',
minStatue : true,
@ -73,6 +78,11 @@ function cookieget(n)
$(function(){
var u = navigator.userAgent;
if((u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 ||u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1)){
$("#scrollsidebar").css("display","none");
return;
}
$(".closeSidebar").click(function(){
$(".show_btn").css("display","none");
$("#scrollsidebar").css("display","none");
@ -110,3 +120,29 @@ $(function(){
}
});
});
//var browser={
// versions:function(){
// var u = navigator.userAgent, app = navigator.appVersion;
// return {//移动终端浏览器版本信息
// trident: u.indexOf('Trident') > -1, //IE内核
// presto: u.indexOf('Presto') > -1, //opera内核
// webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
// gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
// mobile: !!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/), //是否为移动终端
// ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
// android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
// iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器
// iPad: u.indexOf('iPad') > -1, //是否iPad
// webApp: u.indexOf('Safari') == -1 //是否web应该程序没有头部与底部
// };
// }(),
// language:(navigator.browserLanguage || navigator.language).toLowerCase()
//}
//document.writeln("语言版本: "+browser.language);
//document.writeln(" 是否为移动终端: "+browser.versions.mobile);
//document.writeln(" ios终端: "+browser.versions.ios);
//document.writeln(" android终端: "+browser.versions.android);
//document.writeln(" 是否为iPhone: "+browser.versions.iPhone);
//document.writeln(" 是否iPad: "+browser.versions.iPad);
//document.writeln(navigator.userAgent);