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": [ "options": [
{ {
"name": "light", "name": "light",
"default": True, "default": False,
}, },
{ {
"name": "dark", "name": "dark",
@ -185,7 +185,7 @@ QUERY_PARAMETERS = [
{ {
"name": "showscrollbar", "name": "showscrollbar",
"type": "boolean", "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", "example": "true",
"options": [ "options": [
{ {

View File

@ -328,7 +328,11 @@
if (!has_already_been_initially_resized) { if (!has_already_been_initially_resized) {
has_already_been_initially_resized = true; has_already_been_initially_resized = true;
if (has_handled_noscroll) { if (has_handled_noscroll) {
$("main").mCustomScrollbar("scrollTo", "bottom", {scrollEasing:"easeOut"}); if (getParameterByName("scrollbartheme")) {
$("main").mCustomScrollbar("scrollTo", "bottom", {scrollEasing:"easeOut"});
} else {
$("main").animate({ scrollTop: $("#chatcontent").height() }, "slow");
}
} else { } else {
has_handled_noscroll = true; has_handled_noscroll = true;
Materialize.toast('Continue scrolling to read on...', 5000); Materialize.toast('Continue scrolling to read on...', 5000);
@ -359,13 +363,12 @@
showScrollbar = 0; showScrollbar = 0;
} }
var scrollbarTheme = getParameterByName("scrollbartheme"); var scrollbarTheme = getParameterByName("scrollbartheme");
if (!scrollbarTheme) { if (scrollbarTheme) {
scrollbarTheme = "light"; $("main").mCustomScrollbar({
autoHideScrollbar: !showScrollbar,
theme: scrollbarTheme
});
} }
$("main").mCustomScrollbar({
autoHideScrollbar: !showScrollbar,
theme: scrollbarTheme
});
if (disabled) { 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); 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,12 +1328,16 @@
has_handled_noscroll = true; has_handled_noscroll = true;
Materialize.toast('Continue scrolling to read on...', 5000); Materialize.toast('Continue scrolling to read on...', 5000);
} else { } else {
if ($(window).height() < $("main .mCSB_container").height()) { if (getParameterByName("scrollbartheme")) {
$("main .mCSB_container").animate({ if ($(window).height() < $("main .mCSB_container").height()) {
top: -1 * ($("main .mCSB_container").height() - $(window).height()) $("main .mCSB_container").animate({
}, "slow", function () { top: -1 * ($("main .mCSB_container").height() - $(window).height())
$("main").mCustomScrollbar("update"); }, "slow", function () {
}); $("main").mCustomScrollbar("update");
});
}
} else {
$("main").animate({ scrollTop: $("#chatcontent").height() }, "slow");
} }
} }
} }