/*=======================================================================*\
|| ###################################################################### ||
|| # 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,["error","showing_x_to_y_of_z_users","x_members_y_guests_online"]);(function(A){var B=[".wollist-widget"];if(!vBulletin.pageHasSelectors(B)){return false}A(document).ready(function(){var E=new vBulletin.pagination({context:A(".wollist-widget"),onPageChanged:function(G,H){var I=A(this).closest(".wollist-widget").data("widget-instance-id");C(I)}});function D(){A(".js-wol-username").each(function(){var I=A(this),G=I.parent().find(".js-wol-userinfo-tooltip"),H=vBulletin.isRtl();if(G.length){I.qtip({content:G,style:{classes:"ui-tooltip-shadow ui-tooltip-rounded b-topicpreview"},position:{my:"top "+(H?"right":"left"),at:"bottom "+(H?"left":"right"),viewport:A(window)}})}})}function F(){A(document).off("click",".js-pagenav .js-pagenav-button").on("click",".js-pagenav .js-pagenav-button",function(J){var I=A(this),H=I.closest(".wollist-widget").data("widget-instance-id"),G=I.data("page"),K=A(".pagenav-form");E.updatePageNavigation(K,G);C(H);return false})}function C(S,R){var G=A('div.wollist-widget[data-widget-instance-id="'+S+'"]');var Q=A('.pagenav-controls :input[name="page"]',G).val(),N=A(".widget-content",G),P=N.data("perpage"),M=N.data("thispageonly"),H=N.data("pagekey"),K=N.data("who"),I=N.data("resolve"),J=N.data("pagerouteid"),L={who:K,pagenumber:Q,perpage:P,resolveIp:I,pageRouteId:J};if(typeof R=="object"){L.sortfield=R.sortby;L.sortorder=R.sortorder}else{var O=A(".js-wol-sort-by").filter(function(){return A(this).find(".js-sort-arrow").is(".vb-icon-triangle-up-wide, .vb-icon-triangle-down-wide")});L.sortfield=O.data("sortby");L.sortorder=O.data("sortorder")}if(M=="1"){L.pagekey=H}A("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/wol/refreshUsers",data:L,complete:function(U,T){console.log("wol-refreshUsers complete.");A("body").css("cursor","auto")},success:function(T,W,X){console.log("wol-fetchAll successful!");var U=((Q-1)*P)+1,Y=Q*P;Y=(Y>T.userCounts.total)?T.userCounts.total:Y;var V=A(".js-wol-sort-by");if(typeof R!="undefined"){V.find(".js-sort-arrow").removeClass("vb-icon-triangle-up-wide vb-icon-triangle-down-wide");V.each(function(){var Z=A(this);if(Z.data("sortby")==R.sortby){Z.find(".js-sort-arrow").addClass(R.sortorder=="asc"?"vb-icon-triangle-up-wide":"vb-icon-triangle-down-wide")}else{Z.data("sortorder","desc")}})}A(".widget-content .js-table-content",G).empty().html(T.template);A(".widget-content .user-counters",G).html(vBulletin.phrase.get("showing_x_to_y_of_z_users",U,Y,T.userCounts.total));A(".widget-content .user-counts",G).html(vBulletin.phrase.get("x_members_y_guests_online",T.userCounts.members,T.userCounts.guests));D();F()},title_phrase:"online_users",error_phrase:"error_fetching_online_users"})}A(".wollist-widget").each(function(){var H=A(this).attr("data-widget-instance-id"),G=parseInt(A(".widget-content",A(this)).attr("data-refresh"));if(G>0){window.setInterval(function(){C(H)},(G*1000))}});A(document).off("click",".js-wol-sort-by").on("click",".js-wol-sort-by",function(K){var G=A(this),I=G.closest(".wollist-widget").attr("data-widget-instance-id"),H=G.data("sortorder"),J={sortby:G.data("sortby"),sortorder:(H=="desc")?"asc":"desc"};G.data("sortorder",J.sortorder);C(I,J)});A(document).off("click",".resolveIpLink").on("click",".resolveIpLink",function(H){H.preventDefault();var G=A(this);vBulletin.AJAX({call:"/ajax/call/bbcode/resolveIp",data:{ip:G.text()},success:function(I){G.replaceWith(I)},complete:function(){A("body").css("cursor","default")}})});D();F()})})(jQuery);