Skip to content

Commit

Permalink
fix closing dms jumping page to top
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Sep 24, 2023
1 parent cdad6f4 commit e5aeb2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions layouts/header/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let inboxData = [];
let followRequestsData = [];
let customSet = false;
let menuFn;
let notificationsOpened = false;
let notificationsOpened = false, inboxOpened = false;
let isDarkModeEnabled = typeof vars !== 'undefined' ? (vars.darkMode || (vars.timeMode && isDark())) : false;
let activeTweet;
let seenAlgoTweets = [], algoTweetsChanged = false;
Expand Down Expand Up @@ -1090,6 +1090,7 @@ let userDataFunction = async user => {
}
document.getElementById('messages').addEventListener('click', async e => {
e.preventDefault();
inboxOpened = true;
location.hash = '#dm';

let inbox = inboxData;
Expand Down Expand Up @@ -1153,9 +1154,10 @@ let userDataFunction = async user => {
</div>
`, "inbox-modal", () => {
if(location.hash === '#dm') {
location.hash = "";
location.hash = "##";
}
tweetUrlToShareInDMs = null;
setTimeout(() => inboxOpened = false, 100);
});
modal.querySelector('.modal-close').hidden = true;
const inboxList = modal.querySelector('.inbox-list');
Expand Down
2 changes: 1 addition & 1 deletion layouts/profile/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@ setTimeout(async () => {
});
window.addEventListener("popstate", async () => {
if(document.querySelector('.tweet-viewer')) return;
if(notificationsOpened) return;
if(notificationsOpened || inboxOpened) return;

let path = location.pathname;
if(path.endsWith("/")) path = path.substring(0, path.length - 1);
Expand Down

0 comments on commit e5aeb2a

Please sign in to comment.