mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Prevent scrolling at embed load for those info channels
This commit is contained in:
parent
8de3639249
commit
b44cb3f491
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
var user_def_css; // Saves the user defined css
|
var user_def_css; // Saves the user defined css
|
||||||
var has_already_been_initially_resized = false; // keep track if the embed initially been resized
|
var has_already_been_initially_resized = false; // keep track if the embed initially been resized
|
||||||
|
var has_handled_noscroll = false; // Prevent scrolling to bottom of embed at load if false
|
||||||
var logintimer; // timer to keep track of user inactivity after hitting login
|
var logintimer; // timer to keep track of user inactivity after hitting login
|
||||||
var last_message_id; // last message tracked
|
var last_message_id; // last message tracked
|
||||||
var selected_channel = null; // user selected channel
|
var selected_channel = null; // user selected channel
|
||||||
@ -237,11 +238,20 @@
|
|||||||
$("#modal_invite_btn").attr("href", data.instant_invite);
|
$("#modal_invite_btn").attr("href", data.instant_invite);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (getParameterByName("noscroll") != "true") {
|
||||||
|
has_handled_noscroll = true;
|
||||||
|
}
|
||||||
|
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
// For those who decides to hide the embed at first load (display: none), resulting in the messages being not scrolled down.
|
// For those who decides to hide the embed at first load (display: none), resulting in the messages being not scrolled down.
|
||||||
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) {
|
||||||
$("html, body").animate({ scrollTop: $(document).height() }, "fast");
|
$("html, body").animate({ scrollTop: $(document).height() }, "fast");
|
||||||
|
} else {
|
||||||
|
has_handled_noscroll = true;
|
||||||
|
Materialize.toast('Continue scrolling to read on...', 5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -880,8 +890,13 @@
|
|||||||
last = message.id;
|
last = message.id;
|
||||||
}
|
}
|
||||||
if (replace == null && jumpscroll) {
|
if (replace == null && jumpscroll) {
|
||||||
|
if (!has_handled_noscroll) {
|
||||||
|
has_handled_noscroll = true;
|
||||||
|
Materialize.toast('Continue scrolling to read on...', 5000);
|
||||||
|
} else {
|
||||||
$("html, body").animate({ scrollTop: $(document).height() }, "slow");
|
$("html, body").animate({ scrollTop: $(document).height() }, "slow");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$('#chatcontent').linkify({
|
$('#chatcontent').linkify({
|
||||||
target: "_blank"
|
target: "_blank"
|
||||||
});
|
});
|
||||||
|
@ -18,6 +18,18 @@
|
|||||||
Instead of having the top channel as the first channel your users see, you may change it. Enable Discord's Developer mode in the Appearances tab of the User Settings and copy the channel ID. <br>
|
Instead of having the top channel as the first channel your users see, you may change it. Enable Discord's Developer mode in the Appearances tab of the User Settings and copy the channel ID. <br>
|
||||||
<em>Eg: defaultchannel=1234567890</em>
|
<em>Eg: defaultchannel=1234567890</em>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="collection-item">
|
||||||
|
<strong>noscroll=<boolean></strong> <br>
|
||||||
|
Prevents the embed from scrolling down on first load. Useful for those who wants to set #info -typed channels as their default channel. Gotta have those good reads!
|
||||||
|
<hr>
|
||||||
|
<strong>Avaliable Options:</strong>
|
||||||
|
<ul class="browser-default">
|
||||||
|
<li><strong>true</strong></li>
|
||||||
|
<li><strong>false</strong> (default)</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<em>Eg: noscroll=true</em>
|
||||||
|
</li>
|
||||||
<li class="collection-item">
|
<li class="collection-item">
|
||||||
<strong>theme=<string></strong> <br>
|
<strong>theme=<string></strong> <br>
|
||||||
Want your embed to use one of our premade themes? Look no further! <br>
|
Want your embed to use one of our premade themes? Look no further! <br>
|
||||||
|
Loading…
Reference in New Issue
Block a user