var DarkThemePage=function(n){$(".containerSideNav").length&&(this.positionOfSideNav=$(".containerSideNav").offset().top);this.currentScrollTop=0;this.addListeners();this.fixTheNav=!1;typeof n!="undefined"&&(this.fixTheNav=n)},destinyErrorCodeArrayList,Posts,Forums,Topics;DarkThemePage.prototype.openCloseContainer=function(n){n.hasClass("open")?n.removeClass("open"):n.addClass("open")};DarkThemePage.prototype.fixSideNav=function(){if(this.fixTheNav){var n=$(window).scrollTop();this.currentScrollTop=n;n>this.positionOfSideNav-60&&!$("html").hasClass("react-medium")?($("#mainContent").addClass("fixedSidebar"),$(".containerSideNav .sideNav").width($(".containerSideNav").width())):$("#mainContent").removeClass("fixedSidebar")}};DarkThemePage.prototype.resizeSideNav=function(){$("#mainContent").hasClass("fixedSidebar")?$(".containerSideNav .sideNav").width($(".containerSideNav").width()):$(".containerSideNav .sideNav").css("width","")};DarkThemePage.prototype.addListeners=function(){var n=this;$(window).off(".darktheme");$(document).off(".darktheme");$(window).on("scroll.darktheme",function(){n.fixSideNav()});$(window).on("resize.darktheme",function(){n.fixSideNav();n.resizeSideNav()});$(document).on("click.darktheme",".trigger_containerSideNav",function(t){t.preventDefault();var i=$(".sideNav");n.openCloseContainer(i)});$(document).on("click.darktheme",".trigger_controlBarSortBox",function(t){t.preventDefault();var i=$(".controlBar .sortBox");n.openCloseContainer(i)});$(document).on("click.darktheme",".trigger_advancedSearch",function(t){t.preventDefault();var i=$(this).next(".advancedSearchOptions");n.openCloseContainer(i)})};destinyErrorCodeArrayList=["apple","aardvark","accordion","albatross","alligator","alpaca","anaconda","ant","anteater","antelope","apricot","armadillo","artichoke","avocado","baboon","badger","banana","banjo","barracuda","basilisk","bass","bassoon","bat","beaver","bee","beetle","bird","bison","blackberry","blackbird","blackcurrant","blueberry","boar","bonobo","bramble","breadfruit","buffalo","bull","buzzard","cacao","camel","canary","cashew","cat","caterpillar","cattle","centipede","chicken","chimpanzee","chinchilla","chipmunk","chokeberry","chupacabra","clam","clarinet","clementine","cloudberry","cobbler","cobbler","cobra","cockatiel","cockatoo","cockroach","coconut","coffee","cougar","cow","cowbell","coyote","crab","cranberry","crane","crawfish","cricket","crocodile","crow","crowberry","currant","dalmation","deer","dingo","dinosaur","dog","dolphin","donkey","dove","dragonfly","dragonfruit","drum","duck","eagle","earthworm","earwig","eel","egret","elderberry","elephant","elk","emu","falcon","ferret","fig","finch","firefly","fish","flamingo","flatworm","fly","fox","frog","gazelle","giraffe","gnat","goat","goose","gooseberry","gopher","gorilla","grape","grapefruit","grasshopper","groundhog","hare","hawk","hedgehog","heron","herring","hippo","honeydew","horse","hyena","iguana","impala","inchworm","insect","jackal","jackfruit","jackrabbit","jaguar","jasmine","jellyfish","kangaroo","kingfisher","kiwi","koala","krill","lamb","leech","lemming","lemon","lemur","leopard","lime","lion","lionfish","llama","lobster","loganberry","lychee","lynx","magpie","mallard","manatee","mandrill","mantis","marionberry","mink","mole","mongoose","monkey","mosquito","mulberry","newt","nightingale","octopus","olive","opossum","orange","ostrich","otter","oxen","oyster","panther","papaya","peach","peanut","persimmon","pig","pigeon","pineapple","plantain","pomegranate","pony","porcupine","porpoise","prune","pumpkin","quail","rabbit","raccoon","raspberry","rat","raven","rhinoceros","rhubarb","salamander","salmon","sardine","satsuma","scorpion","seal","shark","sheep","skunk","snail","squid","squirrel","stingray","stinkbug","stork","strawberry","swan","tamarind","tangelo","tangerine","tapir","termite","toad","turkey","turtle","urchin","vanilla","viper","vulture","walrus","wasp","watermelon","weasel","whale","wolf","wolfberry","wombat","woodpecker","worm","yak","zucchini",];Posts=function(n,t){if(typeof n=="undefined"||n==0){Bnet.log("there is no postId!");return}this.postId=n;this.defaultSettings={forumType:Globals.ForumTypeEnum.Public,sort:Globals.ForumPostSortEnum.Default,page:0,hasMore:!1,path:0,showBanned:!1,groupId:0,newsId:0,isEdit:!1};t&&$.extend(this.defaultSettings,t);this.settings=this.defaultSettings;this.counters=[];this.countersStatus=[];this.taggles={};this.forumsjs;this.Initialize()};Posts.prototype.Initialize=function(){this.forumsjs=new Forums;this.MakeJSDomChanges();this.AddEventListeners();$("[data-postid='"+this.postId+"']").length===0&&$(".btn_more.trigger_showReplies").length===1&&$(".btn_more.trigger_showReplies").click()};Posts.prototype.MakeJSDomChanges=function(){var n=this,i,u,r,f,t,e;for(n.settings.forumType!==Globals.ForumTypeEnum.News&&window.scrollTo(0,0),$(".containerMain.transparent").removeClass("transparent"),n.MakeLinkChanges(),i=$("#forumPost .post"),u=i.length,t=0;t<u;t++)n.MakeDOMChangesToEachPost(i.eq(t));for(r=$("#relatedPosts .topics > li"),f=r.length,t=0;t<f;t++)n.MakeDOMChangesToEachRelatedPost(r.eq(t));$(document).on("click",".helpautolink",function(n){n.preventDefault();window.location.href="/"+Localizer.CurrentCultureName+"/errorcode/"+$(this).text()});e=$("#forumPost .replies.first");Modernizr.mobile||n.settings.sort===Globals.ForumPostSortEnum.OldestFirst||n.settings.isLargeThread||(n.scrollPaging=new ScrollPaging($("#forumPost")),n.settings.hasMore?n.scrollPaging.loadingFunction=function(){n.settings.page=n.settings.page+1;$.get(n.GetPostContainerUrl(e.attr("data-postId"),{page:n.settings.page,forumType:n.settings.forumType}),function(t){n.AddFirstLevelReplies(t,!1)})}:typeof n.scrollPaging!="undefined"&&n.scrollPaging.stopListening());n.TestDeferred();Modernizr.mobile};Posts.prototype.MakeDOMChangesToEachPost=function(n){this.RemoveDuplicatePosts(n);this.SetDatesAndTimes(n);this.PopulateLink(n,this.AuthorIsFollowed(n));this.ParseBBCode(n);this.TestDeferred(n);this.AddReplyToolTip(n);this.AutoHighlightHelpTerms(n);this.RemoveEmptyManageSection(n);this.AddTagSuggestions(n)};Posts.prototype.MakeDOMChangesToEachRelatedPost=function(n){var t=this,i=new CountUp(n.find(".authorInfo").eq(0),".time",{timeSelector:".time",timeUnits:{second:Localizer.Time.secondsletter,minute:Localizer.Time.minutesletter,hour:Localizer.Time.hoursletter,day:Localizer.Time.daysletter},pluralUnits:!1,isShortened:!0})};Posts.prototype.AddFirstLevelReplies=function(n,t){var u=this,i=$("#forumPost .replies.first"),r;i.length===0&&(r=$('<div class="containerPostReplies"><\/div>'),i=$('<ul class="postReplies  replies first block" data-postId="'+this.postId+'"><\/ul>'),r.append(i),$("#topicThread").append(r));typeof t!="undefined"&&t?i.prepend(n):i.append(n);i.find(".post").each(function(){u.MakeDOMChangesToEachPost($(this))});typeof this.scrollPaging!="undefined"&&this.scrollPaging.setDimensions();this.TestDeferred()};Posts.prototype.AddInnerLevelReply=function(n,t,i){var f=this,r=$(".replies[data-postId='"+n+"']"),u;r.length===0&&(r=$('<ul class="replies postReplies" data-postId="'+n+'"><\/ul>'),u=$("li[data-postId='"+n+"']"),u.addClass("container_replies"),u.eq(0).append(r));typeof i!="undefined"&&i?r.prepend(t):r.append(t);r.find(".post").each(function(){f.MakeDOMChangesToEachPost($(this))});typeof this.scrollPaging!="undefined"&&this.scrollPaging.setDimensions();this.TestDeferred()};Posts.prototype.AddInnerLevelReplies=function(n,t){var r=this,i=$(".replies[data-postId='"+n+"']");i.find("li").length==0?i.html(t):i.append(t);i.find(".pager_prevnext").length&&i.after(i.find(".pager_prevnext").detach().clone());i.find(".post").each(function(){r.MakeDOMChangesToEachPost($(this))});typeof this.scrollPaging!="undefined"&&this.scrollPaging.setDimensions();this.TestDeferred()};Posts.prototype.InsertInnerLevelAfterParent=function(n,t){var r=$("#"+n+"[data-postId='"+n+"']"),i;r.after(t);i=r.next("li");i.addClass("isChild");this.MakeDOMChangesToEachPost(i);typeof this.scrollPaging!="undefined"&&this.scrollPaging.setDimensions();this.TestDeferred(i)};Posts.prototype.AddTagSuggestions=function(n){var t=n.closest("[data-postId]").attr("data-postId"),i=new TagSuggestions(n.find("#textbox_addTagCreatePost_"+t),n.find("#searchTagsPreview_addTagCreatePost_"+t))};Posts.prototype.RemoveDuplicatePosts=function(n){var t=$("#forumPost li[data-postId="+n.closest("li").attr("id")+"]").not("#relatedPosts li");t.length>1&&n.closest("li").remove()};Posts.prototype.MakeLinkChanges=function(){};Posts.prototype.AuthorIsFollowed=function(n){return n.hasClass("followedAuthor")?!0:!1};Posts.prototype.SetDatesAndTimes=function(n){var i=new CountUp(n.find(".threadTime").eq(0),".time",{timeSelector:".time",timeUnits:{second:Localizer.Time.secondsletter,minute:Localizer.Time.minutesletter,hour:Localizer.Time.hoursletter,day:Localizer.Time.daysletter},pluralUnits:!1,isShortened:!0}),t;n.find(".container_userStatus").length&&(t=new CountUp(n.find(".container_userStatus").eq(0),"[data-datetime]",{timeSelector:"[data-datetime]",timeUnits:{second:Localizer.Time.secondsletter,minute:Localizer.Time.minutesletter,hour:Localizer.Time.hoursletter,day:Localizer.Time.daysletter},pluralUnits:!1,isShortened:!0}),this.countersStatus.push(t));this.counters.push(i)};Posts.prototype.PopulateLink=function(n,t){var e=n.attr("data-urlLinkOrImage"),i,c,r,f;if(e!==""&&(i=bungieNetPlatform.assetRenderer.renderAsset({path:e,width:"100%",fixedRatioHeight:Modernizr.mobile&&!Modernizr.ipad?6750/16+"px":4500/16+"px"}),i)){var h=!1,o=!1,s=!1,u="";i.indexOf("<iframe")>=0||i.indexOf("TwitchPlayer.swf")>=0?(s=!0,u="video"):i.indexOf("<a")>=0?(h=!0,u="link"):i.indexOf("<img")>=0&&(o=!0,u="image");o||s?(r=n.find(".post_urlLinkOrImage"),r.length>0?(r.html(i),r.data("urlLinkOrImage",i)):(f=!0,viewModels.loggedInUserModelIsLoaded()&&viewModels.loggedInUserModel().adultMode()&&(f=!1),(t||n.hasClass("isAuthor"))&&(f=!1),f?u=="image"?n.find(".post_body").before(Localizer.Format(Localizer.Forums.viewatownriskimage,{0:u,1:PageUrls.termsOfUse})):u=="video"&&n.find(".post_body").before(Localizer.Format(Localizer.Forums.viewatownriskvideo,{0:u,1:PageUrls.termsOfUse})):n.find(".post_body").before("<div class='post_urlLinkOrImage deferred'><\/div>"),n.find(".post_urlLinkOrImage").data("urlLinkOrImage",i))):(c=$(i),r=n.find(".post_urlLinkOrImage"),r.length>0?(r.html(i),r.data("urlLinkOrImage",i)):(n.find(".post_body").before("<div class='post_urlLinkOrImage'>"+i+"<\/div>"),n.find(".post_urlLinkOrImage").data("urlLinkOrImage",i)))}};Posts.prototype.ParseBBCode=function(n){typeof n.find(".post_body").html()!="undefined"&&n.find(".post_body").children().length===0&&n.find(".post_body").html(Bnet.Utilities.Url.correctExternalLinks(Bnet.Utilities.Parse.parseBBCode(n.find(".post_body").html(),!0,!0)))};Posts.prototype.AutoHighlightHelpTerms=function(n){if(typeof n.find(".post_body").html()!="undefined"&&$(".firstPostTags a").text().indexOf("#Help")>-1){var t=n.find(".post_body");typeof destinyErrorCodeArrayList!="undefined"&&(t.highlight(destinyErrorCodeArrayList,{element:"a",className:"helpautolink",wordsOnly:!0,caseSensitive:!1}),t.find(".helpautolink").each(function(){this.href="/"+Localizer.CurrentCultureName+"/errorcode/"+$(this).text()}))}};Posts.prototype.AddReplyToolTip=function(n){var f,e,t,o;if(n.hasClass("post")||(n=n.find(".post").first()),n.attr("data-actualParentPostId")!==n.closest(".first.replies").attr("data-postId")){var i=$("#"+n.attr("data-actualParentPostId")),r=i.find(".authorDisplayName").first().text(),u=i.find(".post_body").first().clone();if(u.find(".parentAuthor").remove(),f=u.html(),e='<div class="parentAuthor">@'+r+'<span class="tooltip_parentAuthor"><span>'+r+"<\/span><br>"+Bnet.Utilities.Url.correctExternalLinks(Bnet.Utilities.Parse.parseBBCode(f,!0,!1))+"<\/span><\/div> ",n.find(".parentAuthor").length===0){n.find(".postBody").prepend(e);t=n.find(".parentAuthor");o=new ExtraInfoTip(t,t.find(".tooltip_parentAuthor"),".popoutElement",{onScreen:!0});t.off("parentAuthor");t.on("click.parentAuthor",function(){$arrow.find("a").click()})}}};Posts.prototype.TestDeferred=function(n){var t=$();t=typeof n!="undefined"?n.find(".deferred"):$("#post .deferred");t.each(function(){var n=$(this),t;$(this).offset().top<$(window).scrollTop()+$(window).height()&&(t=typeof n.data("urlLinkOrImage")!="undefined"?n.data("urlLinkOrImage").toString():"",t.indexOf("iframe")===-1?n.html('<a  title="'+Localizer.Actions.clicktoenlarge+'">'+t+"<\/a>"):(n.addClass("video"),n.html(t)),n.removeClass("deferred gated"),Modernizr.mobile||typeof self.scrollPaging=="undefined"||self.scrollPaging.setDimensions())})};Posts.prototype.RemoveEmptyManageSection=function(n){var t=n.find(".manageActions");t.find("a:visible").length===0&&t.hide()};Posts.prototype.PopulatePreviewLink=function(n){var r=$(".alert.previewPost .post_urlLinkOrImage"),t;if(n.urlLinkOrImage&&n.urlLinkOrImage!==""){if(t=bungieNetPlatform.assetRenderer.renderAsset({path:n.urlLinkOrImage,width:"100%",fixedRatioHeight:Modernizr.mobile&&!Modernizr.ipad?6750/16+"px":4500/16+"px"}),t){var u=!1,f=!1,e=!1,i="";t.indexOf("<iframe")>=0||t.indexOf("TwitchPlayer.swf")>=0?(e=!0,i="video"):t.indexOf("<a")>=0?(u=!0,i="link"):t.indexOf("<img")>=0&&(f=!0,i="image");t=t.replace("class='externalLink'","target='_blank'");$(t).find("script").length&&(t="");r.append(t)}}else r.remove()};Posts.prototype.ResetEditArea=function(n){var t;n.removeClass("open");n.find(".error").remove();var u=n.find(".textarea_body").attr("data-originalvalue"),e=n.find(".text_subject").find("input").attr("data-originalvalue"),o=n.find(".text_linkOrImage").find("input").attr("data-originalvalue"),i=n.find(".container_addTag").attr("data-originalvalue"),r=typeof i!="undefined"&&i!==""?i.split(","):[],f=n.find(".select_topicTagCategory").attr("data-originalvalue");for(n.find("textarea").val(u).html(u),n.find(".text_subject").find("input").val(e),n.find(".text_linkOrImage").find("input").val(o),n.find(".container_tags").html(""),t=0;t<r.length;t++)OfficialTags.indexOf(r[t].replace("#",""))===-1&&n.find(".container_tags").append('<li class="tag">'+r[t]+"<\/li>");n.find(".select_topicTagCategory").attr("data-value",f).find("span").text(f);Modernizr.mobile||typeof this.scrollPaging!="undefined"&&this.scrollPaging.initialize()};Posts.prototype.EditPost=function(n,t){var i=this,f,y,r,u,e,a,b,d;n.find(".s.error, .error").remove();var g=n.attr("data-postId"),o=n.find(".text_subject input"),nt=n.find(".textarea_body"),tt=n.find(".text_linkOrImage input"),v=n.find(".topicTagCategory"),s=n.find(".topicTagSubCategory"),ot=n.find(".taggle input"),it=!1;if(o.length&&o.parent().filter(":visible").length&&(it=!0),f=nt,it&&f.add(o),f=f.add(tt),y=Bnet.Utilities.Validation.getErrors(f),y.length){Bnet.Utilities.Validation.renderErrors(y);return}var h=null,rt=null,p=null,ut=null,c=null,w="";rt=o.val();h=nt.val();ut=tt.val();p="";var l=[],r=null,ft=0;if(c=v.val()!=0?v.val():"",ot.each(function(){l.push($(this).val())}),s.val()!=0&&(w=s.val(),l.push(s.val())),l.length&&(p=l.join(",")),r=null,u=Globals.ForumPostCategoryEnums.None,n.find(".check_poll").is(":checked")){for(u=Globals.ForumPostCategoryEnums.Poll,r="[",e=1;e<=7;e++)a=$("input#topic_poll_answer_"+e.toString()),a.val()!==""&&(r=e>1?r+',"'+a.val()+'"':r+'"'+a.val()+'"');r=r+"]"}else n.find(".check_question input").is(":checked")&&(u=Globals.ForumPostCategoryEnums.Question);n.find(".isAnnouncement input").is(":checked")?u=u|Globals.ForumPostCategoryEnums.Announcement:ft=Globals.ForumPostCategoryEnums.Announcement;n.find(".isOfficialEmployee input").is(":checked")&&(u=u|Globals.ForumPostCategoryEnums.BungieOfficial);b=null;(this.settings.forumType===Globals.ForumTypeEnum.Group||this.settings.forumType===Globals.ForumTypeEnum.Clan)&&(b=n.find(".privateGroupPost input").length?n.find(".privateGroupPost input").is(":checked"):!0);t&&(h=i.forumsjs.AddModMovedMessage(h,c!==v.attr("data-originalvalue")?c:"",w!==s.attr("data-originalvalue")?w:""));var et=n.find("#posting_language_"+g+" option:selected"),k=et.val()||null,st=et.text()||"";k!==null&&i.forumsjs.UpdatePostingLocale(k);d={subject:rt,body:h,tagInput:p,tagCategory:c,urlLinkOrImage:ut,metadata:r,category:u,disableBits:ft,isGroupPostPrivate:b};d.locale=k;bungieNetPlatform.forumService.EditPost(d,g,function(n){var v=n.postId,t,y=!1,s,e,o,f,h,r,c,u,a,l;if($('.replies > li[data-postId="'+n.postId+'"]').length)t=$('.replies > li[data-postId="'+n.postId+'"]').find(".post").eq(0),t.find(".time").eq(0).attr("datetime",n.lastModified),t.find(".time").eq(0).prev(".editedTime").length<1&&t.find(".time").eq(0).before('<span class="editedTime">'+Localizer.Format(Localizer.Forums.edited,{user:viewModels.loggedInUserModel().user.displayName()})+"<\/span>"),y=!0;else{if(t=$("#topicThread > .post").eq(0),s="",i.settings.forumType===Globals.ForumTypeEnum.Public?s=PageUrls.newPostsPage+"/Post/"+n.postId:i.settings.forumType===Globals.ForumTypeEnum.Clan?s="/ClanV2/Post?groupId="+n.groupOwnerId+"&postId="+n.postId:i.settings.forumType===Globals.ForumTypeEnum.Group&&(s="/Groups/Post?groupId="+n.groupOwnerId+"&postId="+n.postId),t.find("h1").eq(0).html(typeof n.subject!="undefined"?n.subject:""),t.find(".time").eq(0).attr("datetime",n.lastModified),t.find(".time").eq(0).prev(".editedTime").length<1&&t.find(".time").eq(0).before('<span class="editedTime">'+Localizer.Format(Localizer.Forums.edited,{user:viewModels.loggedInUserModel().user.displayName()})+"<\/span>"),e=typeof n.tags!="undefined"?n.tags:"",o='<div class="post-language-forum">'+st+"<\/div>",e!=="")for(f=0;f<e.length;f++)f>0&&(o+=", "),o+='<a class="tag" href="'+PageUrls.defaultTopicsPage+"/0/Default/None/"+Utility.GetValidTags(e[f],!0)+'">'+Utility.GetValidTags(e[f])+"<\/a>";h=t.find(".containerTags");h.eq(0).length?h.html(o):h.append(o)}t.find(".post_body").eq(0).html(Bnet.Utilities.Url.correctExternalLinks(Bnet.Utilities.Parse.parseBBCode(n.body,!0,!0)));t.find(".post_body").find("a[href*='<script']").remove();typeof n.urlLinkOrImage!="undefined"&&n.urlLinkOrImage!==""?(t.find(".post_urlLinkOrImage").eq(0).length&&(t.find(".post_urlLinkOrImage").eq(0).attr("data-urlLinkOrImage",n.urlLinkOrImage),t.find(".post_urlLinkOrImage").eq(0).attr("data-postId",v)),r=bungieNetPlatform.assetRenderer.renderAsset({path:n.urlLinkOrImage,width:"100%",fixedRatioHeight:4500/16+"px"}),r&&($currentContainer=t.find(".post_urlLinkOrImage"),r.indexOf("<img")>-1&&(r='<a  title="'+Localizer.Actions.ClickToEnlarge+'">'+r+"<\/a>"),$currentContainer.length>0?($currentContainer.html(r),$currentContainer.attr("data-urlLinkOrImage",r)):(c="image",r.indexOf("iframe")>-1&&(c="video"),t.find(".post_body").eq(0).before("<div class='post_urlLinkOrImage deferred "+c+"'>"+r+"<\/div>"),t.find(".post_urlLinkOrImage").first().attr("data-urlLinkOrImage",r))),Modernizr.mobile||typeof this.scrollPaging!="undefined"&&i.scrollPaging.initialize()):t.find(".post_urlLinkOrImage").eq(0).remove();i.AutoHighlightHelpTerms(t);i.TestDeferred();u=t.find(".postCreation");n.urlLinkOrImage&&u.find(".text_linkOrImage input").eq(0).val(Utility.decodeHTML(n.urlLinkOrImage)).attr("data-originalvalue",Utility.decodeHTML(n.urlLinkOrImage));n.topicId==="undefined"&&(u.find(".text_subject input").eq(0).val(n.subject).attr("data-originalvalue",Utility.decodeHTML(n.subject)),a=i.forumsjs.SplitUpTags(n.tags),u.find(".topicTagCategory").attr("data-originalvalue",a.mainCategoryTag),u.find(".topicTagSubCategory").attr("data-originalvalue",splitUpTagsObject.subCategoryTag),i.forumsjs.SetDefaultValuesForCategorySelects(u),typeof i.taggles[n.postId]!="undefined"&&(i.taggles[n.postId].removeAll(),i.taggles[n.postId].add(splitUpTagsObject.nonCategory)));u.find(".textarea_body").eq(0).val(Utility.decodeHTML(n.body)).text(Utility.decodeHTML(n.body)).attr("data-originalvalue",Utility.decodeHTML(n.body));l=u.find("#posting_language_"+n.postId);l.length>0&&l.attr("data-originalvalue",n.locale);u.removeClass("open")},function(n){Utility.alert(n.errorMessage)})};Posts.prototype.PopulateThePoll=function(n,t){for(var i,e,o=-1,r=0;r<n.polls.length;r++)if(n.polls[r].topicId==t){o=r;break}if(!(o<0)){var s=0,f=$("#forumPost .pollContainer").first(),u=f.find(".pollRow"),h=f.find(".pollOption");for(u.removeClass("selected"),i=0;i<n.polls[0].results.length;i++)e=n.polls[0].results[i],n.polls[0].totalVotes>0&&(s=e.votes/n.polls[0].totalVotes*100),u.find(".pollResult").eq(i).css("width","calc("+s+"% - 35px)"),u.find(".pollResultNumber").eq(i).find("p").text(e.votes),n.polls[0].results[i].requestingUserVoted&&(u.eq(i).addClass("selected"),f.addClass("showingResults"))}};Posts.prototype.InitializeMutedView=function(n,t){var r=$("#forumPost"),i;typeof t=="undefined"&&(t=!1);r.attr("data-postId")==n?r.hasClass("muted")||(t||r.addClass("ignored"),r.addClass("muted"),r.find("article").first().before('<a  class="btn_expand">'+Localizer.Forums.hiddenclicktoview+"<\/a>")):(i=$("#forumPost").find(".replies > [data-postId='"+n+"']"),i.hasClass("muted")||(t||i.addClass("ignored"),!t&&$(".muted.expanded").length?i.addClass("muted expanded"):i.addClass("muted"),i.prepend('<a class="btn_expand">'+Localizer.Forums.hiddenclicktoview+"<\/a>")))};Posts.prototype.MuteReply=function(n){var t,i;this.InitializeMutedView(n,!1);t=$("#forumPost");t.attr("data-postId")==n?$(".forumHeader .overlayLink").click():(i=$("#post").find(".replies > [data-postId='"+n+"']"),i.hasClass("muted")&&this.SetMuteButtonToUnmute(t,n))};Posts.prototype.SetMuteButtonToUnmute=function(n,t){var i=n.find(".trigger_mute[data-postId='"+t+"']");i.attr("data-report")?i.addClass("hide"):i.eq(0).addClass("Unmute").attr("title",Localizer.Actions.unignore).text(Localizer.Actions.unignore)};Posts.prototype.UnmuteReply=function(n){var t=$("#forumPost"),i;t.attr("data-postId")==n?(t.removeClass("muted"),t.find(".btn_expand").eq(0).remove(),t.find(".trigger_mute").not("[data-report]").eq(0).removeClass("Unmute").attr("title",Localizer.Actions.ignore).text(Localizer.Actions.ignore)):(i=$("#post").find(".replies > [data-postId='"+n+"']"),i.removeClass("muted"),i.find(".btn_expand").eq(0).remove(),i.find(".trigger_mute").not("[data-report]").removeClass("Unmute").attr("title",Localizer.Actions.ignore).text(Localizer.Actions.ignore))};Posts.prototype.GetArticleUrl=function(n){return PageUrls.newsArticle+"?aid="+n};Posts.prototype.GetPostContainerUrl=function(n,t){var r="",i;return typeof t!="undefined"&&(r="&sort="+(typeof t.sort!="undefined"?t.sort:"0")+"&page="+(typeof t.page!="undefined"?t.page:"0")),i="Forums",typeof t.forumType!="undefined"?(t.forumType===Globals.ForumTypeEnum.Group?(i="Groups",r+="&groupId="+t.groupId):t.forumType===Globals.ForumTypeEnum.Clan&&(i="ClanV2",r+="&groupId="+t.groupId),i==="Forums")?window.location.protocol+"//"+window.location.host+"/"+Localizer.CurrentCultureName+"/"+i+"/PostContainer/"+n+"?"+r:window.location.protocol+"//"+window.location.host+"/"+Localizer.CurrentCultureName+"/"+i+"/PostContainer?postId="+n+r:void 0};Posts.prototype.ReadyForm=function(n){if(!SignIn.notSignedIn()){var t=n.closest(".post").find(".postCreation"),r=t.attr("data-postid"),i=t.find(".text_subject, .container_tagEntry, .check_poll, .check_question, .js-language-selector");if(t.hasClass("open")&&n.hasClass("on")){t.removeClass("open");n.removeClass("on");this.ResetFormToEmpty(t,i);return}t.addClass("open");n.hasClass("trigger_replyToPost")?(this.ResetFormToEmpty(t,i),this.SetToReplyForm(t,i)):n.hasClass("trigger_replyAsTopic")?(this.ResetFormToEmpty(t,i),this.SetToReplyTopicForm(t,i)):n.hasClass("btn_edit")&&(this.ResetFormToEmpty(t,i),this.SetToEditForm(t,i));n.hasClass("on")?n.removeClass("on"):(n.closest(".threadControls").find(".on").removeClass("on"),n.addClass("on"));t.find(".textarea_body").focus();Modernizr.mobile||typeof this.scrollPaging=="undefined"||this.scrollPaging.setDimensions()}};Posts.prototype.SetToReplyForm=function(n,t){t.addClass("hide")};Posts.prototype.SetToEditForm=function(n,t){if(n.addClass("edit"),n.closest(".replies").length)t.addClass("hide");else if(t.removeClass("hide"),this.forumsjs.SetDefaultValuesForCategorySelects(n),typeof this.taggles[this.postId]=="undefined"){var i=new Taggle("CreatePostTagEntry_"+this.postId,{placeholder:Localizer.Forums.entertags});this.taggles[this.postId]=i;this.taggles[this.postId].add($("#CreatePostTagEntry_"+this.postId).attr("data-originalvalue").split(","))}else this.taggles[this.postId].add($("#CreatePostTagEntry_"+this.postId).attr("data-originalvalue").split(","));n.find("[data-originalvalue]").each(function(){var n=$(this),t,i;n.attr("data-originalvalue")!==""&&(t=n.attr("data-originalvalue"),i=t.toLowerCase(),n.is("[type=text]")?n.val(t):n.is("[type=checkbox]")?(i==="true"?t=!0:i==="false"&&(t=!1),n.prop("checked",t)):n.is("textarea")?n.val(t).text(t):n.is("select")&&n.val(t))})};Posts.prototype.SetToReplyTopicForm=function(n,t){t.filter(".hide").removeClass("hide");this.forumsjs.SetDefaultValuesForCategorySelects(n)};Posts.prototype.ResetFormToEmpty=function(n,t){var i=n.attr("data-postid");n.removeClass("edit");t.filter(".hide").removeClass("hide");n.find("input[type=text]").val("");n.find("textarea").val("").text("");typeof this.taggles[i]!="undefined"&&this.taggles[i].removeAll();$editTab=n.find(".tab[data-tab='Edit']");this.forumsjs.ActivateEditPreviewTab($editTab)};Posts.prototype.ChangeRecruitmentPostState=function(){var n=$(".recruitRow.filled").eq(0).hasClass("selected");n&&($(".recruitmentInfo").remove(),$(".recruitRow.filled").length>1&&$(".recruitmentContainer").before('<div class="recruitmentInfo"><p>'+Localizer.Forums.yourfireteamisfullplease+' <a data-topicid="'+$(".recruitmentContainer").attr("data-topicid")+'" class="btn_approvefireteam" title="'+Localizer.Forums.approvefireteam+'">'+Localizer.Forums.approvefireteam+"<\/a><\/p><\/div>"))};Posts.prototype.ResetFireteamSlot=function(n){n.find(".btn_removeFromFireteam, .btn_leaveFireteam").remove();n.removeClass("selected filled");n.find(".barSelectorText p").text(Localizer.Forums.spotopen);n.find(".recruitOption").css("background-image","none").removeAttr("href");this.ChangeRecruitmentPostState()};Posts.prototype.AddFireteamMember=function(n,t){n.attr({"data-membershipid":t.membershipId,"data-uniquename":t.uniqueName,"data-displayname":t.displayName});n.addClass("filled");viewModels.loggedInUserModel().user.membershipId()==t.membershipId?(n.addClass("selected"),n.find(".barSelectorText p").after('<a class="btn_leaveFireteam" data-topicid="'+n.closest("#forumPost").attr("data-postid")+'" data-membershipid="'+viewModels.loggedInUserModel().user.membershipId()+'">'+Localizer.Forums.leavefireteam+"<\/a>")):n.find(".barSelectorText p").after('<a data-membershipid="'+t.membershipId+'" data-topicid="'+n.closest("#forumPost").attr("data-postid")+'" class="btn_removeFromFireteam">'+Localizer.Forums.remove+"<\/a>");n.find(".barSelectorText p").html(Localizer.Format(Localizer.Forums.spotfilledbyuseruser,{user:t.displayName,userLink:PageUrls.profilePage+"?id="+t.membershipId}));var i='<a style="background-image:url('+t.profilePicturePath+');" class="recruitOption barSelectorOption" href="'+PageUrls.profilePage+"?id="+t.membershipId+'"><span style="" class="fa fa-2x barSelectorOptionIcon"><\/span><\/a>';n.find(".recruitOption").replaceWith(i);this.ChangeRecruitmentPostState()};Posts.prototype.CloseThread=function(n){var r=n.conversationId,u=!n.approved,i,t;$(".btn_approvefireteam").remove();$(".btn_adminChangeLockState").remove();i=$(".recruitmentInfo p");t="";$(".recruitRow[data-membershipid="+viewModels.loggedInUserModel().user.membershipId()+"]").length&&(t=u?Localizer.Format(Localizer.Forums.fireteamcreatedadatamessageid,{conversationId:r}):Localizer.Forums.thisthreadhasbeenlockedapproved);i.length?i.html(t):$(".recruitmentInfo").append("<p>"+t+"<\/p>")};Posts.prototype.AddEventListeners=function(){var n=this,t;$("#forumPost").off(".forumPost");$(window).off("scroll.forumPost resize.forumPost");$(window).on("scroll.forumPost resize.forumPost",function(){n.TestDeferred()});$("#forumPost").on("click.forumPost",".btn_adminChangePinState",function(n){if(n.preventDefault(),!SignIn.notSignedIn()){var t=$(this),i=t.attr("data-postid"),r=t.attr("data-pinstate"),u=t.parent();bungieNetPlatform.forumService.ChangePinState(i,r,function(){u.addClass("hide");Utility.alert("Pin state changed, new post sort order will take effect shortly.")},function(n){Utility.alert(n.errorMessage)})}});$("#forumPost").on("click.forumPost",".btn_adminChangeLockState",function(n){if(n.preventDefault(),!SignIn.notSignedIn()){var t=$(this),e=t.attr("data-postid"),r=t.attr("data-lockstate"),u=t.parent(),i=Localizer.Forums.areyousureyouwanttolock,o=Localizer.Actions.yes,f=Localizer.Actions.cancel;t.hasClass("btn_fireteam")?(i=Localizer.Forums.areyousureyouwanttocancelfireteam,f=Localizer.Actions.no):r=="0"&&(i=Localizer.Forums.areyousureyouwanttounlock);Utility.showConfirmationDialog(i,"",o,f,function(){bungieNetPlatform.forumService.ChangeLockState(e,r,function(){u.hasClass("pinsticky")?(u.addClass("hide"),Utility.alert(Localizer.Forums.topiclockstatechanged)):window.location=window.location},function(n){Utility.alert(n.errorMessage)})})}});$("#forumPost").on("click.forumPost",".btn_dpsSave",function(n){var r,u;if(n.preventDefault(),!SignIn.notSignedIn()){var f=$(this).attr("data-postId"),i=$(this).parent(),t=0;i.find("input:checked").each(function(){t=t|parseInt($(this).val())});r=i.find("input[type=text]").val();u={playerSupportFlags:t,playerSupportMetadata:r};bungieNetPlatform.forumService.EditPost(u,f,function(){Utility.alert("Player Support Information Saved.")},function(n){Utility.alert(n.errorMessage)})}});if(!Modernizr.gestures)$("#forumPost").on("mouseenter.forumPost",".isChild:has(.arrow)",function(){var i=$(this).children("article:has(.arrow)"),f;if(i.children(".arrow").length){var n=i.children(".arrow"),o=parseInt(i.outerHeight(),10),t=$("#"+n.attr("data-actualParentPostId"));t.hasClass("muted")?t.hasClass("expanded")?n.removeClass("hide"):n.addClass("hide"):n.removeClass("hide");t.is("li:not(.isChild)")&&n.css({"border-top":"0","border-radius":"0"});n.find("a").text(t.find("h1").first().text());f=t.offset().top;n.find("a").on("click",function(n){var i,r;n.preventDefault();i=t.offset().top;$(".forumPost .pulse").removeClass("pulse");t.find(".post").first().addClass("pulse");r=setTimeout(function(){t.find(".pulse").removeClass("pulse")},5e3);$("html:not(:animated),body:not(:animated)").animate({scrollTop:i-100},300)});var e=i.offset().top,u=e-f-10,r=u;t.is(".first.replies li:not(.isChild)")?(r=$("link[title=color]").length?u-40:u-30,n.css("height",r+"px")):n.css("height",r+"px");n.css("top",-r+24+"px")}});t=!1;$("#forumPost").on("click.forumPost",".btn_more",function(i){var r,u;if(i.preventDefault(),i.stopImmediatePropagation(),r=$(this),r.hasClass("on")){r.removeClass("on").addClass("off");r.siblings(".replies").stop(!0,!0).slideUp(200);return}if(r.hasClass("off")){r.removeClass("off").addClass("on");r.siblings(".replies").stop(!0,!0).slideDown(200);return}u=r.attr("data-parentPostId");r.hasClass("btn_olderBlock")&&!t&&($.get(n.GetPostContainerUrl(u,{page:r.attr("data-page"),forumType:n.settings.forumType}),function(i){t=!1;n.AddInnerLevelReplies(u,i);r.addClass("on");r.siblings(".replies").stop(!0,!0).slideDown(200)}).fail(function(){t=!1}),r.hasClass("loadNextPage")&&r.parent().remove())});$("#forumPost").on("click.forumPost",".gated",function(t){var i=$(this),r="",u;typeof i.data("urlLinkOrImage")=="undefined"?(u=i.closest("[data-urlLinkOrImage]").attr("data-urlLinkOrImage"),u!==""&&(r=bungieNetPlatform.assetRenderer.renderAsset({path:u,width:"100%",fixedRatioHeight:Modernizr.mobile&&!Modernizr.ipad?6750/16+"px":4500/16+"px"}))):r=i.data("urlLinkOrImage");t.target!==i.find("a").get(0)&&(t.preventDefault(),r.indexOf("iframe")===-1?(i.addClass("image"),i.data("oldHTML",i.html()),i.html('<a  title="'+Localizer.Actions.clicktoenlarge+'">'+r+"<\/a>")):(i.addClass("video"),i.data("oldHTML",i.html()),i.html(r)),i.removeClass("gated"),i.append('<a  class="btn_hideImage '+(Modernizr.mobile&&!Modernizr.ipad?"":"ir")+'" title="'+Localizer.Actions.ignore+'">'+Localizer.Actions.ignore+" <span>X<\/span><\/a>"),Modernizr.mobile||typeof n.scrollPaging=="undefined"||n.scrollPaging.setDimensions())});$("#forumPost").on("click.forumPost",".btn_hideImage",function(n){n.preventDefault();n.stopImmediatePropagation();$(this).parent().addClass("gated");$(this).parent().html($(this).parent().data("oldHTML"))});$("#forumPost").on("click.forumPost",".post_urlLinkOrImage a",function(n){var t=$(this);t.children("img").length&&(n.preventDefault(),n.stopImmediatePropagation(),Utility.showMediaLightBox('<img class="img_lightbox" src="'+Utility.ContentVersioned(this.childNodes[0].src)+'" alt="" /><br /><a class="extraContent" href="'+this.childNodes[0].src+'">'+this.childNodes[0].src+"<\/a>"))});$("#forumPost").on("mouseenter.forumPost",".armoryLink",function(){var r=this,t=$(this),n=t,i=t.find(".destinyTooltip");i.length||$.ajax({type:"GET",url:this.href.replace("Category","Tooltip")}).done(function(t){var i=$(t),r;i.length&&i.hasClass("destinyTooltip")&&(n.append(i),r=new ExtraInfoTip(n,n.find(".destinyTooltip"),{onScreen:!0,fadeIn:1e3,delayTime:250,skipInitialMouseover:!0}))})});$("#forumPost").on("click.forumPost",".trigger_groupModerate",function(t){if(t.preventDefault(),!SignIn.notSignedIn()){var r=$(this),u=r.attr("data-postId"),i='<div class="container_select"><label for="mute_reason">'+Localizer.Forums.groupmoderateareyousure+"<\/label>";i+='<div class="adminIgnoreWarning">'+Localizer.Forums.groupmoderatetext+"<\/div>";i+="<\/select><\/div>";i+='<p><a class="btn_blue btn_groupModerate" data-postId="'+u+'">'+Localizer.Actions.groupmoderate+'<\/a><a  class="btn_blue btn_cancel">'+Localizer.Forums.cancel+"<\/a>";i+="<\/p>";Utility.alert_noClose(i);$("#alert_noClose").addClass("alert_mute");$("#alert_noClose .btn_groupModerate").on("click",function(t){t.preventDefault();var r=$(this),i=r.attr("data-postId"),u=new ModerationRequest(null,i,Globals.IgnoredItemType.Post,"group post ban",1,0);bungieNetPlatform.forumService.ModerateGroupPost(u,i,function(){customAlert_forActions.closeLightbox();n.MuteReply(i)},function(n){customAlert_forActions.closeLightbox();Utility.alert(n.errorMessage)})});$("#alert_noClose .btn_cancel").on("click",function(n){n.preventDefault();customAlert_forActions.closeLightbox()})}});$("#forumPost").on("click.forumPost",".trigger_mute",function(t){var o,r,u,i;if(t.preventDefault(),!SignIn.notSignedIn()){var f=$(this),e=f.attr("data-postId"),s=f.attr("data-membershipid");if(f.hasClass("Unmute"))o=new UnignoreItemRequest(null,e,Globals.IgnoredItemType.Post),bungieNetPlatform.ignoreService.UnignoreItem(o,function(){customAlert_forActions.closeLightbox();n.UnmuteReply(e)},function(n){customAlert_forActions.closeLightbox();Utility.alert(n.errorMessage)});else{for(r='<div class="container_select"><label for="mute_reason">'+Localizer.Forums.whyreport+"<\/label>",r+='<select id="mute_reason">',u=0;u<IgnoreSettings.length;u++)r+='<option name="mute_reason" value="'+IgnoreSettings[u]+'">'+Localizer.Mute[IgnoreSettings[u]]+"<\/option>";r+="<\/select><\/div>";i='<p><a  class="btn_blue btn_mute" data-postId="'+e+'">'+Localizer.Actions.report+'<\/a><a  class="btn_blue btn_cancel">'+Localizer.Forums.cancel+"<\/a>";viewModels.isReporter()?(r+='<div class="adminIgnoreWarning">'+Localizer.Helptext.adminignorewarning+"<\/div>",i+='<label for="mod_report_select">&nbsp;'+Localizer.Forums.moderatorrequestedpunishment+'&nbsp;<\/label><select id="mod_report_select">',i+='<option value="'+Globals.ModeratorRequestedPunishment.Warning+'" selected="selected">'+Localizer.Forums.moderatorwarn+"<\/option>",i+='<option value="'+Globals.ModeratorRequestedPunishment.SevenDayBan+'">'+Localizer.Forums.moderatorsevendayban+"<\/option>",i+='<option value="'+Globals.ModeratorRequestedPunishment.ThirtyDayBan+'">'+Localizer.Forums.moderatorthirtydayban+"<\/option>",i+='<option value="'+Globals.ModeratorRequestedPunishment.PermanentBan+'">'+Localizer.Forums.moderatorpermanentban+"<\/option>",i+='<option value="'+Globals.ModeratorRequestedPunishment.Unknown+'">'+Localizer.Forums.moderatornopunishment+"<\/option>",i+="<\/select><br />"+Localizer.Forums.moderatorblastban+'&nbsp;<input id="mod_report_blast" type="checkbox" />',i+='<\/p><p class="adminBanHistory">'):r+='<div class="adminIgnoreWarning">'+Localizer.Helptext.userignoretext+"<\/div>";i+="<\/p>";Utility.alert_noClose(r+i);viewModels.isReporter()&&Utility.applyBanHistoryToElement($("#alert_noClose .adminBanHistory"),s);$("#alert_noClose").addClass("alert_mute");$("#alert_noClose .btn_mute").on("click",function(t){t.preventDefault();var r=$(this),i=r.attr("data-postId"),u=$("#mute_reason").val(),f=$("#mod_report_select").val(),e=$("#mod_report_blast").prop("checked"),o=new IgnoreItemRequest(null,i,Globals.IgnoredItemType.Post,"",u,0,0,f,e);bungieNetPlatform.ignoreService.IgnoreItem(o,function(){customAlert_forActions.closeLightbox();n.MuteReply(i)},function(n){customAlert_forActions.closeLightbox();Utility.alert(n.errorMessage)})});$("#alert_noClose .btn_cancel").on("click",function(n){n.preventDefault();customAlert_forActions.closeLightbox()})}}});$("#forumPost").on("click.forumPost",".btn_unmuteAll",function(n){var t=$(this);n.preventDefault();$(".muted.expanded").length?(t.text(Localizer.Actions.showallposts),$(".muted").removeClass("expanded")):(t.text(Localizer.Actions.hideignoredposts),$(".muted").not(".ignored").addClass("expanded"))});$("#forumPost").on("click.forumPost",".btn_expand",function(n){var t=$(this);n.preventDefault();t.parent().hasClass("expanded")?(t.text(Localizer.Actions.replyhiddenclicktoview),t.parent().removeClass("expanded")):(t.text(Localizer.Actions.replyhiddenclicktohide),$(this).parent().addClass("expanded"))});$("#forumPost").on("click.forumPost",".trigger_delete",function(n){if(n.preventDefault(),!SignIn.notSignedIn()){var t=$(this),i=t.attr("data-postId");Utility.alert_noClose("<p>"+Localizer.Forums.suredelete+'<\/p><p><a  class="btn_blue btn_delete" data-postId="'+i+'">'+Localizer.Forums.deletepost+'<\/a><a  class="btn_blue btn_cancel">'+Localizer.Forums.cancel+"<\/a><\/p>");$("#alert_noClose").addClass("alert_delete");$("#alert_noClose .btn_delete").on("click",function(n){n.preventDefault();var t=$(this),i=t.attr("data-postId");bungieNetPlatform.forumService.DeletePost(i,function(){customAlert_forActions.closeLightbox();$("#forumPost").find(".replies").remove();$("#forumPost").find(".post_body").html(Localizer.Forums.topicdeletedmessage);$("#forumPost").find(".actions").html("")},function(){})});$("#alert_noClose .btn_cancel").on("click",function(n){n.preventDefault();customAlert_forActions.closeLightbox()})}});$("#forumPost").on("keyup.forumPost",function(n){if(n.which===13){var t=$(document.activeElement);t.click()}});$("#forumPost").on("click.forumPost",".trigger_replyToPost",function(t){t.preventDefault();var i=$(this);n.ReadyForm(i)});$("#forumPost").on("click.forumPost",".trigger_replyAsTopic",function(){var t=$(this);n.ReadyForm(t)});$("#forumPost").on("click.forumPost",".postCreation .btn_cancel","click",function(n){n.preventDefault();$replycontainer=$(this).closest(".postCreation");$replycontainer.removeClass("open");$replycontainer.find("input, textarea").val("").css("height","");$replycontainer.find("container_checkbox").addClass("hide");$replycontainer.find("input, textarea").val("");$replycontainer.find(".error").remove()});$("#forumPost").on("click.forumPost",".btn_submitPost",function(t){if(t.preventDefault(),!SignIn.notSignedIn()){var i=$(this),r=i.closest(".postCreation"),u=r.attr("data-postid");i.hasClass("btn_submitEdit")?n.EditPost(r,i.hasClass("modEdit")):n.forumsjs.PostCreation(n,null,r,n.taggles[u])}});$("#forumPost").on("click.forumPost",".pollContainer .pollRow",function(t){if(t.preventDefault(),$(this).closest(".previewPost").length==0){if(SignIn.notSignedIn())return;var r=$(this),u=r.closest(".pollContainer"),o=u.find(".pollOption"),e=u.find(".pollRow"),f=e.index(r),i=$("#forumPost").attr("data-postId");bungieNetPlatform.forumService.PollVote(i,f,function(){bungieNetPlatform.forumService.GetPoll(i,function(t){n.PopulateThePoll(t,i,f)},function(){})},function(n){Utility.alert(n.errorMessage)})}});$("#forumPost").on("click.forumPost",".btn_answer",function(n){if(n.preventDefault(),!SignIn.notSignedIn()){var r=$(this),t=r.attr("data-postId"),i=r.attr("data-topicId");i>0&&t>0&&bungieNetPlatform.forumService.MarkReplyAsAnswer(t,i,function(){Utility.alert(Localizer.Forums.postisanswer);var n=$(".questionTopic");n.length==0&&($("ul.replies[data-postid="+i+"]").addClass("questionTopic"),n=$(".questionTopic"));n.addClass("questionAnswered");$(".questionTopic #"+t).addClass("questionAnswer").siblings(".questionAnswer").removeClass("questionAnswer");n.prepend($(".questionAnswer").detach())},function(n){Utility.alert(n.errorMessage)})}});$("#forumPost").on("click.forumPost",".btn_unanswer",function(n){if(n.preventDefault(),!SignIn.notSignedIn()){var i=$(this),t=i.attr("data-topicId");t>0&&bungieNetPlatform.forumService.UnmarkReplyAsAnswer(t,function(){Utility.alert(Localizer.Forums.postisunanswered);var n=$(".questionTopic"),t=$(".questionAnswer");n.removeClass("questionAnswered");t.removeClass("questionAnswer")},function(n){Utility.alert(n.errorMessage)})}});$("#forumPost").on("click.forumPost",".tab",function(t){t.preventDefault();var i=$(t.currentTarget);n.forumsjs.ActivateEditPreviewTab(i)});$("#forumPost").on("click.forumPost",".btn_edit",function(t){var i=$(this);t.preventDefault();n.ReadyForm(i)});$("#forumPost").on("click.forumPost",".btn_cancelEdit",function(t){t.preventDefault();var i=$(this);i.closest(".edit").find(".error").remove();n.ResetEditArea(i.closest(".edit"),i)});$("#forumPost").on("click.forumPost",".trigger_showRevisionHistory",function(n){var i=$(this),r,t;n.preventDefault();r=i.attr("data-postId");t=i.parents(".postBody").find(".post-history-container");t.attr("data-loaded")?t.toggle():(t.show(),t.find(".post-history-loading").show(),bungieNetPlatform.adminService.GetPostRevisionHistory(r,function(n){var e,f;if(!t.attr("data-loaded")){for($templateDiv=t.find(".post-history-entry"),$templateDiv.remove(),e=0;e<n.revisions.length;e++){var u=$templateDiv.clone(),i=n.revisions[e],r=[];i.category&Globals.ForumPostCategoryEnums.TextOnly&&r.push("Text");i.category&Globals.ForumPostCategoryEnums.Media&&r.push("Media");i.category&Globals.ForumPostCategoryEnums.Link&&r.push("Link");i.category&Globals.ForumPostCategoryEnums.Poll&&r.push("Poll");i.category&Globals.ForumPostCategoryEnums.Question&&r.push("Question");i.category&Globals.ForumPostCategoryEnums.Answered&&r.push("Answered");i.category&Globals.ForumPostCategoryEnums.Announcement&&r.push("Announcement");i.category&Globals.ForumPostCategoryEnums.ContentComment&&r.push("Comment");i.category&Globals.ForumPostCategoryEnums.BungieOfficial&&r.push("Bungie Official");i.category&Globals.ForumPostCategoryEnums.NinjaOfficial&&r.push("Ninja Official");i.category&Globals.ForumPostCategoryEnums.Recruitment&&r.push("Recruitment");f=[];i.flags&Globals.ForumFlagsEnum.BungieStaffPost&&f.push("Bungie Staff Post");i.flags&Globals.ForumFlagsEnum.ForumNinjaPost&&f.push("Forum Ninja Post");i.flags&Globals.ForumFlagsEnum.ForumMentorPost&&f.push("Forum Mentor Post");i.flags&Globals.ForumFlagsEnum.TopicBungieStaffPosted&&f.push("Bungie Staff Topic");i.flags&Globals.ForumFlagsEnum.TopicBungieVolunteerPosted&&f.push("Bungie Volunteer Post");i.flags&Globals.ForumFlagsEnum.QuestionAnsweredByBungie&&f.push("Answered by Bungie");i.flags&Globals.ForumFlagsEnum.QuestionAnsweredByNinja&&f.push("Answered by Ninja");i.flags&Globals.ForumFlagsEnum.CommunityContent&&f.push("Community Content");u.find(".post-history-revision").text(e);u.find(".post-history-editor-link").attr("href","/en/Profile/"+i.editorMembershipId);u.find(".post-history-editor-name").text(i.editorDisplayName);u.find(".post-history-date").text(i.editDate);u.find(".post-history-subject").text(i.subject);u.find(".post-history-link").text(i.urlLinkOrImage);u.find(".post-history-category").text(r.join(","));u.find(".post-history-flags").text(f.join(","));u.find(".post-history-support-flags").text(i.playerSupportFlags);u.find(".post-history-body").text(i.body);u.appendTo(t)}t.attr("data-loaded","true");t.find(".post-history-loading").hide();t.show();t.find(".post-history-entries").show()}},function(n){Bnet.Utilities.Modals.Alert(n)}))});$("#forumPost").on("click.forumPost",".btn_addTag",function(n){n.preventDefault();var i=$(this),t=i.closest(".container_addTag").find("input").val();t.indexOf("#")===-1&&(t="#"+t);t!==""&&Utility.ValidateTags(t)&&Utility.GetValidTags(t).length?(i.closest(".container_addTag").find(".container_tags").append('<li class="tag">'+Utility.GetValidTags(t)+"<\/li>"),i.closest(".container_addTag").find("input").val("")):Utility.alert(Localizer.Messages.invalidtag)});$("#forumPost").on("click.forumPost",".container_tags .tag",function(n){n.preventDefault();$(this).remove()});$("#forumPost").on("click.forumPost",".container_textfield",function(){$(this).prev(".error").remove()});$("#forumPost").on("click.forumPost",".trigger_adminControls",function(n){n.preventDefault();var i=$(this),t=i.closest(".adminControls");t.addClass("open");t.on("click.openAdminControls",function(n){var i=$(n.target);i.is(t.find(".content"))||(t.removeClass("open"),t.off("click.openAdminControls"))})});$(document).off("recruitThreadUpdated.forumPost");$(document).on("recruitThreadUpdated.forumPost",function(t,i){var r=i.recruitThreadUpdate,u;$("#forumPost").attr("data-postid")==r.topicId&&(typeof r.conversationId!="undefined"&&r.conversationId!==null&&r.conversationId!=0?n.CloseThread(r.conversationId):r.isRemoved?(u=$(".recruitRow").filter("[data-membershipid="+r.membershipId+"]"),n.ResetFireteamSlot(u)):bungieNetPlatform.userService.GetBungieNetUserById(r.membershipId,function(t){n.AddFireteamMember($(".recruitRow").not(".filled").eq(0),t)},function(n){Bnet.Utilities.Modals.Alert(n)}))});$("#forumPost").on("click.forumPost",".recruitmentContainer .barSelectorRow",function(t){var i=$(this);$(t.target).is("a")||i.hasClass("selected")||i.hasClass("filled")||(t.stopImmediatePropagation(),t.preventDefault(),Bnet.Utilities.Modals.Confirm(Localizer.Forums.areyousureyouwanttojoin,Bnet.ConfirmationReason.Warning,function(){bungieNetPlatform.forumService.JoinFireteamThread(i.closest(".recruitmentContainer").attr("data-topicid"),function(t){var t=t;n.AddFireteamMember(i.closest(".barSelectorRow"),{displayName:viewModels.loggedInUserModel().user.displayName(),uniqueName:viewModels.loggedInUserModel().user.uniqueName(),membershipId:viewModels.loggedInUserModel().user.membershipId(),profilePicturePath:viewModels.loggedInUserModel().user.profilePicturePath()})},function(n){Bnet.Utilities.Modals.Alert(n)})}))});$("#forumPost").on("click.forumPost",".btn_removeFromFireteam",function(t){t.stopImmediatePropagation();t.preventDefault();var i=$(this),r=i.attr("data-topicid"),u=i.attr("data-membershipid");Bnet.Utilities.Modals.Confirm(Localizer.Forums.areyousureyouwanttokick,Bnet.ConfirmationReason.Warning,function(){bungieNetPlatform.forumService.KickBanFireteamApplicant(r,u,function(){n.ResetFireteamSlot(i.closest(".barSelectorRow"))},function(n){Bnet.Utilities.Modals.Alert(n)})})});$("#forumPost").on("click.forumPost",".btn_approvefireteam",function(t){t.preventDefault();var i=$(this),r=i.attr("data-topicid");Bnet.Utilities.Modals.Confirm(Localizer.Forums.areyousureyouwanttoapprove,Bnet.ConfirmationReason.Warning,function(){var t=[];$(".recruitRow").each(function(){var n=$(this),i=n.attr("data-membershipid"),r=n.attr("data-uniquename"),u=n.attr("data-displayname");t.push({displayName:u,membershipId:i,uniqueName:r})});bungieNetPlatform.forumService.ApproveFireteamThread(r,function(t){Bnet.Site.UserNotify.NotificationPane.Instance.showConversation(t.conversationId,Bnet.Site.UserNotify.MessagesType.Messages);n.CloseThread(t.conversationId)},function(n){Bnet.Utilities.Modals.Alert(n)})})});$(document).off("click.forumPost");$(document).on("click.forumPost",".btn_gotomessage",function(n){n.preventDefault();var t=$(this);Bnet.Site.UserNotify.NotificationPane.Instance.showConversation($(this).attr("data-messageid"),Bnet.Site.UserNotify.MessagesType.Messages)});$("#forumPost").on("click.forumPost",".btn_leaveFireteam",function(t){t.stopImmediatePropagation();t.preventDefault();var i=$(this),r=i.attr("data-topicid");Bnet.Utilities.Modals.Confirm(Localizer.Forums.areyousureyouwanttoleave,Bnet.ConfirmationReason.Warning,function(){bungieNetPlatform.forumService.LeaveFireteamThread(r,function(){n.ResetFireteamSlot(i.closest(".barSelectorRow"))},function(n){Utility.alert(n.errorMessage+"("+n.errorCode+")")})})})};Forums=function(){var n=this;n.AddEventListeners();typeof ForumSidebar!="undefined"&&(n.forumSidebar=new ForumSidebar);n.darkThemePage=new DarkThemePage(!1);Bnet.Site.PageController.Instance.allowSamePathname=!0};Forums.prototype.GetPreviousPostingLocale=function(){return Bnet.Utilities.LocalStorage.getItem("forums.posting_language")};Forums.prototype.UpdatePostingLocale=function(n){Bnet.Utilities.LocalStorage.setItem("forums.posting_language",n)};Forums.prototype.PostCreation=function(n,t,i,r){var o,k,d,c,v,et,g,ot,y,st;i.find(".s.error, .error").remove();var p=i.attr("data-postId"),u=i.find(".text_subject input"),f=i.find(".textarea_body"),h=i.find(".text_linkOrImage input"),ht=i.find(".topicTagCategory"),w=i.find(".topicTagSubCategory"),ct=i.find(".taggle input"),b=!1;if(u.length&&u.parent().filter(":visible").length&&(b=!0),b&&(o=u),f.val()===""&&h.val()!==""||(typeof o!="undefined"?o.add(f):o=f),o=o.add(h),k=Bnet.Utilities.Validation.getErrors(o),k.length){Bnet.Utilities.Validation.renderErrors(k);return}var lt=u.val(),nt=f.val(),tt=h.val(),l="",a=[];if(ct.each(function(){a.push($(this).val())}),(w.val()!=="0"&&!i.find("#check_recruit").is(":checked")||w.val()==="Clans"&&i.find("#check_recruit").is(":checked"))&&a.push(w.val()),a.length&&(l=a.join(",")),d=ht.val(),i.find("#check_recruit").is(":checked")&&($("#recruitTeam_spots").val()==="0"||$("#recruitTeam_platform").val()==="0"||$("#recruitTeam_activity").val()==="0")){Bnet.Utilities.Modals.Alert(Localizer.Forums.torecruitafireteamplatform);return}var s=null,it=null,rt=null,ut=null,ft=null,e=Globals.ForumPostCategoryEnums.None;if(i.find(".check_poll input").is(":checked")){for(e=Globals.ForumPostCategoryEnums.Poll,s="[",c=1;c<=7;c++)v=i.find("[id^=topic_poll_answer_"+c.toString()+"]"),v.val()!==""&&(s=c>1?s+',"'+v.val()+'"':s+'"'+v.val()+'"');s=s+"]"}else i.find(".check_question input").is(":checked")?e=Globals.ForumPostCategoryEnums.Question:i.find("#check_recruit").is(":checked")&&(e=Globals.ForumPostCategoryEnums.Recruitment,tt="",rt=$("#recruitTeam_spots").val(),it=$("#checkbox_recruitcreate_mic").is(":checked"),platform=$("#recruitTeam_platform").val(),ft=$("#recruitTeam_tone").val()!=="0"?$("#recruitTeam_tone").val():null,ut=$("#recruitTeam_skill").val()!=="0"?$("#recruitTeam_skill").val():null,et=recruitmentActivities[$("#recruitTeam_activity").val()],l=et.tag+","+platform+","+l,d="Recruitment");i.find(".isAnnouncement input").is(":checked")&&(e=e|Globals.ForumPostCategoryEnums.Announcement);i.find(".isOfficialEmployee input").is(":checked")&&(e=e|Globals.ForumPostCategoryEnums.BungieOfficial);g=null;(n&&(n.settings.forumType===Globals.ForumTypeEnum.Group||n.settings.forumType===Globals.ForumTypeEnum.Clan)||t&&(t.settings.forumType===Globals.ForumTypeEnum.Group||t.settings.forumType===Globals.ForumTypeEnum.Clan))&&(g=i.find(".privateGroupPost input").length?i.find(".privateGroupPost input").is(":checked"):!0);ot=i.find("#posting_language");y=ot.val()||null;y!==null&&this.UpdatePostingLocale(y);st={parentPostId:typeof p!="undefined"?p:null,subTopicOverride:b&&typeof p!="undefined",subject:lt,body:nt!==""?nt:null,tagInput:l,tagCategory:d,category:e,groupId:n&&(n.settings.forumType===Globals.ForumTypeEnum.Group||n.settings.forumType===Globals.ForumTypeEnum.Clan)||t&&(t.settings.forumType===Globals.ForumTypeEnum.Group||t.settings.forumType===Globals.ForumTypeEnum.Clan)?n&&n.settings.groupId||t&&t.settings.groupId:null,isGroupPrivate:g,urlLinkOrImage:tt,metadata:s,playerSupportFlags:0,playerSupportMetadata:null,recruitMicrophoneRequired:it,recruitIntensity:ut,recruitTone:ft,recruitSlots:rt,locale:y};i.destinyLoader({startOnInit:!0});bungieNetPlatform.forumService.CreatePost(st,function(e){var o,c;if(u.val(""),f.val(""),h.val(""),typeof r!="undefined"&&r.removeAll(),i.removeClass("opened"),i.destinyLoader("stop"),typeof e.topicId=="undefined"){typeof e.groupOwnerId!="undefined"?typeof t!=null&&t.settings.forumType===Globals.ForumTypeEnum.Group||typeof n!=null&&n.settings.forumType===Globals.ForumTypeEnum.Group?Bnet.Site.PageController.Instance.stateChange("/"+Localizer.CurrentCultureName+"/Groups/Post?groupId="+e.groupOwnerId+"&postId="+e.postId+"&sort=0&page=0"):Bnet.Site.PageController.Instance.stateChange("/"+Localizer.CurrentCultureName+"/ClanV2/Post?groupId="+e.groupOwnerId+"&postId="+e.postId+"&sort=0&page=0"):Bnet.Site.PageController.Instance.stateChange("/"+Localizer.CurrentCultureName+"/Forums/Post/"+e.postId);return}if(n){u.val("");h.val("");f.val("");i.css("height","");i.removeClass("open");i.find("container_checkbox").addClass("hide");i.find(".error").remove();var s=e.parentPostId,a=e.postId,l=e.topicId;l==s||$(".replies.first.block[data-postId='"+s+"']").length?n.settings.sort==1?$.get(n.GetPostContainerUrl(e.postId,{forumType:n.settings.forumType,groupId:n.settings.groupId}),function(t){n.AddFirstLevelReplies(t,!1)}):$.get(n.GetPostContainerUrl(e.postId,{forumType:n.settings.forumType,groupId:n.settings.groupId}),function(t){n.AddFirstLevelReplies(t,!0)}):(c=0,o=$("ul.replies[data-postId='"+s+"']"),o.next("div").find(".btn_next").length?(c=o.next("div").find(".btn_next").eq(0).attr("data-page"),o.next("div:has(a)").remove(),$.get(n.GetPostContainerUrl(e.postId,{page:n.settings.page,forumType:n.settings.forumType}),function(t){n.AddInnerLevelReplies(e.parentPostId,t)})):($actualParentPost=$("li[data-postId='"+e.actualParentPostId+"']"),$actualParentPost.closest(".replies").hasClass("first")?($(".replies[data-postId="+e.actualParentPostId+"]").prev(".btn_more").not(".on").click(),$.get(n.GetPostContainerUrl(e.postId,{page:n.settings.page,forumType:n.settings.forumType}),function(t){n.AddInnerLevelReply(e.actualParentPostId,t,!0)})):$.get(n.GetPostContainerUrl(e.postId,{forumType:n.settings.forumType}),function(t){n.InsertInnerLevelAfterParent(e.actualParentPostId,t)}),$(".replies[data-postId="+e.parentPostId+"]").prev(".btn_more").find("span span").text(parseInt($(".replies[data-postId="+e.parentPostId+"]").prev(".btn_more").find("span span").text(),10)+1+" Replies")))}},function(n){i.destinyLoader("stop");var r,t;switch(n.errorCode){case 584:Bnet.Utilities.Modals.Alert(n);$("#topicTagCategory").addClass("selectCategoryError");$(".btn_openCreateNewTopic").css("opacity","0.2");break;case 500:case 527:t=f;break;case 501:t=u;break;case 535:t=h;break;case 28:switch(n.messageData.ValidationFieldName.toLowerCase()){case Localizer.Validationproperties.subject.toLowerCase():t=u;break;case Localizer.Validationproperties.body.toLowerCase():t=f;break;case Localizer.Validationproperties.urllinkorimage.toLowerCase():t=$mediaLink}break;case 502:case 503:case 504:case 505:case 506:case 507:case 508:case 509:case 516:case 528:case 529:case 530:case 532:case 24:default:Bnet.Utilities.Modals.Alert(n)}typeof t!="undefined"&&(r=$('<span class="error s">'+n.errorMessage+" ("+n.errorCode+")<\/span>"),t.focus().before(r),r.data("for",t))})};Forums.prototype.AddModMovedMessage=function(n,t,i){var r="";if(t!=="")switch(t){case"Destiny":r="Moderator edit: This thread has been moved to the #Destiny forum. See [url=https://www.bungie.net/en/Forum/Post/140391030/0/0]Cozmo's thread[/url] for more information about the #Destiny tag and its uses.\r\nFeel free to private message the moderator who moved your post, link to topic, for further clarification about why this topic was moved.";break;case"Recruitment":r=i==="Clan"?"Moderator edit: This thread has been moved to the #Recruitment forum. See [url=https://www.bungie.net/en/Forum/Post/140393652/0/0]Cozmo's thread[/url] for more information about the #Recruitment tag and its Destiny LFG uses. Adding on the #Clans tag, too, where you can search for clans and other players in the community can find your clan. Good luck!\r\nFeel free to private message the moderator who moved your post, link to topic, for further clarification about why this topic was moved.":"Moderator edit: This thread has been moved to the #Recruitment forum. See [url=https://www.bungie.net/en/Forum/Post/140393652/0/0]Cozmo's thread[/url] for more information about the #Recruitment tag and its Destiny LFG uses. Good luck!\r\nFeel free to private message the moderator who moved your post, link to topic, for further clarification about why this topic was moved.";break;case"Help":r="Moderator edit: This thread has been moved to the #Help forum where you can find answers and troubleshoot any Destiny in-game/bungie.net/companion app issues, courtesy of other helpful players and Mentors.\r\nFeel free to private message the moderator who moved your post, link to topic, for further clarification about why this topic was moved.";break;case"Feedback":r="Moderator edit: This thread has been moved to #Feedback forum so that other Destiny players can weigh in. See [url=https://www.bungie.net/en/Forum/Post/139533839/0/0]Cozmo's thread[/url] for more information about the #Feedback tag and its uses.\r\nFeel free to private message the moderator who moved your post, link to topic for further clarification about why this topic was moved.";break;case"Gaming":r="Moderator edit: This thread has been moved to the #Gaming forum where you can discuss games unrelated to Destiny or Bungie's games. See [url=https://www.bungie.net/en/Forum/Post/140396851/0/0]Cozmo's thread[/url] for more information about the #Gaming tag and its uses.\r\nFeel free to private message the moderator who moved your post, link to topic, for further clarification about why this topic was moved.";break;case"OffTopic":r="Moderator edit: This thread has been moved to #Offtopic, a more appropriate forum for this offtopic discussion.\r\nFeel free to private message the moderator who moved your post, link to topic, for further clarification about why this topic was moved.";break;case"Bungie":default:r="Moderator edit: This thread has been updated with tags that are more appropriate.\r\nFeel free to private message the moderator who moved your post, link to topic, for further clarification about why this topic was moved."}else i!==""&&(r="Moderator edit: This thread has been updated with tags that are more appropriate.\r\nFeel free to private message the moderator who moved your post, link to topic, for further clarification about why this topic was moved.");return n+(r!==""?"\r\n[spoiler]"+r+"[/spoiler]":"")};Forums.prototype.UpdateSubCategoriesSelect=function(n,t){var f,i,u,r;if(n.find(":selected").val()!=="0")if(f=n.find(":selected").val().replace("#",""),i=tagTrees[f],typeof i!="undefined"){for(u="",r=0;r<i.length;r++){var e=i[r].replace("#",""),o=Localizer.Officialforumtags[subTagDisplayKeys[e]],s='<option value="'+e+'">'+o+"<\/option>";u+=s}t.find("option").not("[value=0]").remove();t.prop("disabled",!1).closest(".disabled").removeClass("disabled");t.find("option[value=0]").after(u)}else t.prop("disabled",!0).find("option").not("[value=0]").remove(),t.closest(".select_styled").addClass("disabled");else t.prop("disabled",!0).find("option").not("[value=0]").remove(),t.closest(".select_styled").addClass("disabled")};Forums.prototype.SetDefaultValuesForCategorySelects=function(n){var h=n.find(".topicTagCategory"),c=n.find(".topicTagSubCategory"),t=h.attr("data-originalvalue"),i=c.attr("data-originalvalue"),u=!1,e,f,r,o,s;if(t==="Recruitment")for(u=!0,e=Bnet.Site.getPageDataOrDefault("recruitmentConfig",{}),f=i.split(" "),r=0;r<f.length;r++)if(o=f[r],typeof e.PlatformTags!="undefined"&&e.PlatformTags[o]!=="undefined"){t=o;i=f[r+1];break}t!=""&&(u?n.find("#recruitTeam_platform option[value="+t+"]").prop("selected",!0):n.find(".topicTagCategory option[value="+t+"]").prop("selected",!0),u||this.UpdateSubCategoriesSelect(n.find(".topicTagCategory"),n.find(".topicTagSubCategory")),i!=""&&(s=u?n.find("#recruitTeam_activity option[value="+i+"]"):n.find(".topicTagSubCategory option[value="+i+"]"),s.length&&s.prop("selected",!0)))};Forums.prototype.SplitUpTags=function(n){var u=[],i="",l="",o=-1,s=-1,r,a,f,h,t,e,c;if(typeof n!="undefined"&&n.length>0)for(r=0,a=n.length;r<a;r++){if(f=n[r].replace("#",""),u.push(f),typeof OfficialTags!="undefined")for(t=0,e=OfficialTags.length;t<e;t++)if(h=OfficialTags[t],h.toLowerCase()==f.toLowerCase().replace("#","")){i=h;o=r;break}if(typeof tagTrees!="undefined"&&i!==""&&typeof tagTrees[i]!="undefined")for(t=0,e=tagTrees[i].length;t<e;t++)if(c=tagTrees[i][t],c.toLowerCase().replace("#","")==f.toLowerCase()){l=c.replace("#","");s=r;break}}return o>-1&&u.splice(o),s>-1&&u.splice(s),{main:i,sub:l,nonCategory:u}};Forums.prototype.Liked=function(n,t){this.RatingUndone(n);var i=$(".btn_like[data-postId='"+n+"']").siblings(".postScore");i.text(t);$(".btn_like[data-postId='"+n+"']").addClass("liked");$(".btn_dislike[data-postId='"+n+"']").removeClass("disliked")};Forums.prototype.DisLiked=function(n,t){this.RatingUndone(n);var i=$(".btn_dislike[data-postId='"+n+"']").siblings(".postScore");i.text(t);$(".btn_dislike[data-postId='"+n+"']").addClass("disliked");$(".btn_like[data-postId='"+n+"']").removeClass("liked")};Forums.prototype.RatingUndone=function(n){$(".btn_dislike[data-postId='"+n+"']").removeClass("disliked");$(".btn_like[data-postId='"+n+"']").removeClass("liked")};Forums.prototype.AddFireteamMember=function(n,t){n.attr({"data-membershipid":t.membershipId,"data-uniquename":t.uniqueName,"data-displayname":t.displayName});n.addClass("filled");viewModels.loggedInUserModel().user.membershipId()==t.membershipId?(n.addClass("selected"),n.find(".barSelectorText p").after('<a class="btn_leaveFireteam" data-topicid="'+n.closest("#forumPost").attr("data-postid")+'" data-membershipid="'+viewModels.loggedInUserModel().user.membershipId()+'">'+Localizer.Forums.leavefireteam+"<\/a>")):n.find(".barSelectorText p").after('<a data-membershipid="'+t.membershipId+'" data-topicid="'+n.closest("#forumPost").attr("data-postid")+'" class="btn_removeFromFireteam">'+Localizer.Forums.remove+"<\/a>");n.find(".barSelectorText p").html(Localizer.Format(Localizer.Forums.spotfilledbyuseruser,{user:t.displayName,userLink:PageUrls.profilePage+"?id="+t.membershipId}));var i='<a style="background-image:url('+t.profilePicturePath+');" class="recruitOption barSelectorOption" href="'+PageUrls.profilePage+"?id="+t.membershipId+'"><span style="" class="fa fa-2x barSelectorOptionIcon"><\/span><\/a>';n.find(".recruitOption").replaceWith(i);this.ChangeRecruitmentPostState()};Forums.prototype.ChangeRecruitmentPostState=function(){var n=$(".recruitRow.filled").eq(0).hasClass("selected");n&&($(".recruitmentInfo").remove(),$(".recruitRow.filled").length>1&&$(".recruitmentContainer").before('<div class="recruitmentInfo"><p>'+Localizer.Forums.yourfireteamisfullplease+' <a data-topicid="'+$(".recruitmentContainer").attr("data-topicid")+'" class="btn_approvefireteam" title="'+Localizer.Forums.approvefireteam+'">'+Localizer.Forums.approvefireteam+"<\/a><\/p><\/div>"))};Forums.prototype.ActivateEditPreviewTab=function(n){var t=n.closest(".postCreation"),i=n.attr("data-tab");i=="Preview"&&this.UpdatePreviewPanel(t);t.find(".tab.active, .tab-contents.active").removeClass("active");t.find(".tab[data-tab='"+i+"'], .tab-contents[data-tab='"+i+"']").addClass("active")};Forums.prototype.UpdatePreviewPanel=function(n){var r=n.find(".textarea_body"),t=r.val(),i;t=Bnet.Utilities.Html.encodeHTML(t);t=Bnet.Utilities.Parse.parseBBCode(t,!0,!0,[],!0);t=Bnet.Utilities.Url.correctExternalLinks(t,!0);i=n.find(".preview-content");i.html(t);i.height(r.height());n.find(".preview-body").addClass("postBody")};Forums.prototype.AddEventListeners=function(){var n=this;$("#mainContent").off(".forum");$(".recruitmentSideNav").off(".forum");$("#mainContent").on("change.forum",".topicTagCategory",function(){var t=$(this),i=t.closest(".postCreation"),r=i.find(".topicTagSubCategory");n.UpdateSubCategoriesSelect(t,r)});$("#mainContent").on("click.forum",".trigger_dpsMenu",function(){var n=$(this).next(".collapsible");n.hasClass("opened")?n.removeClass("opened"):n.addClass("opened")});$("#mainContent").on("click.forum",".btn_like",function(t){if(t.preventDefault(),!SignIn.notSignedIn()){var i=$(this),r=i.attr("data-postId");i.hasClass("liked")||bungieNetPlatform.forumService.RatePost(r,100,function(t){n.Liked(r,t)},function(n){Bnet.Utilities.Modals.Alert(n)})}});$("#mainContent").on("click.forum",".btn_dislike",function(t){if(t.preventDefault(),!SignIn.notSignedIn()){var i=$(this),r=i.attr("data-postId");i.hasClass("disliked")||bungieNetPlatform.forumService.RatePost(r,0,function(t){n.DisLiked(r,t)},function(n){Bnet.Utilities.Modals.Alert(n)})}});$("#mainContent").on("click.forum",".btn_addMoreOptions",function(n){n.preventDefault();var t=$(this);t.hasClass("lessOptions")?(t.text(Localizer.Forums.addmoreanswers).removeClass("lessOptions"),t.next(".container_morepollanswers").addClass("hide"),t.next(".container_morepollanswers").find("input").val("")):(t.text(Localizer.Forums.RemoveAdditionalAnswers).addClass("lessOptions"),t.next(".container_morepollanswers").removeClass("hide"))});$("#mainContent").on("change.forum",".check_poll input",function(){var t=$(this),n=t.closest(".postCreation");t.is(":checked")?(n.find(".text_subject").find("input").prop("placeholder",Localizer.Forums.pollquestion),n.find(".check_question").addClass("hide"),n.find(".container_pollanswers").removeClass("hide"),n.find(".check_recruit").addClass("hide")):(n.find(".text_subject").find("input").prop("placeholder","Title"),n.find(".check_question").removeClass("hide"),n.find(".check_recruit").removeClass("hide"),n.find(".container_pollanswers").addClass("hide"))});$("#mainContent").on("change.forum",".check_question input",function(){var t=$(this),n=t.closest(".postCreation");t.is(":checked")?(n.find(".check_poll").addClass("hide"),n.find(".check_recruit").addClass("hide")):(n.find(".check_poll").removeClass("hide"),n.find(".check_recruit").removeClass("hide"))});$("#mainContent").on("click.forum",".forumContent .spoiler",function(){n.darkThemePage.openCloseContainer($(this))});$("#mainContent").on("click.forum",".forumHeader .btn_followTag",function(){var n=$(this).data("tag");$(".container_followedTagList").hasClass("opened")||$(".container_followedTagsList .expandIcon").trigger("click",{tag:n});$(this).remove()});$("#mainContent").on("click.forumPost",".recruitRow",function(t){var i=$(this);$(t.target).is("a")||i.hasClass("selected")||i.hasClass("filled")||(t.stopImmediatePropagation(),t.preventDefault(),Bnet.Utilities.Modals.Confirm(Localizer.Forums.areyousureyouwanttojoin,Bnet.ConfirmationReason.Warning,function(){var t="";i.closest(".recruitmentContainer").length?t=i.closest(".recruitmentContainer").attr("data-topicid"):i.closest(".showPreview").length&&(t=i.closest(".showPreview").attr("data-postid"));bungieNetPlatform.forumService.JoinFireteamThread(t,function(t){var t=t;n.AddFireteamMember(i.closest(".barSelectorRow"),{displayName:viewModels.loggedInUserModel().user.displayName(),uniqueName:viewModels.loggedInUserModel().user.uniqueName(),membershipId:viewModels.loggedInUserModel().user.membershipId(),profilePicturePath:viewModels.loggedInUserModel().user.profilePicturePath()})},function(n){Bnet.Utilities.Modals.Alert(n)})}))});$(".recruitmentSideNav").on("click.forum",".category",function(n){n.preventDefault();$(n.target).hasClass("fa-pencil")?(n.stopImmediatePropagation(),Bnet.Site.PageController.Instance.stateChange(this.href+"&c=1")):Bnet.Site.PageController.Instance.stateChange(this.href)});$(".recruitmentSideNav").on("click.forum",".btn_openCreateNewTopic",function(){$(".controlBar .btn_openCreateNewTopic").trigger("click")});$(".recruitmentSideNav").on("change.forum",".controlBarFilter",function(t){n.updatePageWithControlBarFilter(t,$(this))})};Topics=function(n){this.defaultSettings={pageNumber:"0",forumType:Globals.ForumTypeEnum.Public,category:Globals.ForumTopicsCategoryFiltersEnum.None,sort:Globals.ForumTopicsSortEnum.Popularity,createdDate:Globals.ForumTopicsQuickDateEnum.LastWeek,groupId:"0",tags:[],languages:"en",activityOnPage:null};this.tagSuggestions={};this.taggle;this.forumsjs;this.recruitmentTimer=!1;n&&$.extend(this.defaultSettings,n);this.settings=this.defaultSettings;this.Initialize()};Topics.prototype.Initialize=function(){var n=this;this.addEventListenersForShowingTopics("ready");this.addEventListenersForShowingTopics("newPageCreated");this.forumsjs=new Forums;n.MakeJSDomChanges();n.AddEventListeners();n.showTheTopicsList();$(".topic.recruitment").length?n.RecruitmentUpdates():n.recruitmentTimer||clearInterval(n.recruitmentTimer);$(document).on("oldPageDestroyed",function(){$(document).off("newPageCreated.forumTopics");$(document).off("newPageCreated.loadtopics")})};Topics.prototype.MakeJSDomChanges=function(){var n,i,r,t;if(window.scrollTo(0,0),this.CheckForDpsSettings(),this.MakeLinkChanges(),$("#ClanAnnouncements").find(".topics li").length&&$("#ClanAnnouncements").find(".topics li").length>3&&$("#ClanAnnouncements").find("btn_olderBlock").length==0){n=$("#ClanAnnouncements");n.find(".topics li:gt(2)").addClass("hide");n.append('<a class="btn_olderBlock">'+Localizer.Actions.loadmore+"<\/a>");n.on("click",".btn_olderBlock",function(t){t.preventDefault();$(this).remove();n.find(".topics li.hide").removeClass("hide")})}for(i=$(".topicsList > .topic"),r=i.length,t=0;t<r;t++)this.SetDatesAndTimes(i.eq(t)),this.JSTheSubjects(i.eq(t))};Topics.prototype.CheckForDpsSettings=function(){var n=this;Modernizr.localstorage&&typeof localStorage.hideDPSIgnored!="undefined"&&localStorage.hideDPSIgnored==="false"&&n.ShowDPSRemoved($(".btn_showDPSIgnored").closest("li"))};Topics.prototype.UpdateSubCategories=function(n,t){var i=t,o,r,f,u,e,s;if(n!=="0")if(o=n.replace("#",""),r=tagTrees[o],typeof r!="undefined"){for(f="",u=0;u<r.length;u++)e=r[u].replace("#",""),s='<option value="'+e+'">'+e+"<\/option>",f+=s;i.find("option").not("[value=0]").remove();i.prop("disabled",!1).closest(".disabled").removeClass("disabled");i.find("option[value=0]").after(f)}else i.prop("disabled",!0).find("option").not("[value=0]").remove(),i.closest(".select_styled").addClass("disabled");else i.prop("disabled",!0).find("option").not("[value=0]").remove(),i.closest(".select_styled").addClass("disabled")};Topics.prototype.RecruitmentUpdates=function(){var n=[];$(".topic.recruitment").each(function(){n.push($(this).attr("data-postid"))});this.recruitmentTimer||(clearTimeout(this.recruitmentTimer),this.recruitmentTimer=setTimeout(function(){bungieNetPlatform.forumService.GetRecruitmentThreadSummaries(n,function(n){for(var t=0,u=n.length;t<u;t++){var f=n[t],i=f.topicId,r=f.playerSlotsRemaining;r==0?$(".topic.recruitment[data-postid="+i+"] .spotsLeft").text(Localizer.Forums.zeropotsleft):r==1?$(".topic.recruitment[data-postid="+i+"] .spotsLeft").text(Localizer.Forums.onespotleft):$(".topic.recruitment[data-postid="+i+"] .spotsLeft").text(Localizer.Format(Localizer.Forums.numberspotsleft,{number:r}))}},function(){})},12e4))};Topics.prototype.MakeLinkChanges=function(){var t=this.GetUrlFromSettings(0),a=$("#rssTopics").attr("href"),i=a.replace(/\&sort\=[^\&]*\&/gi,"&sort="+this.settings.sort+"&"),r,o,s,u,h,v,f,c,y,e,l,n,p;for(i=i.replace(/\&date\=[^\&]*\&/gi,"&date="+this.settings.createdDate+"&"),i=i.replace(/\&category\=[^\&]*\&/gi,"&category="+this.settings.category+"&"),$("#rssTopics").attr("href",i),$("#rssFeedButton").attr("href",i),this.settings.forumType===Globals.ForumTypeEnum.Group&&$(".subnav_clan_clanforum a").attr("href",t),this.settings.forumType===Globals.ForumTypeEnum.Clan&&$(".subnav_clan_allianceforum a").attr("href",t),r=$(".topicsList").next(".pager_prevnext").find("a").not(".disabled"),o=r.length,n=0;n<o;n++)s=r.eq(n).attr("data-page"),r.eq(n).attr("href",this.GetUrlFromSettings(s));for(u=$(".topicsList").siblings(".container_sort").find("[data-sort-value]"),h=u.length,n=0;n<h;n++)v=u.eq(n).attr("data-sort-value"),u.eq(n).attr({href:t,"data-href":t});for(f=$("#forumCategoryFilter").find("[data-href]"),c=f.length,n=0;n<c;n++)y=f.eq(n).attr("value"),f.eq(n).attr("data-href",t);for(e=$("#forumDateFilter").find("[data-href]"),l=e.length,n=0;n<l;n++)p=e.eq(n).attr("value"),e.eq(n).attr("data-href",t)};Topics.prototype.GetUrl=function(n,t,i,r,u,f,e,o){var s="",h="/"+Localizer.CurrentCultureName+"/Forums/Topics",c=e.join("%20");return n===Globals.ForumTypeEnum.Group?h="/"+Localizer.CurrentCultureName+"/Groups/Forum":n===Globals.ForumTypeEnum.Clan&&(h="/"+Localizer.CurrentCultureName+"/ClanV2/Forum"),n===Globals.ForumTypeEnum.Group||n===Globals.ForumTypeEnum.Clan?s=h+"?groupId="+t+"&pNumber="+i+"&tSort="+r+"&tType="+u:n===Globals.ForumTypeEnum.Public&&(s=h+"?pNumber="+i+"&tSort="+r+"&tType="+u+"&d="+f,c!=""&&(s+="&tg="+c),o=o||this.settings.languages,s+="&lang="+o),s};Topics.prototype.SetDatesAndTimes=function(n){var t=new CountUp(n.find(".lastReplied"),".time",{timeSelector:".time",isShortened:!0,timeUnits:{second:Localizer.Time.secondsletter,minute:Localizer.Time.minutesletter,hour:Localizer.Time.hoursletter,day:Localizer.Time.daysletter},pluralUnits:!1})};Topics.prototype.JSTheSubjects=function(n){n.find(".actions").length&&n.closest(".coreForums").length&&n.find("[data-rawSubject]").append(n.find(".actions").detach().html())};Topics.prototype.searchedTagIsFollowed=function(n){return arrayFirstIndexOf(viewModels.myFollowedTagsModel(),function(t){return t.detail.displayName.toLowerCase().replace("#","")==n.toLowerCase().replace("#","")&&t.following.entityType=="Tag"})};Topics.prototype.showTheTopicsList=function(n){$(".containerMain").removeClass("transparent");typeof n!="undefined"&&$(document).off(n+".loadtopics")};Topics.prototype.addEventListenersForShowingTopics=function(n){var t=this;$(document).off(n+".loadtopics");$(document).on(n+".loadtopics",function(){t.showTheTopicsList(n);Utility.parseQueryString(window.location.search).c==="1"&&setTimeout(function(){$(".btn_openCreateNewTopic").click();$("#recruitTeam_activity").length&&$("#recruitTeam_activity").val()!=="0"&&t.updateRecruitmentDropForPlayersNeeded($("#recruitTeam_activity").val())},1)})};Topics.prototype.GetUrlFromSettings=function(n){return this.GetUrl(this.settings.forumType,this.settings.groupId,n,this.settings.sort,this.settings.category,this.settings.createdDate,this.settings.tags,this.settings.languages)};Topics.prototype.PopulatePreviewLink=function(n,t){var r=t,i,e;if(n.urlLinkOrImage&&n.urlLinkOrImage!==""){if(i=bungieNetPlatform.assetRenderer.renderAsset({path:n.urlLinkOrImage,width:"100%",fixedRatioHeight:Modernizr.mobile&&!Modernizr.ipad?6750/16+"px":4500/16+"px"}),i){var s=!1,o=!1,u=!1,f="";i.indexOf("<iframe")>=0||i.indexOf("TwitchPlayer.swf")>=0?(u=!0,f="video"):i.indexOf("<a")>=0?(s=!0,f="link"):i.indexOf("<img")>=0&&(o=!0,f="image");i=i.replace("class='externalLink'","target='_blank'");$(i).find("script").length&&(i="");u&&r.addClass("video");(u||o)&&(e=!1,viewModels.loggedInUserModelIsLoaded()&&viewModels.loggedInUserModel().user.membershipId()!=n.authorMembershipId&&(r.closest(".followedAuthor").length!==0||viewModels.loggedInUserModel().adultMode()||(e=!0)),e&&(i=Localizer.Forums.mediacontentishiddendue));r.append(i)}}else r.remove()};Topics.prototype.constructPoll=function(n,t){for(var f,u,r="",i=0;i<n.polls.length;i++)if(n.polls[i].topicId===t.postId){u=n.polls[i];break}if(typeof u!="undefined"){for(r='<div class="pollContainer">',f=u.results,i=0;i<f.length;i++)r+='<div class="pollRow cf"><div class="pollOption"><span style="" class="fa fa-2x pollOptionIcon"><\/span><\/div><div class="pollText"><p>'+f[i].answerText+'<\/p><\/div><div class="pollResult"><\/div><\/div>';r+="<\/div>"}return r};Topics.prototype.constructFireteam=function(n){for(var r,t,u="",i=-1;i<n.recruitmentDetails[0].playerSlotsTotal;i++)r="",t={},t=i===-1?n.authors[0]:n.recruitmentDetails[0].Fireteam[i],typeof t!="undefined"&&(r+=" filled",t.membershipId===viewModels.loggedInUserModel().user.membershipId()&&(r+=" selected")),u+='<div class="recruitRow barSelectorRow recruit_'+i+" cf "+r+'"><div class="recruitOption barSelectorOption" style="'+(typeof t!="undefined"?"background-image:url("+t.profilePicturePath+");":"")+'"><span class="fa fa-2x barSelectorOptionIcon" style=""><\/span><\/div><div class="barSelectorText"><p>'+(typeof t!="undefined"?Localizer.Format(Localizer.Forums.spotfilledbyuseruser,{userLink:PageUrls.profilePage+"/"+t.membershipId,user:t.displayName}):Localizer.Forums.spotopen)+'<\/p><\/div><div class="barSelectorResult" style="width:calc('+(typeof t!="undefined"?"100%":"0%")+' - 35px);"><\/div><\/div>';return u};Topics.prototype.constructTopicPreview=function(n,t,i,r,u){var f=n.body||"";return'<div class="forumPost postPreview '+(r!==""?"showingResults":"")+'" id=""><a href="" class="btn_close ir"><span class="fa fa-times"><\/span><\/a>'+t+i+r+'<div class="post_urlLinkOrImage"><\/div><div class="postBody"><div class="postBodyContent post_body">'+bungieNetPlatform.linkHelper.injectLinks(Bnet.Utilities.Parse.parseBBCode(f.replace(/(?:\r\n|\r|\n)/g,"<br />")),!0,!0)+'<\/div><div class="threadControls"><a href="'+u+'" class="btn_olderBlock">'+Localizer.Forums.viewentiretopic+" ("+n.replyCount+" "+Localizer.Forums.replies+')<\/a><a class="trigger_mute" data-postid="'+n.postId+'" data-membershipid="'+n.authorMembershipId+'" data-report="true" title="'+Localizer.Actions.report+'">'+Localizer.Actions.report+"<\/a><\/div>"+this.modCategorySwitch(n)+"<\/div><\/div>"};Topics.prototype.modCategorySwitch=function(n){var i="",t,u,r,e,f;if(viewModels.canEditAnyPost()){for(t=this.forumsjs.SplitUpTags(n.tags),i='<div class="threadControls modCategorySwitch" data-body="'+n.body+'" data-tags="'+(typeof t.noHashTags!="undefined"?t.noHashTags.join(","):"")+'"><div class="select_styled"><select id="topicTagCategory_'+n.postId+'" class="topicTagCategory" data-originalvalue="'+t.main+'"><option value="0">'+Localizer.Forums.forumcategory+"<\/option>",u="",r=0,e=OfficialTags.length;r<e;r++)f=OfficialTags[r],u+='<option value="'+f+'">'+Localizer.Officialforumtags[f.toLowerCase()+"title"]+"<\/option>";i+=u;i+='<\/select><\/div><div class="select_styled disabled"><select id="topicTagSubCategory_'+n.postId+'" class="topicTagSubCategory" disabled data-originalvalue="'+t.sub+'"><option value="0">'+Localizer.Forums.forumsubcategory+'<\/option><\/select><\/div><a class="btn_moveCategory" data-postid="'+n.postId+'">Move<\/a><\/div>'}return i};Topics.prototype.getTopicAuthor=function(n,t){for(var r,u={},i=0,f=n.authors.length;i<f;i++)r=n.authors[i],r.membershipId===t.authorMembershipId&&(u=r);return u};Topics.prototype.constructTopicAuthorForReporter=function(n,t){return'<div class="threadAuthor"><a class="authorAvatar avatar"><img src="'+Utility.ContentVersioned(n.profilePicturePath)+'"><\/a><div class="threadAuthorDetails"><a class="authorDisplayName">'+(t!==""?t:n.displayName)+"<\/a><\/div><\/div>"};Topics.prototype.showTopicPreview=function(n,t){var i=this,r=t;r.hasClass("loading")||(r.addClass("loading"),r.destinyLoader({startOnInit:!0,size:55}),bungieNetPlatform.forumService.GetPostAndParent(n,!0,function(n){var u=n.results[0],s=i.getTopicAuthor(n,u),h="",f,e,c,o;u.category===Globals.ForumPostCategoryEnums.Poll&&(h=i.constructPoll(n,u));f="";u.category|Globals.ForumPostCategoryEnums.Recruitment&&typeof n.recruitmentDetails!="undefined"&&typeof n.recruitmentDetails[0]!="undefined"&&(f=i.constructFireteam(n));e="";typeof u.editorMembershipId!="undefined"&&u.authorMembershipId!==u.editorMembershipId&&(e=Localizer.Format(Localizer.Forums.edited,{user:s.displayName}));c=PageUrls.defaultPostPage+"/"+u.postId;o="";viewModels.isReporter()&&(o=i.constructTopicAuthorForReporter(s,e));r.append(i.constructTopicPreview(u,o,h,f,c));r.removeClass("loading");r.destinyLoader("stop");t.on("click",".btn_close",function(n){n.preventDefault();t.find(".forumPost").remove();t.removeClass("showPreview")});i.PopulatePreviewLink(u,t.find(".post_urlLinkOrImage"))},function(){Utility.alert("Error loading preview.")}))};Topics.prototype.showPreview=function(n){var t="",u,i,r;if(n.metadata.length){for(t='<ul class="PollResults">',u=n.metadata.length,i=0;i<u;i++)t+='<li class="cf"><a  class="radio"><\/a><label><span class="text">'+n.metadata[i]+"<\/span><\/label><\/li>";t+="<\/ul>"}r='<div class="forumPost"><article id="post" class="noReplies"><div class="post"><a  class="avatar"><img src="'+Utility.ContentVersioned(viewModels.loggedInUserModel().user.profilePicturePath())+'" alt="avatar" /><\/a><div class="content"><h1 class="author"><a >'+viewModels.loggedInUserModel().user.displayName()+"<\/a><\/h1>"+t+'<div class="post_urlLinkOrImage"><\/div><div class="body post_body cf">'+bungieNetPlatform.linkHelper.injectLinks(Bnet.Utilities.Parse.parseBBCode(Utility.encodeHTML(n.body),!0,!0))+"<\/div><\/div><\/div><\/article><\/div>";r+='<p><a  class="btn_blue btn_previewGood" data-postId="'+n.postId+'">'+Localizer.Actions.submit+'<\/a><a  class="btn_blue btn_previewBad">'+Localizer.Forums.cancel+"<\/a><\/p>";$("#alert_noClose").addClass("previewPost");Utility.alert_noClose(r);$(".btn_previewGood").on("click.forumTopics",function(n){n.preventDefault();customAlert_forActions.closeLightbox();var t=$(this).attr("data-postId");t==0?$("#createTopicButton").click():$(".opened .btn_reply a[data-postId="+t+"]").click()});$(".btn_previewBad").on("click.forumTopics",function(n){n.preventDefault();customAlert_forActions.closeLightbox()});this.PopulatePreviewLink(n,$(".alert.previewPost .post_urlLinkOrImage"))};Topics.prototype.HandleSortClick=function(n,t){var i=$(t)};Topics.prototype.OpenCreateTopic=function(){var n,t;$(".recruitSearchForm.open").length&&$(".btn_openrecruitfinder").click();n=$(".container_create");n.hasClass("open")?this.ResetCreateTopic(n):(n.addClass("open"),this.settings.forumType===Globals.ForumTypeEnum.Public&&$("#check_recruit").length&&($("#check_recruit").is(":checked")||$("[for=check_recruit]").click(),this.settings.activityOnPage!==null&&($("#recruitTeam_activity").find("option[data-tag="+this.settings.activityOnPage+"]").prop("selected",!0),this.updateRecruitmentDropForPlayersNeeded($("#recruitTeam_activity").val()))),typeof this.taggle=="undefined"&&$("#CreatePostTagEntry").length&&(this.taggle=new Taggle("CreatePostTagEntry",{placeholder:Localizer.Forums.entertags}),$("#CreatePostTagEntry").find(".taggle_input").removeAttr("tabindex")),this.settings.tags.length&&this.forumsjs.SetDefaultValuesForCategorySelects(n),n.find(".text_subject input").focus(),Bnet.Site.getPageData("UserSelectsPostLocale")&&(t=this.forumsjs.GetPreviousPostingLocale(),t&&($postingLanguage=n.find("#posting_language"),$postingLanguage.length>0&&$postingLanguage.val(t))))};Topics.prototype.ResetCreateTopic=function(){var n=$("#TopicsPage .postCreation, #ClanForum .postCreation");n.removeClass("open");n.find("#topicSubject").val("");n.find("#topicText").val("");n.find("#topicLinkOrMeta").val("");n.find("#topicTags").val("");n.find("#topicTagCategory").val("0");n.find(".error").remove()};Topics.prototype.HideDPSRemoved=function(n){n.addClass("on");$(".topicsList ").addClass("dpsremove");Modernizr.localstorage&&(localStorage.hideDPSIgnored=!0)};Topics.prototype.ShowDPSRemoved=function(n){n.removeClass("on");$(".topicsList").removeClass("dpsremove");Modernizr.localstorage&&(localStorage.hideDPSIgnored=!1)};Topics.prototype.updatePageWithControlBarFilter=function(n,t){switch(t.attr("id")){case"forumCategoryFilter":this.settings.category=t.val();break;case"forumSort":this.settings.sort=t.find(":selected").attr("data-sort-value");break;case"forumDateFilter":this.settings.createdDate=t.val();break;case"recruitFinder_platform":case"recruitFinder_activity":case"recruitFinder_newbie":case"recruitFinder_language":Bnet.Site.PageController.Instance.stateChange(t.find(":selected").attr("data-href"))}Bnet.Site.PageController.Instance.stateChange(this.GetUrlFromSettings(0))};Topics.prototype.AddEventListeners=function(){var n=this;$("#TopicsPage, #ClanForum, #ClanAnnouncements, .recruitmentSideNav").off(".forumTopics");$("#TopicsPage, #ClanForum, #ClanAnnouncements").on("click.forumTopics",".topicsList .threadInfoBox",function(t){var f=$(this),i=f.closest(".topic"),r=$(t.target),u;r.is("a")||r.closest(".container_thumbs").length!==0||r.closest(".dps").length!==0||r.closest(".container_voting").length!==0||(t.preventDefault(),i.hasClass("showPreview")?(i.removeClass("showPreview"),i.find(".btn_close"),i.find(".forumPost").remove()):(i.addClass("showPreview"),u=i.attr("data-postId"),n.showTopicPreview(u,i)))});$("#TopicsPage, #ClanForum").on("click.forumTopics",".postPreview",function(n){var t=$(this);$(n.target).is("a")||t.prev("article").find("a.title").click()});$("#TopicsPage, #ClanForum").on("click.forumTopics",".mediaPreview",function(n){var t,i,r,u;n.preventDefault();t=$(this);i="";t.hasClass("youtube")?(r=$(window).width()*.7,u=r*9/16,i=$(Utility.youtubeUrlToIframe(t.attr("data-media"),r,u))):t.hasClass("image")&&(i='<img class="img_lightbox" src="'+t.attr("data-media")+'" alt="'+t.attr("data-media")+'">');Utility.showMediaLightBox(i)});$("#TopicsPage, #ClanForum").on("click.forumTopics",".btn_showDPSIgnored",function(t){t.stopImmediatePropagation();t.preventDefault();var i=$(this);i.hasClass("on")?n.ShowDPSRemoved(i):n.HideDPSRemoved(i)});$("#TopicsPage, #ClanForum").on("change.forumTopics",".controlBarFilter",function(t){n.updatePageWithControlBarFilter(t,$(this))});$("#TopicsPage, #ClanForum").on("click.forumTopics",".container_sort .sort li a",function(t){$(this).closest(".sort").hasClass("dpsfilter")||n.HandleSortClick(t,this)});$("#TopicsPage, #ClanForum").on("change.forumTopics",".topicTagCategory",function(){var t=$(this),i=t.find(":selected").val(),r=t.closest(".select_styled").siblings(".select_styled").find(".topicTagSubCategory");n.UpdateSubCategories(i,r)});$("#TopicsPage, #ClanForum").on("click.forumTopics",".container_tags .tag",function(n){n.preventDefault();$(this).remove()});$("div.dps[data-postid] input[type=checkbox]").change(function(){$(this).parent().attr("data-dpsedited","1")});$("div.dps[data-postid] input[type=text]").change(function(){$(this).parent().attr("data-dpsedited","1")});$("#TopicsPage, #ClanForum").on("click.forumTopics",".btn_dpsSaveAll",function(n){var t,i,r;(n.preventDefault(),SignIn.notSignedIn())||(t=$(".dps[data-dpsedited=1]"),i={},t.each(function(){var n=0,t=$(this),f=t.attr("data-postid"),r,u;t.find("input:checked").each(function(){n=n|parseInt($(this).val())});r=t.find("input[type=text]").val();(n!==0||r!=="")&&(u={playerSupportFlags:n,playerSupportMetadata:r},i[f]=u)}),r=new BulkEditPostRequest(null,i),bungieNetPlatform.adminService.BulkEditPost(r,function(n){t.attr("data-dpsedited","0");Utility.alert(n+" records updated, changes will take effect shortly.")},function(n){Utility.alert(n.errorMessage)}))});$("#TopicsPage, #ClanForum").on("click.forumTopics",".btn_dpsSave",function(n){var u,f;if(n.preventDefault(),!SignIn.notSignedIn()){var r=$(this).attr("data-postId"),i=$(this).parent(),t=0;i.find("input:checked").each(function(){t=t|parseInt($(this).val())});u=i.find("input[type=text]").val();f={playerSupportFlags:t,playerSupportMetadata:u};bungieNetPlatform.forumService.EditPost(f,r,function(){var n=$(".topics > [data-postId="+r+"]");t>0?(n.addClass("dpshide"),t&1?n.addClass("dpsremove"):n.removeClass("dpsremove")):n.removeClass("dpshide dpsremove");i.attr("data-dpsedited","0");Utility.alert("Player Support Information Saved.")},function(n){Utility.alert(n.errorMessage)})}});$("#TopicsPage").on("click.forumTopics",".btn_moveCategory",function(t){var o;if(t.preventDefault(),!SignIn.notSignedIn()){var r=$(this),s=r.attr("data-postid"),i=r.closest(".modCategorySwitch"),u=i.attr("data-body"),f=i.find(".topicTagCategory").find(":selected").val(),e=i.find(".topicTagSubCategory").find(":selected").val()!="0"?i.find(".topicTagSubCategory").find(":selected").val():"",h=(e!==""?e+",":"")+i.attr("data-tags");u=n.forumsjs.AddModMovedMessage(u,f,e);o={body:u,tagInput:h,tagCategory:f==0?null:f};bungieNetPlatform.forumService.EditPost(o,s,function(t){Utility.alert("Topic moved.");var f=n.forumsjs.SplitUpTags(t.tags),i=Utility.parseQueryString(window.location.search),u={};typeof i.tg!="undefined"&&i.tg!==""&&(u=n.forumsjs.SplitUpTags(i.tg.split(" ")),u!=f&&r.closest(".topic").remove())},function(n){Utility.alert(n.errorMessage)})}});$("#TopicsPage, #ClanForum").on("click.forumTopics",".btn_openCreateNewTopic",function(t){(t.preventDefault(),SignIn.notSignedIn())||n.OpenCreateTopic()});$("#TopicsPage, #ClanForum").on("click.forumTopics",".tab",function(t){t.preventDefault();var i=$(t.currentTarget);n.forumsjs.ActivateEditPreviewTab(i)});$("#TopicsPage, #ClanForum").on("click.forumTopics","#previewTopicButton",function(t){var i,r;if(t.preventDefault(),!SignIn.notSignedIn()){var u=$("#topicSubject"),f=$("#topicText"),e=$("#topicLinkOrMeta");if($(".s.error").remove(),i=u.add(f),i=i.add(e),r=Bnet.Utilities.Validation.getErrors(i),r.length){Bnet.Utilities.Validation.renderErrors(r);return}var c=u.val(),o=f.val(),s=e.val(),h={postId:$(this).is("[data-postId]")?$(this).data("postId"):"0",body:o,urlLinkOrImage:s,metadata:[]};n.showPreview(h)}});$("#modal-forum-create, #TopicsPage, #ClanForum").on("click.forumTopics","#createTopicButton, #createFireteamButton",function(t){if(t.preventDefault(),!SignIn.notSignedIn()){var i=$(this),r=i.closest(".postCreation");i.closest(".modal-after-content").length&&(r=$("#modal-forum-create").find(".postCreation"));n.forumsjs.PostCreation(null,n,r,n.taggle)}});$("#TopicsPage, #ClanForum").on("click.forumTopics",".controlBarItem .btn_cancelPost",function(t){t.preventDefault();n.OpenCreateTopic()});$("#TopicsPage, #ClanForum").on("click.forumTopics",".container_create .btn_cancel",function(n){n.preventDefault();var t=$(this).closest(".postCreation");$(".controlBarItem .btn_cancelPost").addClass("hide");$(".btn_openCreateNewTopic.controlBarButton").removeClass("hide");t.removeClass("open").find("input, textarea").val("");t.find("input[type=checkbox]").prop("checked",!1);t.find(".error").remove();t.find(".label_pollanswer input").val("");t.find(".check_question").add(".check_poll").removeClass("hide");t.find(".container_pollanswers").hasClass("hide")||(t.find(".container_pollanswers").addClass("hide"),t.find(".container_morepollanswers").hasClass("hide")||(t.find(".container_morepollanswers").addClass("hide"),t.find(".container_pollanswers a").removeClass("hide")))});$("#TopicsPage, #ClanForum").on("click.forumTopics",".btn_expandMuted",function(n){n.preventDefault();var t=$(this);t.parent().hasClass("expanded")?(t.parent().removeClass("expanded"),t.text(Localizer.Forums.hiddenpost)):(t.parent().addClass("expanded"),t.text(Localizer.Forums.hiddenpost))});$("#TopicsPage, #ClanForum").on("click.forumTopics",".topics.muted",function(n){n.preventDefault();var t=$(this);t.length&&(t.hasClass("expanded")?(t.removeClass("expanded"),t.children("li").eq(0).find("a").text(Localizer.Forums.topicswithtaghidden)):(t.addClass("expanded"),t.children("li").eq(0).find("a").text(Localizer.Forums.topicswithtaghidden)))});$("#TopicsPage, #ClanForum").on("click.forumTopics",".trigger_mute",function(n){var o,i,r,t;if(n.preventDefault(),!SignIn.notSignedIn()){var u=$(this),f=u.closest("li[data-postId]").attr("data-postId"),s=u.closest("li[data-membershipid]").attr("data-membershipid"),e=u.closest(".topics");if(u.hasClass("unmute"))o=new UnignoreItemRequest(null,f,Globals.IgnoredItemType.Post),bungieNetPlatform.ignoreService.UnignoreItem(o,function(){customAlert_forActions.closeLightbox();e.find("li[data-postId="+f+"]").find(".trigger_mute.unmute").removeClass("unmute").attr("title",Localizer.Actions.ignore);e.find("li[data-postId="+f+"]").removeClass("muted").find(".btn_expandMuted").remove()},function(n){customAlert_forActions.closeLightbox();Utility.alert(n.errorMessage)});else{for(i='<div class="container_select"><label for="mute_reason">'+Localizer.Forums.whyreport+"<\/label>",i+='<select id="mute_reason">',r=0;r<IgnoreSettings.length;r++)i+='<option name="mute_reason" value="'+IgnoreSettings[r]+'">'+Localizer.Mute[IgnoreSettings[r]]+"<\/option>";i+="<\/select><\/div>";t='<p><a  class="btn_blue btn_mute" data-postId="'+f+'">'+Localizer.Actions.report+'<\/a><a  class="btn_blue btn_cancel">'+Localizer.Forums.cancel+"<\/a>";viewModels.isReporter()?(i+='<div class="adminIgnoreWarning">'+Localizer.Helptext.adminignorewarning+"<\/div>",t+='<label for="mod_report_select">&nbsp;'+Localizer.Forums.moderatorrequestedpunishment+'&nbsp;<\/label><select id="mod_report_select">',t+='<option value="'+Globals.ModeratorRequestedPunishment.Warning+'" selected="selected">'+Localizer.Forums.moderatorwarn+"<\/option>",t+='<option value="'+Globals.ModeratorRequestedPunishment.SevenDayBan+'">'+Localizer.Forums.moderatorsevendayban+"<\/option>",t+='<option value="'+Globals.ModeratorRequestedPunishment.ThirtyDayBan+'">'+Localizer.Forums.moderatorthirtydayban+"<\/option>",t+='<option value="'+Globals.ModeratorRequestedPunishment.PermanentBan+'">'+Localizer.Forums.moderatorpermanentban+"<\/option>",t+='<option value="'+Globals.ModeratorRequestedPunishment.Unknown+'">'+Localizer.Forums.moderatornopunishment+"<\/option>",t+="<\/select><br />"+Localizer.Forums.moderatorblastban+'&nbsp;<input id="mod_report_blast" type="checkbox" />',t+='<\/p><p class="adminBanHistory">'):i+='<div class="adminIgnoreWarning">'+Localizer.Helptext.userignoretext+"<\/div>";t+="<\/p>";Utility.alert_noClose(i+t);viewModels.isReporter()&&Utility.applyBanHistoryToElement($("#alert_noClose .adminBanHistory"),s);$("#alert_noClose").addClass("alert_mute");$("#alert_noClose .btn_mute").on("click.forumTopics",function(n){n.preventDefault();var i=$(this),t=i.attr("data-postId"),r=$("#mute_reason").val(),u=$("#mod_report_select").val(),f=$("#mod_report_blast").prop("checked"),o=new IgnoreItemRequest(null,t,Globals.IgnoredItemType.Post,"",r,0,0,u,f);bungieNetPlatform.ignoreService.IgnoreItem(o,function(){customAlert_forActions.closeLightbox();e.find("li[data-postId="+t+"]").addClass("muted").addClass("ignored").prepend('<a class="btn_expandMuted" >'+Localizer.Forums.hiddenpost+"<\/a>");e.find("li[data-postId="+t+"]").find(".trigger_mute").addClass("unmute").attr("title",Localizer.Forums.showpost);$("#ignoredTopicReminderBlock").removeClass("hide")},function(n){customAlert_forActions.closeLightbox();Utility.alert(n.errorMessage)})});$("#alert_noClose .btn_cancel").on("click.forumTopics",function(n){n.preventDefault();customAlert_forActions.closeLightbox()})}}});$("#TopicsPage, #ClanForum").on("click.forumTopics",".trigger_delete",function(n){if(n.preventDefault(),!SignIn.notSignedIn()){var t=$(this),i=t.closest(".topics"),r=t.closest("li[data-postId]").attr("data-postId");Utility.alert_noClose("<p>"+Localizer.Forums.areyousureyouwanttodelete+'<\/p><p><a  class="btn_blue btn_delete" data-postId="'+r+'">Delete<\/a><a  class="btn_blue btn_cancel">'+Localizer.Forums.cancel+"<\/a><\/p>");$("#alert_noClose").addClass("alert_delete");$("#alert_noClose .btn_delete").on("click.forumTopics",function(n){n.preventDefault();var r=$(this),t=r.attr("data-postId");bungieNetPlatform.forumService.DeletePost(t,function(){customAlert_forActions.closeLightbox();i.find("li[data-postId="+t+"]").remove()},function(){})});$("#alert_noClose .btn_cancel").on("click.forumTopics",function(n){n.preventDefault();customAlert_forActions.closeLightbox()})}});$("#TopicsPage, #ClanForum").on("change.forumTopics",".check_recruit input",function(){var i=$(this),t=i.closest(".postCreation");i.is(":checked")?(t.find("#topicTagCategory option[value=Recruitment]").prop("selected",!0),t.find(".text_linkOrImage").addClass("hide"),t.find(".check_question").addClass("hide"),t.find(".check_poll").addClass("hide"),t.find(".container_pollanswers").addClass("hide"),t.find(".container_tagEntry").addClass("hide"),t.find(".container_recruitmentform").removeClass("hide")):(t.find("#topicTagCategory option").prop("selected",!1),t.find("#topicTagSubCategory option").prop("selected",!1),n.UpdateSubCategories(t.find("#topicTagCategory").attr("data-originalvalue"),t.find(".topicTagSubCategory")),t.find("#topicTagCategory option[value="+t.find("#topicTagCategory").attr("data-originalvalue")+"]").prop("selected",!0),t.find("#topicTagSubCategory option[value="+t.find("#topicTagSubCategory").attr("data-originalvalue")+"]").prop("selected",!0),t.find(".text_linkOrImage").removeClass("hide"),t.find(".check_question").removeClass("hide"),t.find(".check_poll").removeClass("hide"),t.find(".container_tagEntry").removeClass("hide"),t.find(".container_recruitmentform").addClass("hide"))});$("#TopicsPage, #ClanForum").on("change.forumTopics","#recruitTeam_activity",function(){var t=$(this),i=t.val();n.updateRecruitmentDropForPlayersNeeded(i)});$(".js-language-button").on("click.forum",function(t){n.ShowLangaugeModal(t,$(this))})};Topics.prototype.ShowLangaugeModal=function(){var t=this,i=$($("#language-modal-content").html()),n=new Bnet.ConfirmationModal("language",Bnet.ConfirmationReason.None,i);n.closeOnConfirm=!1;n.afterOpenCallback=function(){var r=t.settings.languages.split(","),i;r.forEach(function(n){var t=new Bnet.UiKit.FormKit.CheckboxItem("language-selector-"+n);t.setChecked(!0)});i=n.modalElement.find(".modal-content .container_checkboxes");i.on("click",function(){var t=n.modalElement.find(".modal-content .errorMessage");t.addClass("errorNotPresent")})};n.confirmCallback=function(){var o=Bnet.UiKit.getKitItems(n.modalElement,Bnet.UiKit.Kits.FormKit,Bnet.UiKit.FormKit.CheckboxItem),r=[],u=!1,i,f,e;o.forEach(function(n){if(n.isChecked){var t=n.getAttribute("data-locale");r.push(t);t==="en"&&(u=!0)}});i=r.join(",");i!==""?(f=i!=t.settings.languages,f&&(t.settings.languages=i,u||t.settings.createdDate!==Globals.ForumTopicsQuickDateEnum.LastWeek&&t.settings.createdDate!==Globals.ForumTopicsQuickDateEnum.LastDay||(t.settings.createdDate=Globals.ForumTopicsQuickDateEnum.LastYear),t.updatePageWithControlBarFilter(null,$(t))),n.close()):(e=n.modalElement.find(".modal-content .errorMessage"),e.removeClass("errorNotPresent"))};n.open()};Topics.prototype.updateRecruitmentDropForPlayersNeeded=function(n){var r=$("#topicSubject"),t=$("#recruitTeam_spots"),u=$("#recruitTeam_activity"),f,i,e;if(n!=="0"&&typeof recruitmentActivities[n]!="undefined"){if((r.val()===""||u.find("option:contains("+r.val()+")").length)&&u.find("[value="+n+"]").length&&r.val(u.find("[value="+n+"]").text()),f=typeof recruitmentActivities[n].maxPlayers!="undefined"?recruitmentActivities[n].maxPlayers:0,f>1)for(t.removeAttr("disabled").parent().removeClass("disabled"),t.find("option").not(":first-child").remove(),i=0;i<f-1;i++)e=i+1,t.append('<option value="'+e+'">'+e+"<\/option>")}else t.prop("disabled","true").parent().addClass("disabled"),t.find("option").not(":first-child").remove()};Topics.prototype.AddTrackEvent=function(n,t,i){i=i||null};Topics.prototype.AddGoogleAnalyticsTracking=function(){var t=this,n=$("#TopicsPage, #ClanForum");n.off(".googleAnalytics");n.on("click.googleAnalytics",".mediaPreview",function(){t.AddTrackEvent("ClickMediaPreview_ForumsPreview",$(this).closest("[data-postId]").attr("data-postId")+"_"+$(this).attr("data-media"))});n.on("click.googleAnalytics",".authorInfo [data-membershipId]",function(){t.AddTrackEvent("ClickUser_ForumsPreview",$(this).closest("[data-postId]").attr("data-postId")+"_"+$(this).attr("data-membershipId"))});n.on("click.googleAnalytics",".btn_like",function(){t.AddTrackEvent("ClickUpVote_ForumsPreview",$(this).closest("[data-postId]").attr("data-postId"))});n.on("click.googleAnalytics",".btn_dislike",function(){t.AddTrackEvent("ClickDownVote_ForumsPreview",$(this).closest("[data-postId]").attr("data-postId"))})}