discourse-legacysite-perl/site/forum/local/include_sidebar.html
2024-06-17 22:24:05 +10:00

92 lines
2.4 KiB
HTML

<%~if page_id eq 'category_list'%>
<div class="searchbox blank">
<%registered_users || 0%> registered users
</div>
<%~elsif search_widget or $forum_id%>
<%include include_sidebar_search.html%>
<%~endif%>
<%~if page_id ne 'category_list' and $poll_widget%>
<%~set adsize = '300x250'%>
<%include include_ad.html%>
<%~if poll_widget or $forum_id%>
<%include include_poll_widget.html%>
<%~endif%>
<%~endif%>
<%~if page_id eq 'category_list'%>
<%~set adsize = '300x600'%>
<%include include_ad.html%>
<%~else%>
<div class="dynamic-widget" data="45"></div>
<br>
<div class="dynamic-widget" data="46"></div>
<br>
<div class="dynamic-widget" data="47"></div>
<style>
#stickThis{
font-size: 1.5em;
width: 300px;
text-align: center;
}
#stickThis.box {
margin-top: 0;
position: fixed;
z-index: 9999;
}
</style>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<div id="stickHere"></div>
<div id="stickThis">
<div class="dynamic-widget" data="48"></div>
<%~if $forum_id != 4 %>
<%~set adsize = '300x600'%>
<%include include_ad.html%>
<%~endif%>
</div>
<script>
function boxtothetop() {
var windowTop = $(window).scrollTop();
var top = $('#stickHere').offset().top;
var bottom = $('#stickHere').offset().top + $('#stickThis')
.outerHeight(true);
var mainBottom = $('.footer').offset().top - 10;
var toolbarBottom = $('#toolbar2').offset().top + $('#toolbar2').outerHeight() + 20;
//console.log( { windowTop, top, bottom , mainBottom, toolbarBottom } );
if(windowTop > top && bottom < toolbarBottom ) {
$('#stickThis').addClass('box');
$('#stickHere').height($('#stickThis').outerHeight());
if ( windowTop + ( bottom - top ) < mainBottom ) {
$('#stickThis').css({"top": 0});
} else {
var gap = -1 * ( bottom - top ) + ( mainBottom - windowTop );
//console.log( {gap} );
$('#stickThis').css({"top": gap});
}
} else {
$('#stickThis').removeClass('box');
$('#stickHere').height(0);
}
}
$(function() {
$(window)
.scroll(boxtothetop);
boxtothetop();
});
</script>
<%~endif%>
<%~if $forum_id == 11 %>
<%ezoic_desktop_sidebar%>
<%~endif%>