This commit is contained in:
ouyangxuhua 2015-09-25 16:05:36 +08:00
commit c906c7ee1d
5 changed files with 50 additions and 27 deletions

View File

@ -1,23 +1,7 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'new_user' %>
<script>
$(function(){
document.getElementById('forum_name').onkeydown = function()
{
var n = 0;
var str = this.value;
for (i = 0; i < str.length; i++) {
var leg = str.charCodeAt(i);//ASCII码
if (leg > 255) {
n += 2;
} else {
n += 1;
}
}
if(n >= 160 && event.keyCode != 8)
event.returnValue = false;
}
})
function check_and_submit(doc){
$("#error").html('').hide();
@ -66,4 +50,29 @@
autoTextarea(textarea);
var textarea1 = document.getElementById('forum_desc');
autoTextarea(textarea1);
$(function(){
$('#forum_name').keypress(function(e)
{
var n = 0;
var str = this.value;
for (i = 0; i < str.length; i++) {
var leg = str.charCodeAt(i);//ASCII码
if (leg > 255) {
n += 2;
} else {
n += 1;
}
}
if(n >= 160 && e.keyCode != 8)
if(document.all)
{
e.returnValue = false;
}
else
{
e.preventDefault();
}
})
})
</script>

View File

@ -49,7 +49,7 @@
$("#reorder_popu").removeClass("sortArrowActiveD");
add_class("reorder_time");
});
document.getElementById('forum_name').onkeydown = function()
$('#forum_name').keypress( function(e)
{
var n = 0;
var str = this.value;
@ -61,9 +61,16 @@
n += 1;//英文,不多说了
}
}
if(n >= 160 && event.keyCode != 8)
event.returnValue = false;
}
if(n >= 160 && e.keyCode != 8)
if(document.all)
{
e.returnValue = false;
}
else
{
e.preventDefault();
}
})
});
function check_and_submit(doc){
$("#error").html('').hide();

View File

@ -149,7 +149,7 @@
<!--<div class="homepageEditProfile"><a href="javascript:void(0);" class="homepageEditProfileIcon"></a></div>-->
</div>
<div class="fl">
<div class="f16 fontBlue mb10"><a href="<%= forums_path+"/"+@forum.id.to_s%>" style="word-break: break-all; word-wrap:break-word;"><%= @forum.name%></a></div>
<div class="f16 fontBlue mb10" style="word-break: break-all; word-wrap:break-word;"><%= @forum.name%></div>
<div class="fontGrey2 mb8">吧主:<a href="<%= user_path(@forum.creator)%>" class="linkBlue"><%= @forum.creator.name%></a></div>
<div class="fontGrey3">回答:<a href="javascript:void(0);" class="linkOrange mr5" style="cursor: default"><%= @forum.memo_count %></a> 帖子:<a href="javascript:void(0);" class="linkOrange" style="cursor: default"><%=@forum.topic_count%></a></div>
</div>

View File

@ -56,7 +56,7 @@
<%= render :partial => "memos/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
</span>
<div class="cl"></div>
<div class="fl fontGrey3" class="memo-content">
<div class="memo-content" >
<%= @memo.content.html_safe%>
</div>
<div class="cl"></div>

View File

@ -337,7 +337,7 @@ var autoTextarea = function (elem, extra, maxHeight) {
};
function limitStrsize(id,length){
document.getElementById(id).onkeydown = function()
$('#'+id).keypress(function(e)
{
var n = 0;
var str = this.value;
@ -350,9 +350,16 @@ function limitStrsize(id,length){
}
}
if(n >= length && event.keyCode !== 8)
event.returnValue = false;
}
if(n >= length && e.keyCode !== 8)
if(document.all)
{
e.returnValue = false;
}
else
{
e.preventDefault();
}
})
}
/////////////////////////////////////////////////////////////////////////////////////创建项目