/*! * BuddyBoss Theme JavaScript Library * @package BuddyBoss Theme */ !function(c){"use strict";window.BuddyBossThemeBbpScrubber={scrubbers:[],init:function(){var b=window.BuddyBossThemeBbpScrubber;c(".scrubber").each(function(r,e){var t=c(e).data("key"),s=c(e).closest("#bbpress-forums"),n=c(e).find("#reply-timeline-container").outerHeight();b.scrubbers[t]={total:s.find(".scrubberpost").length,onscroll_update:!0,scrubber_height_usable:n-c(e).find("#handle").outerHeight(),scrubber_height:n,currentnum:1,scrolltimer:null,handleani:null,draggie:null,total_item:parseInt(c(e).data("total-item"),10),total_page:parseInt(c(e).data("total-page"),10),current_page:parseInt(c(e).data("current-page"),10),from:parseInt(c(e).data("from"),10),to:parseInt(c(e).data("to"),10)},(10<=b.scrubbers[t].total||1b.length||1!==s.scrubbers[t].total&&r===s.scrubbers[t].total?(r=s.scrubbers[t].total-1,e="last"):1===r&&"last"!==e?(r=0,e="first"):1===r&&"last"===e?r=0:r-=1,0===r?s.scrubbers[t].currentnum=r+1:r===s.total&&(s.scrubbers[t].currentnum=s.scrubbers[t].total);var u=!1;"last"===e?r=s.scrubbers[t].total-1:"first"===e&&(u=!(r=0)),s.scrubbers[t].onscroll_update=!1;var a=0;void 0===b[r]?a=b[b.length]:(a=b[r],c(a).parent().addClass("highlight")),s.update_handle(u,t),c("html, body").animate({scrollTop:c(a).offset().top-window.innerHeight/2},600,function(){setTimeout(function(){c(a).parent().removeClass("highlight"),s.scrubbers[t].onscroll_update=!0},200)})},update_move:function(r){var e=window.BuddyBossThemeBbpScrubber,t=c('.scrubber[data-key="'+r+'"]');if(!t.length)return!1;e.scrubbers[r].total=t.closest("#bbpress-forums").find(".scrubberpost").length,e.scrubbers[r].scrubber_height_usable=e.scrubbers[r].scrubber_height-t.find("#handle").outerHeight();var s=e.scrubbers[r].scrubber_height_usable,n=t.find("#handle")[0].style.transform.split(",")[1];n=void 0!==n?n:0;for(var b=parseFloat(t.find("#handle")[0].style.top)+parseFloat(n),u=parseFloat(s/e.scrubbers[r].total),a=1;a<=e.scrubbers[r].total;a++)b=document.body.scrollHeight){o.scrubbers[t].currentnum=o.scrubbers[t].total;var n=1!==o.scrubbers[t].total;return o.update_handle(n,t),!1}for(var b=o.scrubbers[t].currentnum,u=!1,a=0;ao.scrubbers[t].total&&(b=o.scrubbers[t].total-1),u&&(o.scrubbers[t].currentnum=b+1,o.update_handle(!1,t))})}},c(function(){window.BuddyBossThemeBbpScrubber.init()})}(jQuery);