Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Tweak: Force the default dashboard tab to "Following" #1134

Merged
merged 5 commits into from
Sep 2, 2023

Conversation

marcustyphoon
Copy link
Collaborator

@marcustyphoon marcustyphoon commented Jul 10, 2023

Is Staff planning to add a feature that makes your first dashboard tab customizable and the default (or that remembers your last-selected dashboard tab or something) any time soon? If yes, this is obviously pointless. I, however, was not sure if that was the implication of

We are also working on making dashboard tabs even more customizable, including adding the ability to choose which tab appears first.

Description

Adds a tweak that forces navigation to tumblr.com and tumblr.com/dashboard to actually point to the "Following" dashboard tab instead of the "For You" dashboard tab, as it does for accounts created after May 8th, 2023.

I will probably publish an equivalent to this as a userscript (already written) and then no-op it when it is no longer needed if we don't want to add it to XKit and the behavior is not expected to be implemented natively soon.

Resolves #1158

Testing steps

Load the new tweak on a blog created after May 8th, 2023.

  • Open a tab at tumblr.com
  • Open a tab at tumblr.com/dashboard
  • Navigate to the dashboard from a non-dash page via clicking the Tumblr logo
  • Navigate to the dashboard from a non-dash page via clicking the home icon
  • Navigate to the dashboard from a different dashboard tab via clicking the Tumblr logo
  • Navigate to the dashboard from a different dashboard tab via clicking the home icon

Also, perform the above actions in the mobile layout.

In each case, it should appear that the "Following" tab is the target of said navigation actions.

@marcustyphoon marcustyphoon changed the title New tweak: Force "following" dashboard tab to default New tweak: Force default dashboard tab to "Following" Jul 10, 2023
@marcustyphoon marcustyphoon changed the title New tweak: Force default dashboard tab to "Following" New tweak: Force the default dashboard tab to "Following" Jul 10, 2023
@nightpool
Copy link
Collaborator

going to test this tonight

only matters when enabled on a pre-may-8 blog, but still
@nightpool
Copy link
Collaborator

Can you explain the performance optimization commit? I'm not sure I understand how it improves performance

that is not how a parent selector works.
@marcustyphoon
Copy link
Collaborator Author

Went to write an answer to that and realized that I messed it up (yes it did improve it; no it did not improve it by the amount desired). Fixing...

@marcustyphoon
Copy link
Collaborator Author

Take two:

Sure!

querySelector calls stop searching once they find an element that matches the whole selector—which, notably, means that they don't short-circuit if such an element doesn't exist, and will check every element on the page against the rightmost selector in their query string. On a Tumblr page, this can easily be hundreds of thousands of elements.

The tweaked code finds the timeline element quickly no matter how many posts are loaded (querySelector starts at the top of the DOM tree) and no matter what the currently-logged-in account's default dashboard tab is, putting a ceiling on execution time at a small fraction of a millisecond.

This could be optimized more by stealing more code out of mutations.js (rAF throttle), but it's plenty fast enough and this tweak will be obsolete soon anyway.

@marcustyphoon
Copy link
Collaborator Author

This could also include click handlers on the home button and tumblr logo that go straight to the following tab to skip an extra api request, now that I think of it. But also, like, how many people will actually use this between when it hypothetically gets released and when it hypothetically gets retired (and/or optimized, if this isn't on the redpop roadmap)? Probably not worth the extra testing and review?

@marcustyphoon marcustyphoon changed the title New tweak: Force the default dashboard tab to "Following" New Tweak: Force the default dashboard tab to "Following" Aug 12, 2023
Copy link
Owner

@AprilSylph AprilSylph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have an account that is capable of testing this, but code looks good.

@marcustyphoon marcustyphoon merged commit 65734c8 into AprilSylph:master Sep 2, 2023
2 checks passed
@marcustyphoon marcustyphoon deleted the following-tab-tweak branch September 2, 2023 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

automatically take me to following tab
3 participants