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