var VM=VM||{};VM.Perspective={$perspectiveResultArea:null,$descriptionSubmitArea:null,$form:null,formSubmit:null,init:function(n,t,i,r){this.$perspectiveResultArea=n;this.$descriptionSubmitArea=t;this.$form=i;this.formSubmit=r},check:function(n,t){var i={comment:{text:n},languages:["en"],requestedAttributes:{TOXICITY:{},OBSCENE:{}}};$.ajax("https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key=AIzaSyByrN2npmkT86GzSFVyv-gsB11JqE8vKak",{method:"POST",dataType:"json",contentType:!1,data:JSON.stringify(i)}).done(function(n){var i={toxicity:n.attributeScores.TOXICITY.summaryScore.value,obscenity:n.attributeScores.OBSCENE.summaryScore.value};t(i)}).fail(function(n,i,r){t({error:r})})},showMessage:function(n,t){var r=this.$perspectiveResultArea.find(".message").empty(),i=!1;return this.$form.find(".comment-form-score").val(n.toxicity),n.toxicity>=.75&&(i=!0,r.append("
Our filter has rejected your "+t+'. We aim to provide a space for thoughtful discussion. Perhaps consider rewording and submitting again. Please review our Community Guidelines<\/a>.<\/p>')),n.obscenity>=.75&&(i=!0,r.append(" It appears that your "+t+' contains one or more obscene words or phrases, which goes against our Community Guidelines<\/a>. You can modify your '+t+" and resubmit it, or you can submit it for manual review by our news desk.<\/p>")),i&&(this.$perspectiveResultArea.removeClass("hidden"),this.$descriptionSubmitArea.addClass("hidden"),this.$form.find("input").prop("disabled",!0)),i},onEdit:function(){var n=VM.Perspective;n.$perspectiveResultArea.addClass("hidden");n.$descriptionSubmitArea.removeClass("hidden");n.$form.find("input").prop("disabled",!1);VM.scrollTo(n.$form)},onPost:function(){var n=VM.Perspective;n.onEdit();n.formSubmit.call(null,n.$form)}};VM=VM||{};VM.Comments={isAuthenticated:!1,isMember:!1,membershipCommenting:!1,loginUrl:"/account/login?ReturnUrl=",registerUrl:"/account/register?ReturnUrl=",storageKey:"",$loader:null,modalEndpoint:null,modalLoaded:!1,$comments:null,$comment:null,maxCommentChars:0,charsLeftKey:"chars-left",$form:null,$description:null,$sort:null,$sorts:null,sort:null,startingSort:null,count:0,$count:null,$parentId:null,$alert:null,$popup:null,$commentsShow:null,threaded:!1,hasFreeMembership:!1,$feedbackContainer:null,setUser:function(n){this.isMember=n.member||n.cms;this.isAuthenticated=n.id!==0},onFormLoaded:function(){if(VM.Comments.init(),VM.Comments.checkForUrlParam(),typeof VM.Comments.onCommentsLoadedCallback=="function")VM.Comments.onCommentsLoadedCallback(VM.Comments.count)},onCountLoadedCallback:null,onCommentsLoadedCallback:null,preinit:function(){var n=this,t=encodeURIComponent(window.location.pathname);this.loginUrl+=t;this.registerUrl+=t;this.$loader=$("#comments-loader");this.threaded=this.$loader.hasClass("comments-threaded");this.storageKey="VM-comment_"+this.$loader.data("storagesuffix");this.modalEndpoint=this.$loader.data("modal-endpoint");this.membershipCommenting=this.$loader.data("membership-commenting");this.hasFreeMembership=this.$loader.data("free-membership");this.$sorts=$("#comments-sorts").on("click","a",this.onSort);this.$count=$("#comments-count");this.$commentsShow=$("#comments-show").click(function(){n.showComments()});this.$commentsShow.length&&$.getJSON(this.$commentsShow.data("count-endpoint"),function(t){if(t&&(n.count=t.count,n.$count.text(n.count).removeClass("hidden").parent().addClass("rendered"),typeof n.onCountLoadedCallback=="function"))n.onCountLoadedCallback(t.count)});VM.Me.getUser(function(n){VM.Comments.setUser(n)});VM.Feedback&&VM.Feedback.commentingLoaded(this.$commentsShow.length===0)},init:function(){this.$sort=$("#comments-sort").click(this.onSortToggle);this.sort=this.$sort.data("sort");this.startingSort=this.sort;this.$comments=$("#comments").on("click",".avatar-view",this.onProfileSummary).on("click",".comment-un",this.onProfileLinkClick).on("click",".comment-vote",this.onVote).on("click",".comment-replies",this.onGetReplies).on("click",".comments-more",this.onLoadComments).on("click",".comment-reply",this.onReply).on("click",".comment-report",this.onReport).on("click",".comment-edit",this.onEdit).on("click",".comment-pin",this.onPin).on("click",".comment-unpin",this.onUnpin).on("click",".comment-delete",this.onDelete);this.$form=$("#comment-form").on("click",".comment-cancel",this.onReplyCancel).submit(this.onSubmit).on("click",".comment-perspective-edit",VM.Perspective.onEdit).on("click",".comment-perspective-post",VM.Perspective.onPost);$("#comments-post").removeClass("hidden").click(this.onComment);this.$description=this.$form.find(".comment-form-desc").val(VM.Storage.getObj(this.storageKey)).on("keyup paste",this.onDescriptionChange);this.maxCommentChars=parseInt(this.$description.data("val-length-max"),10);this.$description.data(this.charsLeftKey,this.$form.find(".comment-desc-left").removeClass("hidden").find("span").text(this.maxCommentChars));$(document).click(VM.Comments.onDocClick);this.afterCompleteLoad();this.afterLoad(this.$comments);this.accountModalInit();$(window).click(this.closeAvatarSummary)},showForm:function(){this.membershipCommenting&&!this.isMember?($(".membership-required-container").removeClass("hidden"),$("#comments-disclaimer").addClass("hidden"),this.$form.addClass("hidden"),this.isAuthenticated&&($(".membership-required-warning").removeClass("hidden"),$(".membership-required-container .account-modal-trigger").text("Sign in with a different account"))):($(".membership-required-container").addClass("hidden"),$("#comment-form-container").removeClass("hidden"),this.$form.removeClass("hidden"),$("#comments-disclaimer").removeClass("hidden"))},accountModalInit:function(){if((!this.isAuthenticated||this.membershipCommenting)&&this.modalEndpoint&&!$("#account-modal").length){var n=$("
"+t.$description.val().replace(/(?:\r\n|\r|\n)/g,"'+a+''+u.username+'<\/b> Just now<\/div>'+v+o+'<\/div>
")+"<\/p>";a=u.avatar?'<\/a>':''+u.initials+"<\/a>";e='