var SV=window.SV||{};SV.Threadmarks=SV.Threadmarks||{}; (function(c,e,f,g){SV.Threadmarks.Fetcher=XF.Click.newHandler({eventNameSpace:"SVThreadmarkFetcher",options:{fetchurl:""},init:function(){},click:function(a){a.preventDefault();(a=this.options.fetchurl)||console.log("Unable to find data-fetchurl");XF.ajax("POST",a,{},c.proxy(this,"handleAjax"),{skipDefaultSuccess:!0})},handleAjax:function(a){var b=this.$target;"html"in a&&a.html&&"content"in a.html&&(a.html.content?XF.setupHtmlInsert(a.html,function(d,h,k){if(0===d.length)return console.log("Failed to load threadmarks"), !1;d.insertAfter(b);b.remove();return!0}):b.remove())}});SV.Threadmarks.ToggleStorage=XF.extend(XF.ToggleStorage,{__backup:{updateStorage:"svThreadmarks_updateStorage",init:"svThreadmarks_init"},init:function(){this.svThreadmarks_init();var a=this.options,b=XF.ToggleStorageData.get(a.storageContainer,a.storageKey);null!==b&&b!=this.$target.hasClass(a.activeClass)&&XF.ToggleStorageData.remove(a.storageContainer,a.storageKey)},updateStorage:function(){var a=this.options;XF.ToggleStorageData.set(a.storageContainer, a.storageKey,this.$target.hasClass(a.activeClass),2592E3)}});SV.Threadmarks.ThreadmarkListWidth=XF.Element.newHandler({options:{},threadmarks:null,buttonWrapper:null,isOverflowing:!1,init:function(){if(this.$target.hasClass("block-outer-threadmarks--inline")&&(this.threadmarks=this.$target.find(".block-outer-recent-threadmarks"),this.threadmarks.length&&(this.buttonWrapper=this.threadmarks.find(".buttonGroup-buttonWrapper"),this.buttonWrapper.length&&(this.checkThreadmarkNavBarWidth(),!this.isOverflowing))))c(e).onPassive("resize", XF.proxy(this,"checkThreadmarkNavBarWidth"))},checkThreadmarkNavBarWidth:function(){!this.isOverflowing&&(this.isOverflowing=this.threadmarks.get(0).getBoundingClientRect().height>=2*this.buttonWrapper.get(0).getBoundingClientRect().height)&&(console.log("Threadmarks overflowing"),this.$target.css({overflow:"visible"}),this.$target.removeClass("block-outer-threadmarks--inline"),this.$target.addClass("block-outer-threadmarks--fullWidth"))}});XF.Click.register("threadmark-fetcher","SV.Threadmarks.Fetcher"); XF.Click.register("threadmarks-toggle-storage","SV.Threadmarks.ToggleStorage");XF.Element.register("threadmark-list-width","SV.Threadmarks.ThreadmarkListWidth")})(jQuery,window,document);