// ***************************
// js.compressed/sb_socialgroups.js
// ***************************
/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.5.2
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2019 MH Sub I, LLC dba vBulletin. 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,["contenttype_vbforum_socialgroup","error","invalid_page_specified","searchtype_social_groups"]);(function(E){var N=[".socialgroup-home-widget",".socialgroup-category-list-widget"];if(!vBulletin.pageHasSelectors(N)){return false}vBulletin.conversation=vBulletin.conversation||{};var T,O={},M,B,V;function I(X){var c=E(".activity-stream-widget"),b=c.offset().top,a=c.outerHeight(),Y=parseFloat(c.css("border-bottom-width")),W=X.height(),Z=(b+a-Y-W);return Z}function C(){return E(".activity-stream-widget .js-module-top-anchor").attr("id")}function S(){var b=E(".activity-stream-widget");function Y(f){var d=E(this),c=d.closest("form.poll"),g=c.find("ul.poll");d.addClass("h-hide");g.css("max-height","none").find("li.h-hide").slideDown(100,function(){c.find(".js-button-group").removeClass("h-hide").next(".view-less-ctrl").removeClass("h-hide");vBulletin.animateScrollTop(c.offset().top,{duration:"fast"})});return false}function X(d){var c=E(this).closest("form.poll");vBulletin.conversation.limitVisiblePollOptionsInAPost(c,3);c.find("ul.poll").css("max-height","").find("li.h-hide").slideUp(100);return false}function Z(c){vBulletin.conversation.editPost.apply(this,[c,M])}function W(c){if(E(c.target).closest(".js-bubble-flyout").length==1){vBulletin.conversation.showWhoVoted.apply(c.target,[c])}else{vBulletin.conversation.votePost.apply(this,[c])}return false}function a(c){vBulletin.conversation.postComment.apply(this,[c,function(){M.updatePageNumber(1).applyFilters(false,true)}])}b.off("click",".list-item-poll .view-more-ctrl").on("click",".list-item-poll .view-more-ctrl",Y);b.off("click",".list-item-poll .view-less-ctrl").on("click",".list-item-poll .view-less-ctrl",X);b.off("click",".js-post-control__ip-address").on("click",".js-post-control__ip-address",vBulletin.conversation.showIp);b.off("click",".js-post-control__edit").on("click",".js-post-control__edit",Z);b.off("click",".js-post-control__vote").on("click",".js-post-control__vote",W);b.off("click",".js-post-control__flag").on("click",".js-post-control__flag",vBulletin.conversation.flagPost);b.off("click",".js-post-control__comment").on("click",".js-post-control__comment",vBulletin.conversation.toggleCommentBox);b.off("click",".js-comment-entry__post").on("click",".js-comment-entry__post",a)}function K(){var k=E(".socialgroup-widget");if(!k.hasClass("socialgroup-home-widget")){return }var b=E(".activity-stream-widget"),W=E("#activity-stream-tab",b),h,Z,f,Y=b.find(".widget-tabs-nav .ui-tabs-nav > li"),d=Y.filter(".ui-tabs-active"),c=d.index(),j=false,a=Y.parent().data("allow-history")=="1",X=new vBulletin.history.instance(a);function m(o){o=o||V;return Y.filter('li:has(a[href*="'+o+'"])').first().index()}function g(v,s,u,t,x,o){var q=E(".conversation-toolbar-wrapper.scrolltofixed-floating",v),r=new vBulletin.scrollToFixed({element:q,limit:I(q)}),p=null,w;if(t){w=new vBulletin.pagination({context:v,allowHistory:u,onPageChanged:function(y,z){p.updatePageNumber(y);if(!z){p.applyFilters(false,true,false,true)}}})}p=new vBulletin.conversation.filter({context:v,autoCheck:x?E(".toolbar-filter-overlay input[type=radio][value=conversations_on]",v).is(":checked"):undefined,scrollToTop:s,pagination:w,allowHistory:u,onContentLoad:o});return{"$bar":q,"$floating":r,pagination:w,filter:p}}function e(o){vBulletin.truncatePostContent(o);vBulletin.conversation.processPostContent(o)}function l(r,q,o){var p=q.filter;if(q.pagination){q.pagination.setOption("context",r)}p.setOption("context",r);if(typeof p.lastFilters!="undefined"&&E(".conversation-empty:not(.h-hide)",o).length>0){delete p.lastFilters}}function n(u,r,t,s,w,p,q,x){var v=g(u,r,t,s,w,function(){v.$floating.updateLimit(I(v.$bar));if(q){e(q)}if(x){x()}});var o=v.filter;if(p){if(q){e(q)}o.lastFilters={filters:o.getSelectedFilters(E(".toolbar-filter-overlay",u))}}return v}function i(s,q,u){var r=q.id,t=(V==u);if(typeof O[r]=="undefined"){O[r]=E(".conversation-toolbar-wrapper",q).data("allow-history")=="1"}if(u=="#activity-stream-tab"){if(!M){var o=E(".conversation-list",W);h=n(W,b,O[r],false,true,t,o,null);M=h.filter;if(t){E(this).data("noPushState",true)}}else{l(W,h,q)}M.applyFilters(false,true)}else{if(u=="#groups-tab"){if(M){M.toggleNewConversations(false)}if(!T){T=vBulletin.history.instance(O[r]);if(t){F(true)}P()}var p=E(".conversation-empty",q);if(p.length>0){if(t&&!Z){Z=true;return false}p.addClass("h-hide");D({},!E(this).data("noPushState"))}}}}if(c==-1){c=0;d=Y.first()}V=d.find("> a").attr("href");Y.removeClass("ui-state-disabled");vBulletin.tabify.call(b,{tabHistory:X,getTabIndexByHash:m,allowHistory:a,tabParamAsQueryString:true,hash:C(),tabOptions:{active:c,beforeActivate:function(q,r){if(M){M.hideFilterOverlay()}var p=b.find(".widget-tabs-panel .ui-tabs-panel:visible"),o=p.find(".list-item-body-wrapper.edit-post .edit-conversation-container");if(o.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(o.closest(".list-item").offset().top,{duration:"slow"})}});return false}},create:function(o,p){i(p.tab,p.panel,p.panel.selector)},activate:function(o,p){i(p.newTab,p.newPanel,p.newPanel.selector)}}});S();vBulletin.conversation.bindEditFormEventHandlers("all")}function F(Z){if(T.isEnabled()){var a=T.getState();if(!a||E.isEmptyObject(a.data)){var X={from:"filter_groups",page:Number(E(".pagenav-form .defaultpage",B).val())||1,filters:{filter_groups:E(".js-button-filter.js-checked",B).data("filter-value")}};Z?(X.tab="#groups-tab"):null;var W=vBulletin.parseQueryString(location.search),Y;if(Z&&typeof W.tab=="undefined"&&V&&V!="#groups-tab"){W.tab="groups-tab";Y=location.pathname+"?"+E.param(W)}else{Y=location.href}T.setDefaultState(X,document.title,Y)}}}function P(){if(T.isEnabled()){T.setStateChange(function(a,f,c){var W=T.getState();if(W.data.from=="filter_groups"||f=="pagination"){T.log(W.data,W.title,W.url);var d=E(".socialgroup-widget"),b=d.hasClass("ui-tabs")&&d,Y=b&&b.tabs("option","selected"),g=b&&b.find(".ui-tabs-nav > li").eq(Y).find("a").attr("href");if(g!==false&&g!=W.data.tab){var Z=b.find(".ui-tabs-nav > li").filter('li:has(a[href*="{0}"])'.format(W.data.tab)).index();vBulletin.selectTabByIndex.call(b,Z)}else{var X={page:W.data.page,my:f=="pagination"&&c?(c.filter_groups||"show_all"):W.data.filters.filter_groups,display_groups:f=="pagination"&&c?(c.display_groups||"display_grid"):W.data.filters.display_groups};D(X,false)}}},"filter")}}function Q(W){vBulletin.AJAX({call:"/ajax/api/content_channel/canAddChannel",data:{nodeid:pageData.channelid},success:function(X){if(X.can===true){location.href=pageData.baseurl+"/sgadmin/create/settings"}else{if(X.exceeded>0){vBulletin.warning("social_groups","you_can_only_create_x_groups_delete")}}},title_phrase:"social_groups"})}function U(X){var W=E(this),Y={page:1};if(W.is(".js-button-filter-my")){Y.my=W.data("filter-value");Y.display_groups=E(".js-button-filter-display-groups.js-checked",B).data("filter-value")}else{Y.my=E(".js-button-filter-my.js-checked",B).data("filter-value");Y.display_groups=W.data("filter-value")}D(Y,true)}function L(){function W(X){var Y=X.data("js-movable-button-clone-id");return E(".js-movable-toolbar-button-clone").filter(function(){return E(this).data("js-movable-button-clone-id")==Y})}B.find(".js-button-filters .js-button-filter").removeClass("b-button--pressed").each(function(){W(E(this)).removeClass("b-button--pressed")}).filter(".js-checked").addClass("b-button--pressed").each(function(){W(E(this)).addClass("b-button--pressed")})}function D(d,Z){var a=E(".conversation-list",B),c=E(".sg-groups-list",a),X=E(".sg-groups-pagination",c);d.sgparent=d.sgparent||E(".js-category",X).val();d.page=d.page||E(".js-pagenum",X).val();d.perpage=d.perpage||E(".js-perpage",X).val();d.my=d.my||B.find(".js-button-filters .js-button-filter-my.js-checked").data("filter-value");d.display_groups=d.display_groups||B.find(".js-button-filters .js-button-filter-display-groups.js-checked").data("filter-value");d.routeInfo=d.routeInfo||c.find(".sg-groups-list-container").data("route");E(".js-button-filters .js-button-filter-my",B).removeClass("js-checked").filter('[data-filter-value="{0}"]'.format(d.my)).addClass("js-checked");E(".js-button-filters .js-button-filter-display-groups",B).removeClass("js-checked").filter('[data-filter-value="{0}"]'.format(d.display_groups)).addClass("js-checked");d.isAjaxTemplateRenderWithData=true;vBulletin.AJAX({call:"/ajax/render/socialgroup_nodes",data:d,success:function(g){a.replaceWith(g.template);var k=E(".conversation-toolbar-wrapper .pagenav-controls .pagenav-form",B),i=E(".arrow",k).removeClass("h-disabled"),e=B.find(".sg-groups-list .sg-groups-pagination"),h=e.find(".js-prevpage").val(),j=e.find(".js-nextpage").val();E(".js-pagenum",k).val(e.find(".js-pagenum").val());E(".pagetotal",k).text(e.find(".js-totalpages").val());function f(n,m){var l=i.filter(n).toggleClass("h-disabled",!m);if(m){l.attr("href",m)}else{l.removeAttr("href")}}f("[rel=prev]",h);f("[rel=next]",j);L();vBulletin.initFlexGridFixLastRowAll(true);vBulletin.initFrameImagesWithColor()},title_phrase:"contenttype_vbforum_socialgroup",error_phrase:"unable_to_contact_server_please_try_again",});if(Z){var Y=location.pathname;if(V&&V!="#groups-tab"){Y+="?tab=groups-tab"}Y=vBulletin.makePaginatedUrl(Y,d.page);Y=vBulletin.makeFilterUrl(Y,"filter_groups",d.my,B);Y=vBulletin.makeFilterUrl(Y,"display_groups",d.display_groups,B);if(T&&T.isEnabled()){var b=T.getState(),W={from:"filter_groups",page:d.page,tab:B.hasClass("ui-tabs-panel")?"#"+B.attr("id"):undefined,filters:{filter_groups:d.my,display_groups:d.display_groups}};T.pushState(W,document.title,Y)}else{if(O["groups-tab"]){Y=vBulletin.makeFilterUrl(Y,"filter_groups",filterValue,B,C());location.href=Y;return false}}}}function H(W,c){if(!W.length){return }function X(h){var f=h.innerWidth(),g=parseInt(h.css("paddingLeft"),10),i=parseInt(h.css("paddingRight"),10);return Math.floor(f-g-i)}function a(f){return Math.ceil(f.outerWidth(true))}function e(i,j){var m=!!j;i.width(j);i.toggleClass("b-groupgrid__item-inner--expanded",m);var l=E(".js-groupgrid-item-icon",g).outerWidth();var h=E(".js-groupgrid-item-icon-link",g).outerWidth();if(m&&h>l){i.removeClass("b-groupgrid__item-inner--expanded")}var g=i.first(),k=X(g),f=k-1;i.find(".js-groupgrid-item-icon-link").width(f).height(f)}e(W,"");if(!c){return }var b=W.first(),d=X(b.closest(".b-groupgrid__item")),Z=a(b)-X(b),Y;if(b.closest(".b-groupgrid__item").is(".b-flexgrid__item--lastrow")){return }W.each(function(){var f=E(this).closest(".b-groupgrid__item");if(f.is(".b-flexgrid__item--lastrow")){return true}d=Math.min(d,X(f))});Y=d-Z-1;e(W,Y)}function J(Y,X){var W=E(".b-groupgrid__item-inner");if(X&&X.isResize){W.css({opacity:"0"})}H(W,false)}function G(Y,X){var W=E(".b-groupgrid__item-inner");H(W,true);if(X&&X.isResize){W.removeClass("h-tranparent").animate({opacity:"1"},400)}}function A(){B=E(".groups-tab",W);K();O["groups-tab"]=O["groups-tab"]||E(".conversation-toolbar-wrapper",B).data("allow-history")=="1";E(document).off("click",".add-sg").on("click",".add-sg",Q);B.off("click",".js-button-filter").on("click",".js-button-filter",U);groupsPagination=new vBulletin.pagination({context:B,allowHistory:O["groups-tab"],onPageChanged:function(b,a,Y,Z){if(!a){var X=typeof Z!="undefined"?vBulletin.parseQueryString(X):null,c={my:X&&typeof X.filter_groups=="undefined"?"show_all":E(".js-button-filter-my.js-checked",B).data("filter-value"),display_groups:X&&typeof X.display_groups=="undefined"?"display_grid":E(".js-button-filter-display-groups.js-checked",B).data("filter-value"),page:b};D(c,a)}}});var W=E(".socialgroup-widget");if(!W.hasClass("ui-tabs")){T=vBulletin.history.instance(O["groups-tab"]);F(false);P()}L();E(document).on("vbulletin:flexgridstart",".js-flexgrid",J);E(document).on("vbulletin:flexgridready",".js-flexgrid",G)}function R(){E(document).ready(function(){A()})}R()})(jQuery);;

// ***************************
// js.compressed/subscribe.js
// ***************************
/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.5.2
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2019 MH Sub I, LLC dba vBulletin. 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,["follow","following","following_pending","social_group_count_members_x","unsubscribe_overlay_error"]);window.vBulletin.options=window.vBulletin.options||{};window.vBulletin.options.precache=window.vBulletin.options.precache||[];window.vBulletin.options.precache=$.merge(window.vBulletin.options.precache,[]);(function(){vBulletin.subscribe={};var C=function(J){var M=$(J);if(M.hasClass("isSubscribed")||M.hasClass("is-pending")){return true}var O=parseInt(M.attr("data-node-id"),10),N={},K="";if(M.hasClass("is-topic")){K="/ajax/api/follow/add";N.follow_item=O;N.type="follow_contents";D(M,K,N)}else{var L={};L.channelid=O;L.recipient=parseInt(M.attr("data-owner-id"),10);if(M.hasClass("is-blog-channel")){L.requestType="member"}else{if(M.hasClass("is-sg-channel")){L.requestType="sg_subscriber"}else{L.requestType="subscriber"}}D(M,"/ajax/api/node/requestChannel",L)}};var H=function(J,K){J.children(".js-button__text-primary").text(vBulletin.phrase.get(K))};var F=function(L,M,K,J){H(L,M);L.addClass((K||"")+" b-button--special").removeClass((J||"")+" b-button--secondary")};var E=function(L,M,K,J){H(L,M);L.addClass((K||"")+" b-button--secondary").removeClass((J||"")+" b-button--special")};var D=function(K,J,L){vBulletin.AJAX({call:J,data:L,success:function(M){if(!isNaN(M)&&M>=1){if(M==1){F(K,"following","isSubscribed")}else{F(K,"following_pending","is-pending")}}else{vBulletin.error("follow","follow_error")}},title_phrase:"follow",error_phrase:"follow_error"})};function B(K,J){var L=$(".js-replace-member-count-"+K);if(L.length){L.each(function(){var P=$(this),O=P.data("replace-phrase-varname"),N=parseInt(P.data("member-count"),10),M=N+J;P.text(vBulletin.phrase.get(O,M));P.data("member-count",M)})}}var A=function(J){var L=$(J),M=parseInt(L.attr("data-node-id"),10),K=parseInt(L.attr("data-owner-id"),10);vBulletin.AJAX({call:"/ajax/api/node/requestChannel",data:({channelid:M,recipient:K,requestType:"sg_member"}),success:function(N){if(N===true){F(L,"joined","has-joined");B(M,1);if(L.hasClass("join-to-post-btn")||L.hasClass("js-refresh")){window.location.reload()}}else{if(!isNaN(N)){F(L,"following_pending","is-pending")}}},title_phrase:"join",error_phrase:"join_error"})};var I=function(J){var K=$(J),L=parseInt($(J).attr("data-node-id"),10);vBulletin.AJAX({call:"/ajax/api/blog/leaveChannel",data:{channelId:L},success:function(M){if(M===true){if(K.hasClass("js-button--follow")){H(K,"follow");K.addClass("b-button--special").removeClass("isSubscribed b-button--unfollow")}else{H(K,"join");K.removeClass("has-joined b-button--special leave-btn")}B(L,-1);if(!K.is(".js-no-refresh")){location.reload()}}else{vBulletin.error("leave","invalid_server_response_please_try_again")}},title_phrase:"leave",error_phrase:"invalid_server_response_please_try_again"})};var G=function(J){var K=$(J),L=$(J).attr("data-node-id");vBulletin.AJAX({call:"/ajax/api/follow/delete",data:{follow_item:L,type:"follow_contents"},success:function(M){if(M==1){E(K,"follow","","isSubscribed b-button--unfollow")}else{vBulletin.error("follow","unfollow_error")}},title_phrase:"follow",error_phrase:"unfollow_error"})};vBulletin.subscribe.updateSubscribeButton=function(K){if(typeof K!="undefined"){var J=$(".js-button--follow").filter(function(){return $(this).data("node-id")==pageData.nodeid&&pageData.nodeid!=pageData.channelid});switch(K){case 0:E(J,"follow","","isSubscribed b-button--unfollow");break;case 1:E(J,"following","isSubscribed");break;case 2:E(J,"following_pending","is-pending");break}}};$(".js-button--follow").on("click",function(J){if(!$(this).hasClass("isSubscribed")){C(this)}else{if($(this).hasClass("b-button--unfollow")){if($(this).hasClass("is-blog-channel")){I(this)}else{G(this)}}}});$(".js-button--follow").on("mouseover",function(J){var K=$(this);if(K.hasClass("isSubscribed")&&!K.hasClass("is-owner")){E(K,"following_remove","b-button--unfollow")}});$(".js-button--follow").on("mouseout",function(J){var K=$(this);if(K.hasClass("b-button--unfollow")){F(K,"following","","b-button--unfollow")}});$(".join-to-post-btn").on("click",function(J){if(!$(this).hasClass("has-joined")&&!$(this).hasClass("is-pending")){A(this)}});$(document).on("click",".join-btn",function(J){if(!$(this).hasClass("has-joined")&&!$(this).hasClass("is-pending")){A(this)}else{if($(this).hasClass("leave-btn")&&!$(this).hasClass("is-owner")){I(this)}}});$(document).on("mouseover",".join-btn",function(J){var K=$(this);if(K.hasClass("has-joined")&&!K.hasClass("is-owner")){E(K,"leave","leave-btn")}});$(document).on("mouseout",".join-btn",function(J){var K=$(this);if(K.hasClass("leave-btn")&&!K.hasClass("is-owner")){F(K,"joined","","leave-btn")}})})();;

