/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.4.1
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2018 vBulletin Solutions Inc. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
window.vBulletin=window.vBulletin||{};window.vBulletin.phrase=window.vBulletin.phrase||{};window.vBulletin.phrase.precache=window.vBulletin.phrase.precache||[];window.vBulletin.phrase.precache=$.merge(window.vBulletin.phrase.precache,["blog_memberblogLabel","edit_conversation","forum","you_have_a_pending_edit_unsaved"]);(function(A){var B=[".forum-activity-stream-widget",".bloghome-widget",".search-widget"];if(!vBulletin.pageHasSelectors(B)){return false}A(document).ready(function(){vBulletin.conversation=vBulletin.conversation||{};var P=vBulletin.conversation.$activityStreamWidget=A(".activity-stream-widget"),D=vBulletin.conversation.$activityStreamTab=A("#activity-stream-tab");if(D.length==0){D=vBulletin.conversation.$activityStreamTab=A("#article-tab")}var K=vBulletin.conversation.$subscribedTab=A("#subscribed-tab"),L=vBulletin.conversation.$activityStreamList=A(".conversation-list",D),Y=vBulletin.conversation.$subscribedList=A(".conversation-list",K),E,U,a,W,i,V=A(".conversation-list",P),T,e;if(P.hasClass("forum-activity-stream-widget")||P.hasClass("bloghome-widget")){var H=P.find(".widget-tabs-nav .ui-tabs-nav > li"),R=H.filter(".ui-tabs-active"),Q=R.index(),h,b={},N=H.parent().data("allow-history")=="1",C=new vBulletin.history.instance(N),M=P.find(".js-module-top-anchor").attr("id");if(Q==-1){Q=0;R=H.first()}h=R.find("> a").attr("href");var O=function(j){var k=(P.offset().top+(P.outerHeight()-parseFloat(P.css("border-bottom-width")))-j.height());return k};var f=function(j){j=j||h;return H.filter('li:has(a[href*="'+j+'"])').first().index()};var X=function(q,n,p,o,s,j){var l=A(".conversation-toolbar-wrapper.scrolltofixed-floating",q),m=new vBulletin.scrollToFixed({element:l,limit:O(l)}),k=null,r;if(o){r=new vBulletin.pagination({context:q,allowHistory:p,onPageChanged:function(t,u){k.updatePageNumber(t);if(!u){k.applyFilters(false,true,false,true)}}})}k=new vBulletin.conversation.filter({context:q,autoCheck:s?A(".toolbar-filter-overlay input[type=radio][value=conversations_on]",q).is(":checked"):undefined,scrollToTop:n,pagination:r,allowHistory:p,onContentLoad:j});return{"$bar":l,"$floating":m,pagination:r,filter:k}};var S=function(j){vBulletin.truncatePostContent(j);vBulletin.conversation.processPostContent(j)};var d=function(m,l,j){var k=l.filter;if(l.pagination){l.pagination.setOption("context",m)}k.setOption("context",m);if(typeof k.lastFilters!="undefined"&&A(".conversation-empty:not(.h-hide)",j).length>0){delete k.lastFilters}};var g=function(p,m,o,n,r,k,l,s){var q=X(p,m,o,n,r,function(){q.$floating.updateLimit(O(q.$bar));if(l){S(l)}if(s){s()}});var j=q.filter;if(k){if(l){S(l)}j.lastFilters={filters:j.getSelectedFilters(A(".toolbar-filter-overlay",p))}}return q};var I=function(k){var j=A(".toolbar-pagenav",k);if(j.length>0){new vBulletin.pagination({context:k,allowHistory:b[k.id],onPageChanged:function(n,m){if(!m){var o=A(".js-button-filter.js-checked",k).data("filter-value"),l=j.closest(".activity-stream-widget");G(l,k,n,o,false,true)}}})}};var J=function(k,j){if(j){k.removeClass("h-disabled").attr("href",j.replace(/&amp;/g,"&"))}else{k.addClass("h-disabled").removeAttr("href")}};var G=function(n,k,r,q,j,s){r=r||1;q=q||"show_all";A(".js-button-filters .js-button-filter",k).removeClass("js-checked").filter('[data-filter-value="{0}"]'.format(q)).addClass("js-checked");var m=vBulletin.makePaginatedUrl(location.href,r);if(!j){if(i.isEnabled()){m=vBulletin.makeFilterUrl(m,"filter_blogs",q,k);var l=i.getState(),p={from:"filter_blogs",page:r,tab:hash,filters:{filter_blogs:q}};i[(l&&l.data&&l.data.from&&l.data.from!="filter_blogs")?"setDefaultState":"pushState"](p,document.title,m)}else{if(b[panelId]){m=vBulletin.makeFilterUrl(m,"filter_blogs",q,k,M);location.href=m;return false}}}var o={tab:k.selector.replace("#",""),filter_blogs:q=="show_all"?undefined:q};vBulletin.AJAX({call:"/ajax/render/blogmember_tab",data:{from:r,my:q,noToolbar:s,page:o,blogChannelId:n.data("blog-channel-id")},error_phrase:"unable_to_contact_server_please_try_again",success:function(w){var u=A(w);if(u.filter(".conversation-toolbar-wrapper").length){A(k).html(w);I(k);if(typeof vBulletin.Responsive.ChannelContent.cloneAndMoveToolbarButtons=="function"){vBulletin.Responsive.ChannelContent.cloneAndMoveToolbarButtons()}}else{A(".blogmember-list",k).hide().replaceWith(u).show();var t=u.data("pagination");if(t&&typeof t=="object"&&!A.isEmptyObject(t)){A(".pagenav-form .js-pagenum",k).val(t.currentpage);A(".pagenav-form .pagetotal",k).text(t.totalpages);var v=A(".pagenav-form .arrow",k);J(v.filter("[rel=prev]"),t.prevurl);J(v.filter("[rel=next]"),t.nexturl)}A(".conversation-toolbar-wrapper",k).removeClass("h-hide")}}})};var c=function(p,m,j,n){var n=j.selector;panelId=j.id,isDefault=(h==n);if(typeof b[panelId]=="undefined"){b[panelId]=A(".conversation-toolbar-wrapper",j).data("allow-history")=="1"}if(W&&n!="#activity-stream-tab"&&n!="#article-tab"){W.toggleNewConversations(false)}if(U&&n=="#subscribed-tab"){U.toggleNewConversations(false)}if(n=="#memberblog-tab"){var l=false;if(!l){l=true;A(j).on("click",".js-button-filter",function(u,s){var t=A(this).data("filter-value");G(p,j,1,t,s,true)})}if(!i){i=vBulletin.history.instance(b[j.id]);if(i.isEnabled()){var k=i.getState();if(!k||A.isEmptyObject(k.data)){var q={from:"filter_blogs",page:Number(A(".pagenav-form .defaultpage",j).val())||1,tab:n,filters:{filter_blogs:A(".js-button-filter.js-checked",j).data("filter-value")}};i.setDefaultState(q,document.title,location.href)}i.setStateChange(function(w){var v=i.getState();if(v.data.from=="filter_blogs"){i.log(v.data,v.title,v.url);var s=p.tabs("option","selected"),t=p.find(".ui-tabs-nav > li").eq(s).find("a").attr("href");if(t!=v.data.tab){var u=f(v.data.tab);vBulletin.selectTabByIndex.call(p,u)}else{G(p,j,v.data.page,v.data.filters.filter_blogs,true,true)}}},"filter")}}if(h==n){I(j)}var o=A(".conversation-list",j);if(!o.hasClass("dataLoaded")){if(h==n&&!e){e=true;return false}A(".conversation-empty",j).addClass("h-hide");G(p,j)}return }else{if(n=="#activity-stream-tab"||n=="#article-tab"){if(!W){a=g(D,P,b[panelId],true,true,isDefault,L,null);W=a.filter}else{d(D,a,j)}W.applyFilters(false,true)}else{if(n=="#subscribed-tab"){if(!U){E=g(K,P,b[panelId],true,true,isDefault,Y,null);U=E.filter}else{d(K,E,j)}U.applyFilters(false,true)}else{if(n=="#forum-tab"){var r=A(j);if(r.hasClass("dataLoaded")){if(h==n){vBulletin.markreadcheck()}return false}else{if(h==n&&!T){T=true;return false}}A(".conversation-empty",j).addClass("h-hide");A.post(vBulletin.getAjaxBaseurl()+"/ajax/render/display_Forums_tab",function(s){r.html(s).addClass(function(){var t=A(".conversation-empty",this);if(t.length==0){return"dataLoaded"}else{t.removeClass("h-hide");return""}})},"json").error(function(u,t,s){console.log("/ajax/render/display_Forums_tab failed. Error: "+s);openAlertDialog({title:vBulletin.phrase.get("forum"),message:vBulletin.phrase.get("unable_to_contact_server_please_try_again"),iconType:"error"})}).complete(function(){vBulletin.markreadcheck()})}}}}};H.removeClass("ui-state-disabled");vBulletin.tabify.call(P,{tabHistory:C,getTabIndexByHash:f,allowHistory:N,tabParamAsQueryString:true,hash:M,tabOptions:{active:Q,beforeActivate:function(l,m){if(W){W.hideFilterOverlay()}if(U){U.hideFilterOverlay()}var k=P.find(".widget-tabs-panel .ui-tabs-panel:visible");var j=k.find(".list-item-body-wrapper.edit-post .edit-conversation-container");if(j.length>0){openAlertDialog({title:vBulletin.phrase.get("edit_conversation"),message:vBulletin.phrase.get("you_have_a_pending_edit_unsaved"),iconType:"warning",onAfterClose:function(){vBulletin.animateScrollTop(j.closest(".list-item").offset().top,{duration:"slow"})}});return false}},create:function(j,k){c(A(this),k.tab,k.panel,k.panel.selector)},activate:function(j,k){c(A(this),k.newTab,k.newPanel,k.newPanel.selector)}}});var F=0;P.find(".ui-tabs-nav li").each(function(){F+=A(this).width()});var Z=P.find(".ui-tabs-nav").width();if(F>Z){P.find(".widget-tabs-nav, .module-title").height(P.find(".ui-tabs-nav").height())}}vBulletin.truncatePostContent(".search-widget");P.off("click",".list-item-poll .view-more-ctrl").on("click",".list-item-poll .view-more-ctrl",function(k){var j=A(this).closest("form.poll");var l=j.find("ul.poll");A(this).addClass("h-hide");l.css("max-height","none").find("li.h-hide").slideDown(100,function(){j.find(".js-button-group").removeClass("h-hide").next(".view-less-ctrl").removeClass("h-hide");vBulletin.animateScrollTop(j.offset().top,{duration:"fast"})});return false});P.off("click",".list-item-poll .view-less-ctrl").on("click",".list-item-poll .view-less-ctrl",function(k){var j=A(this).closest("form.poll");vBulletin.conversation.limitVisiblePollOptionsInAPost(j,3);j.find("ul.poll").css("max-height","").find("li.h-hide").slideUp(100);return false});V.off("click",".js-post-control__edit").on("click",".js-post-control__edit",function(j){vBulletin.conversation.editPost.apply(this,[j,W])});V.off("click",".js-post__history").on("click",".js-post__history",vBulletin.conversation.showPostHistory);V.off("click",".js-post-control__ip-address").on("click",".js-post-control__ip-address",vBulletin.conversation.showIp);V.off("click",".js-post-control__vote").on("click",".js-post-control__vote",function(j){if(A(j.target).closest(".bubble-flyout").length==1){vBulletin.conversation.showWhoVoted.apply(j.target,[j])}else{vBulletin.conversation.votePost.apply(this,[j])}return false});V.off("click",".js-post-control__flag").on("click",".js-post-control__flag",vBulletin.conversation.flagPost);V.off("click",".js-post-control__comment").on("click",".js-post-control__comment",vBulletin.conversation.toggleCommentBox);V.off("click",".js-comment-entry__post").on("click",".js-comment-entry__post",function(j){vBulletin.conversation.postComment.apply(this,[j,function(){W.updatePageNumber(1).applyFilters(false,true)}])});vBulletin.conversation.bindEditFormEventHandlers("all")})})(jQuery);