/*
 * XenForo comments_simple.min.js
 * Copyright 2010-2015 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;b=this.$link.data("replace");var d;if(XenForo.hasResponseError(a))return!1;b=b?c(b):this.$link.parent();if(a.comments&&
a.comments.length){for(d=0;d<a.comments.length;d++)c(a.comments[d]).xfInsert("insertBefore",b);b.xfHide()}else 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()},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);
