/*
 * XenForo comments_simple.min.js
 * Copyright 2010-2017 XenForo Ltd.
 * Released under the XenForo License Agreement: http://xenforo.com/license-agreement
 */
(function(c){XenForo.CommentLoader=function(a){this.__construct(a)};XenForo.CommentLoader.prototype={__construct:function(a){this.$link=a;a.click(c.context(this,"click"))},click:function(a){var b=this.$link.data("loadparams");typeof b!="object"&&(b={});a.preventDefault();XenForo.ajax(this.$link.attr("href"),b,c.context(this,"loadSuccess"),{type:"GET"})},loadSuccess:function(a){var b,e=this.$link.data("replace"),d;if(XenForo.hasResponseError(a))return!1;b=e?c(e):this.$link.parent();a.comments&&a.comments.length?
new XenForo.ExtLoader(a,function(){for(d=0;d<a.comments.length;d++)c(a.comments[d]).xfInsert("insertBefore",b);b.xfHide()}):b.xfRemove()}};XenForo.CommentPoster=function(a){this.__construct(a)};XenForo.CommentPoster.prototype={__construct:function(a){this.$link=a;this.$commentArea=c(a.data("commentarea"));this.submitUrl=this.$commentArea.data("submiturl")?this.$commentArea.data("submiturl"):a.attr("href");a.click(c.context(this,"click"));this.$commentArea.find("input:submit, button").click(c.context(this,
"submit"))},click:function(a){a.preventDefault();this.$commentArea.xfFadeDown(XenForo.speed.fast,function(){c(this).find('textarea[name="message"]').focus()})},submit:function(a){a.preventDefault();a=this.$commentArea.closest("form");a.length&&(a.data("MultiSubmitDisable")||XenForo.MultiSubmitFix(a),a.data("MultiSubmitDisable")());XenForo.ajax(this.submitUrl,{message:this.$commentArea.find('textarea[name="message"]').val(),overlay:this.$commentArea.find('input[name="overlay"]').val()},c.context(this,
"submitSuccess"))},submitSuccess:function(a){var b=this.$commentArea.closest("form");b.data("MultiSubmitEnable")&&b.data("MultiSubmitEnable")();if(XenForo.hasResponseError(a))return!1;a.comment&&c(a.comment).xfInsert("insertBefore",this.$commentArea);this.$commentArea.find('textarea[name="message"]').val("")}};XenForo.register("a.CommentLoader","XenForo.CommentLoader");XenForo.register("a.CommentPoster","XenForo.CommentPoster")})(jQuery,this,document);
