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=$("

<\/div>").appendTo($("body"));n.load(this.modalEndpoint,function(){VM.Comments.$alert&&VM.Comments.$alert.remove();VM.Comments.$form&&VM.Comments.$form.removeClass("hidden");VM.Comments.modalLoaded=!0;VM.Ajax.resetValidation(VM.Login.$form);VM.Ajax.resetValidation(VM.Register.$form);VM.Ajax.resetValidation(VM.Register.$confirmForm)})}},checkForUrlParam:function(){if(window.location.search){var n=window.location.search.substring(1).split("=");n.length===2&&(n[0]==="target"?VM.scrollTo($("#"+n[1])):n[0]==="message"&&n[1].toLowerCase()==="registered"&&(this.$description.val()?(VM.scrollTo(this.$form),VM.Ajax.toast("Your registration is complete. You may now leave a comment.","success",!0)):(VM.scrollTo(this.$comments),VM.Ajax.toast("Your registration is complete. You may now leave a comment or vote.","success",!0))))}},onAccountModalOpened:function(n){n.hasClass("comment-submit")&&VM.Storage.setObj(VM.Comments.storageKey,VM.Comments.$description.val())},onLoginSuccess:function(n,t){VM.Comments.authenticated(n,t)},onRegisteredSuccess:function(n,t){VM.Comments.authenticated(n,t)},onRegisteredPartialSuccess:function(n,t){t.hasClass("comment-submit")?VM.Ajax.toast("Your account requires review before you can comment. Don't worry, we've saved your comment for later submission.","warning"):VM.Ajax.toast("Your account requires review before you can reply or vote.","warning")},authenticated:function(n,t){var r,i;this.setUser(n);this.showForm();VM.$body.find(".account-modal-trigger").removeClass("account-modal-trigger");r=this.$comments.find(".comment[data-uid='"+n.id+"']");r.length&&(r.find(".comment-vote").prop("disabled",!0),r.find(".comment-report").remove());i="You are now signed in.";t.hasClass("comment-submit")?this.$form.valid()&&(this.$form.data("success-toast","Your comment has been added."),t.click()):t.hasClass("comment-reply")?(i="You are now signed in, and may now reply.",t.click()):t.hasClass("comment-report")?(i="You may now report that comment.",t.click()):t.hasClass("comment-vote")&&!t.prop("disabled")?(i=" Your vote has been added.",t.click()):t.hasClass("membership-signin-link")&&($(".membership-required-container").addClass("hidden"),$("#feedback-form-container").removeClass("hidden"));VM.Ajax.toast(i,"success")},afterCompleteLoad:function(){this.isAuthenticated=this.$comments.data("auth");this.showForm();this.count=parseInt(this.$comments.data("count"),10);this.$count.text(this.count).removeClass("hidden").parent().addClass("rendered");this.count>3&&this.$sort.removeClass("hidden");this.checkAuthenticated(this.$form,"comment","comment-form");VM.Ajax.resetValidation(this.$form)},afterLoad:function(n){if(n&&n.length>0){var t=VM.Comments;n.find(".timeago").timeago();existingCount=0;count=0;n.hasClass("comment")?(existingCount=n.find(".comment").length,count=parseInt(n.data("replies"),10)):(existingCount=n.find(">.comment").length,count=t.count,t.loadAds());existingCountYou must be signed in to '+t+'. Please sign in<\/a> or register<\/a>.<\/p>'),r?(this.$alert.insertAfter(this.$form),this.$form.addClass("hidden")):this.$alert.appendTo(f),!1)},onGetReplies:function(){var n=$(this).closest(".comment"),t=n.find(".comment-child"),i,r;if(t.length){t.remove();return}i=$(this);r=VM.Comments.$comments.data("endpoint").replace("Sort="+VM.Comments.startingSort,"Sort="+VM.Comments.sort)+"&ParentId="+n.data("id")+"&Count="+n.data("replies");VM.Comments.load(i,r,null,function(t){t='

'+u.username+'<\/a>':''+u.initials+"<\/a>";e='

'+a+'
'+u.username+'<\/b> Just now<\/div>
'+v+o+'<\/div>
'+u.af+'