Force scroll channel to top after selecting it to (hopefully) improve reliability

This commit is contained in:
chylex 2018-09-19 15:01:53 +02:00
parent b442e87050
commit ffffeb792b

View File

@ -174,7 +174,8 @@ var DISCORD = (function(){
var dms = document.querySelector("[class|='privateChannels']"); var dms = document.querySelector("[class|='privateChannels']");
if (dms){ if (dms){
var nextChannel = DOM.queryReactClass("selected", dms).nextElementSibling; var currentChannel = DOM.queryReactClass("selected", dms);
var nextChannel = currentChannel && currentChannel.nextElementSibling;
var nextLink = nextChannel && nextChannel.querySelector("a[href*='/@me/']"); var nextLink = nextChannel && nextChannel.querySelector("a[href*='/@me/']");
if (!nextChannel || !nextLink || !nextChannel.getAttribute("class").includes("channel-")){ if (!nextChannel || !nextLink || !nextChannel.getAttribute("class").includes("channel-")){
@ -182,6 +183,7 @@ var DISCORD = (function(){
} }
else{ else{
nextLink.click(); nextLink.click();
nextChannel.scrollIntoView(true);
return true; return true;
} }
} }
@ -203,6 +205,7 @@ var DISCORD = (function(){
} }
else{ else{
nextChannel.children[0].click(); nextChannel.children[0].click();
nextChannel.scrollIntoView(true);
return true; return true;
} }
} }