var editor=new wangEditor("editor");editor.config.menus=["bold","underline","italic","fontsize","strikethrough","unorderlist","orderlist","img","link","forecolor","bgcolor","location","table","emotion","insertcode","eraser","fullscreen"],editor.config.uploadParams={__CSRF__:G_csrf},editor.config.emotions={default:{title:"默认",data:"/static/theme/liblog/res/emotions.data"}},editor.config.uploadImgFileName="img",editor.config.uploadImgUrl="/topic/create/uploadeditor",editor.create(),$("#savetopic").click(function(){var e=editor.$txt.html(),t=$.trim(e),r=editor.$txt.text(),a={title:$("#topicTitle").val(),text:r,content:t,item:$("#tab-value").val(),author:$("#uname").val(),createtime:new Date,updateauthor:$("#uname").val(),updatetime:new Date,updatepic:$("#upic").val(),__CSRF__:G_csrf};return"请选择"===$.trim($("#tab-value").val())||""===$.trim($("#tab-value").val())?($(".reply-error").remove(),$("#savetopic").after('<span class="reply-error">请选择版块</span>'),!1):""===$.trim($("#topicTitle").val())?($(".reply-error").remove(),$("#savetopic").after('<span class="reply-error">标题不能为空！</span>'),!1):""===$.trim(r)?($(".reply-error").remove(),$("#savetopic").after('<span class="reply-error">内容不能为空！</span>'),!1):void $.ajax({url:"/topic/create/doadd",data:a,type:"POST",success:function(e){0===e.errno?window.location.href="/topic.html":alert(e.errmsg)}})}),$("#updatetopic").click(function(){var e=editor.$txt.html(),t=$.trim(e),r=editor.$txt.text(),a={id:$("#tid").val(),title:$("#topicTitle").val(),content:t,item:$("#tab-value").val(),author:$("#uname").val(),createtime:new Date,updateauthor:$("#uname").val(),updatetime:new Date,updatepic:$("#upic").val(),__CSRF__:G_csrf};return"请选择"===$.trim($("#tab-value").val())||""===$.trim($("#tab-value").val())?($(".reply-error").remove(),$("#updatetopic").after('<span class="reply-error">请选择版块</span>'),!1):""===$.trim($("#topicTitle").val())?($(".reply-error").remove(),$("#updatetopic").after('<span class="reply-error">标题不能为空！</span>'),!1):""===$.trim(r)?($(".reply-error").remove(),$("#updatetopic").after('<span class="reply-error">内容不能为空！</span>'),!1):void $.ajax({url:"/topic/create/doadd",data:a,type:"POST",success:function(e){0===e.errno?window.location.href="/topic.html":alert(e.errmsg)}})});