Default normal scrollbar unless theme param set

This commit is contained in:
Jeremy Zhang 2018-08-08 03:57:28 +00:00
parent 5ffa7dbca7
commit 52c076e667
2 changed files with 22 additions and 15 deletions

View File

@ -74,7 +74,7 @@ QUERY_PARAMETERS = [
"options": [
{
"name": "light",
"default": True,
"default": False,
},
{
"name": "dark",
@ -185,7 +185,7 @@ QUERY_PARAMETERS = [
{
"name": "showscrollbar",
"type": "boolean",
"description": "Shows the scrollbar permanently without autohiding.",
"description": "Shows the scrollbar permanently without autohiding. (Requires the scrollbar theme param to be set)",
"example": "true",
"options": [
{

View File

@ -328,7 +328,11 @@
if (!has_already_been_initially_resized) {
has_already_been_initially_resized = true;
if (has_handled_noscroll) {
if (getParameterByName("scrollbartheme")) {
$("main").mCustomScrollbar("scrollTo", "bottom", {scrollEasing:"easeOut"});
} else {
$("main").animate({ scrollTop: $("#chatcontent").height() }, "slow");
}
} else {
has_handled_noscroll = true;
Materialize.toast('Continue scrolling to read on...', 5000);
@ -359,13 +363,12 @@
showScrollbar = 0;
}
var scrollbarTheme = getParameterByName("scrollbartheme");
if (!scrollbarTheme) {
scrollbarTheme = "light";
}
if (scrollbarTheme) {
$("main").mCustomScrollbar({
autoHideScrollbar: !showScrollbar,
theme: scrollbarTheme
});
}
if (disabled) {
Materialize.toast('This server is currently disabled. If you are an administrator of this server, please get in touch with a TitanEmbeds team member to lift the ban.', 100000);
@ -1325,6 +1328,7 @@
has_handled_noscroll = true;
Materialize.toast('Continue scrolling to read on...', 5000);
} else {
if (getParameterByName("scrollbartheme")) {
if ($(window).height() < $("main .mCSB_container").height()) {
$("main .mCSB_container").animate({
top: -1 * ($("main .mCSB_container").height() - $(window).height())
@ -1332,6 +1336,9 @@
$("main").mCustomScrollbar("update");
});
}
} else {
$("main").animate({ scrollTop: $("#chatcontent").height() }, "slow");
}
}
}
$('#chatcontent').linkify({