232 lines
8.9 KiB
Plaintext
232 lines
8.9 KiB
Plaintext
<style type="text/css">
|
|
div.talk_new .ke-container{margin-left:2px;}
|
|
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
|
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
|
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
|
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
|
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
|
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
|
div.ke-toolbar .ke-outline{border:none;}*/
|
|
.break_word {width:100%;}
|
|
</style>
|
|
<script type="text/javascript">
|
|
//头部导航
|
|
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
|
|
function buildsubmenus(){
|
|
for (var i=0; i<menuids.length; i++){
|
|
var div = document.getElementById(menuids[i]);
|
|
if(div == undefined)continue;
|
|
var ultags=div.getElementsByTagName("ul")
|
|
for (var t=0; t<ultags.length; t++){
|
|
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
|
|
ultags[t].parentNode.onmouseover=function(){
|
|
this.getElementsByTagName("ul")[0].style.display="block"
|
|
}
|
|
ultags[t].parentNode.onmouseout=function(){
|
|
this.getElementsByTagName("ul")[0].style.display="none"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (window.addEventListener)
|
|
window.addEventListener("load", buildsubmenus, false)
|
|
else if (window.attachEvent)
|
|
window.attachEvent("onload", buildsubmenus)
|
|
</script>
|
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
|
<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
|
|
|
|
<% if @project %>
|
|
<%= render :partial => 'project_show', locals: {project: @project} %>
|
|
<% elsif @course %>
|
|
<%= render :partial => 'course_show', locals: {course: @course} %>
|
|
<% end %>
|
|
|
|
|
|
<script type="text/javascript">//侧导航
|
|
|
|
//window.onload = function () {
|
|
// var topic_id = getParam('topic_id');
|
|
// document.getElementById(topic_id).focus();
|
|
//}
|
|
//
|
|
//var getParam = function(name){
|
|
// var search = document.location.search;
|
|
// var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
|
|
// var matcher = pattern.exec(search);
|
|
// var items = null;
|
|
// if(null != matcher){
|
|
// try{
|
|
// items = decodeURIComponent(decodeURIComponent(matcher[1]));
|
|
// }catch(e){
|
|
// try{
|
|
// items = decodeURIComponent(matcher[1]);
|
|
// }catch(e){
|
|
// items = matcher[1];
|
|
// }
|
|
// }
|
|
// }
|
|
// return items;
|
|
//};
|
|
//
|
|
//function show_newtalk()
|
|
//{
|
|
// $("#about_newtalk").toggle();
|
|
//
|
|
//
|
|
//
|
|
//}
|
|
//
|
|
//function show_newtalk1(id)
|
|
//{
|
|
// $(id).toggle();
|
|
// $(id).focus();
|
|
//
|
|
//
|
|
//}
|
|
|
|
function nh_check_field(params){
|
|
var result=true;
|
|
if(params.subject!=undefined){
|
|
if($.trim(params.subject.val()) == ""){
|
|
params.subjectmsg.html('主题不能为空');
|
|
params.subjectmsg.css({color:'#ff0000'});
|
|
result=false;
|
|
}else{
|
|
params.subjectmsg.html('填写正确');
|
|
params.subjectmsg.css({color:'#008000'});
|
|
}
|
|
params.subjectmsg.show();
|
|
}
|
|
|
|
if(params.content!=undefined){
|
|
if(params.content.isEmpty()){
|
|
result=false;
|
|
}
|
|
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
|
params.textarea.html(params.content.html());
|
|
params.content.sync(); //用上面那句ie11提交到服务器居然木有值
|
|
if(params.content.isEmpty()){
|
|
params.contentmsg.html('内容不能为空');
|
|
params.contentmsg.css({color:'#ff0000'});
|
|
}else{
|
|
params.contentmsg.html('填写正确');
|
|
params.contentmsg.css({color:'#008000'});
|
|
}
|
|
params.contentmsg.show();
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
function nh_init_board(params){
|
|
//发帖/编辑/回复按钮的click
|
|
params.showbtn.click(function(){
|
|
params.textarea.removeAttr('placeholder');
|
|
if(params.textarea.data('init') == undefined){
|
|
//初始化编辑器
|
|
var editor = params.kindutil.create(params.textarea, {
|
|
// allowPreviewEmoticons : false,
|
|
// allowImageUpload : false,
|
|
resizeType : 1,minWidth:"1px",width:"560px",height:"150px",
|
|
allowFileManager:true,uploadJson:"/kindeditor/upload",
|
|
fileManagerJson:"/kindeditor/filemanager",
|
|
afterChange:function(){//按键事件
|
|
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
|
},
|
|
afterCreate:function(){
|
|
var userAgent = navigator.userAgent.toLowerCase();
|
|
if(/trident/.test(userAgent)){
|
|
$("div.talk_new .ke-container").css({'margin-left':'0px'});
|
|
}
|
|
// var toolbar = $("div[class='ke-toolbar']",params.about_talk);
|
|
// $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
|
// params.toolbar_container.append(toolbar);
|
|
}
|
|
}).loadPlugin('paste');
|
|
|
|
//主题输入框按键事件
|
|
params.inputsubject.keyup(function(){
|
|
nh_check_field({subject:params.inputsubject,subjectmsg:params.subjectmsg});
|
|
})
|
|
//表单提交
|
|
params.form.submit(function(){
|
|
var is_checked = nh_check_field({
|
|
issubmit:true,
|
|
subject:params.inputsubject,
|
|
subjectmsg:params.subjectmsg,
|
|
content:editor,
|
|
contentmsg:params.contentmsg,
|
|
textarea:params.textarea
|
|
});
|
|
if(is_checked){
|
|
//return true 居然不提交 fuck your sister
|
|
$(this)[0].submit();
|
|
// return true;
|
|
}
|
|
return false;
|
|
});
|
|
//提交按钮click
|
|
params.submitbtn.click(function(){
|
|
params.form.submit();
|
|
});
|
|
//取消按钮click
|
|
params.cancelbtn.click(function(){
|
|
params.about_talk.toggle();//显示/隐藏编辑区
|
|
if(params.about_talk.is(':hidden')){//隐藏时reset表单数据
|
|
params.form[0].reset();
|
|
if(params.type=='reply'){
|
|
params.textarea.empty();
|
|
}else{
|
|
params.textarea.html(params.init_content_val.val());
|
|
}
|
|
var str = params.textarea.html();
|
|
str=str.replace(new RegExp(/</g),'<');
|
|
str=str.replace(new RegExp(/>/g),'>');
|
|
editor.html(str);
|
|
params.subjectmsg.hide();
|
|
params.contentmsg.hide();
|
|
if(params.quote_show!=undefined)params.quote_show.empty();
|
|
if(params.quote_input!=undefined)params.quote_input.empty();
|
|
}else{
|
|
if(params.type=='reply'){
|
|
params.textarea.show();
|
|
params.textarea.focus();
|
|
params.textarea.hide();
|
|
//params.jumphref.attr('href','#'+params.form.attr('id'));
|
|
//params.jumphref[0].click();
|
|
}else{
|
|
params.textarea.show();
|
|
params.textarea.focus();
|
|
params.textarea.hide();
|
|
// params.inputsubject.focus();
|
|
}
|
|
}
|
|
});
|
|
params.textarea.data('init','1');//标记为已经初始化
|
|
}
|
|
params.cancelbtn.click();//显示/隐藏编辑区
|
|
});
|
|
if(params.type == 'reply'){
|
|
params.showbtn_child.click(function(){
|
|
if(params.textarea.data('init') == undefined){
|
|
params.showbtn.click();
|
|
}else{
|
|
params.cancelbtn.click();
|
|
if(params.about_talk.is(':hidden')){
|
|
params.cancelbtn.click();
|
|
}
|
|
}
|
|
var parent_topic_id = $(this).data('topic-id');
|
|
if(parent_topic_id!=undefined)$("input[name='parent_topic']",params.form).val(parent_topic_id);
|
|
var ref_str = params.get_ref_str_call($(this));
|
|
params.quote_show.html(ref_str);
|
|
params.quote_input.html(ref_str);
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
</script>
|