芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/mod/forum/amd/build/inpage_reply.min.js
define(["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors"],function(a,b,c,d,e){var f={THREADED:2,NESTED:3,FLAT_OLDEST_FIRST:1,FLAT_NEWEST_FIRST:-1},g={MOODLE:0},h=function(a){var b=a.find(e.post.inpageSubmitBtnText),c=a.find(e.post.loadingIconContainer),d=a.outerWidth();a.css("width",d),b.addClass("hidden"),c.removeClass("hidden")},i=function(a){var b=a.find(e.post.inpageSubmitBtnText),c=a.find(e.post.loadingIconContainer);a.css("width",""),b.removeClass("hidden"),c.addClass("hidden")},j=function(j){j.on("click",e.post.inpageSubmitBtn,function(k){k.preventDefault();var l,m=a(k.currentTarget),n=m.parent().find(e.post.inpageReplyButton),o=m.parents(e.post.inpageReplyForm).get(0),p=o.elements.post.value.trim(),q=g.MOODLE,r=!0,s=o.elements.reply.value,t=o.elements.subject.value,u=m.parents(e.post.forumContent),v=void 0!=o.elements.privatereply&&o.elements.privatereply.checked,w=parseInt(j.find(e.post.modeSelect).get(0).value);p.length&&(h(m),n.prop("disabled",!0),d.addDiscussionPost(s,t,p,q,v,r).then(function(a){var b=a.messages.reduce(function(a,b){return"success"==b.type&&(a+="
"+b.message+"
"),a},"");return c.addNotification({message:b,type:"success"}),a}).then(function(a){o.reset();var c=a.post;switch(l=c.id,w){case f.THREADED:return b.render("mod_forum/forum_discussion_threaded_post",c);case f.NESTED:return b.render("mod_forum/forum_discussion_nested_post",c);default:return b.render("mod_forum/forum_discussion_post",c)}}).then(function(a,c){var d;return w!=f.FLAT_OLDEST_FIRST&&w!=f.FLAT_NEWEST_FIRST||(d=u.parents(e.post.repliesContainer).children().get(0)),void 0==d&&(d=u.siblings(e.post.repliesContainer).children().get(0)),w==f.FLAT_NEWEST_FIRST?b.prependNodeContents(d,a,c):b.appendNodeContents(d,a,c)}).then(function(){return i(m),n.prop("disabled",!1),u.find(e.post.inpageReplyContent).hide()}).then(function(){location.href="#p"+l})["catch"](function(a){return i(m),n.prop("disabled",!1),c.exception(a)}))})};return{init:function(a){j(a)},CONTENT_FORMATS:g}});