10

When I click a username, I usually want to see their activity. Now for each username I click, I have to click 'Activity' again:

Profile tab highlighted

I want that to remember that I last visited the 'Activity' tab.

The profile page for other users already remembers which post sort order I have for their posts, so why not this tab as well?

7
  • 2
    Yes, it defaults to the "Profile" tab for other users and the "Activity" tab for oneself. Trying to get the Fanatic badge so I load my own profile just to see when I was "Last seen", and I have to do the extra click every time :/
    – Scratte
    Commented Sep 30, 2021 at 14:43
  • 4
    I don't remember this ever remembering the last-used tab. Didn't it always open the "Profile" tab for other users and the "Activity" tab for oneself?
    – Ryan M Mod
    Commented Sep 30, 2021 at 14:47
  • 1
    @Ryan AFAIK, it used to remember this on "other users" basis or even "per user" basis. Or maybe not. Then it's a feature request.
    – CodeCaster
    Commented Sep 30, 2021 at 14:49
  • 3
    In my experience, the system never remembered which page in the profile was the last viewed and translated that to when you visit other users' profile pages. You can have direct links to each of the pages, so that might affect how you experienced this. When viewed by a non-moderator, the default page to be viewed is the user's actual "Profile" page. When viewed by a moderator, the default is the "Activity" page. Given the difference in default between regular users and moderators, it's something I notice on a regular basis (i.e. any time I go to a user profile on a non-Stack Overflow SE site).
    – Makyen Mod
    Commented Sep 30, 2021 at 15:39
  • @Makyen then I think it may be my muscle memory being thrown off by the redesign, i.e. I unconsciously always clicked "Activity" but now I have to actively search for it. Updated to feature request.
    – CodeCaster
    Commented Sep 30, 2021 at 15:40
  • 1
    @CodeCaster I can certainly understand that. Personally, I use some CSS to put that tabbar back to where it was (i.e. at the top) and looking (mostly) like what it used to.
    – Makyen Mod
    Commented Sep 30, 2021 at 15:46
  • "last used" is not to be confused with the now infamous "last seen" change. Commented Oct 4, 2021 at 9:40

1 Answer 1

8

This user script seems to work as a redirect to the "Activity" tab for all user profiles, unless one has chosen to view a particular tab:

// ==UserScript==
// @name         Stack Redirect User Profiles
// @description  Go to the "Activity" page
// @version      0.1
//
// @namespace    scratte-fiddlings
// @author       Scratte (https://stackoverflow.com/users/12695027)
//
// @include      /^https://(?:meta\.)?askubuntu\.com/users//
// @include      /^https://(?:meta\.)?mathoverflow\.net/users//
// @include      /^https://(?:[^/]+\.)?stackoverflow\.com/users//
// @include      /^https://(?:meta\.)?superuser\.com/users//
// @include      /^https://(?:meta\.)?serverfault\.com/users//
// @include      /^https://stackapps\.com/users//
// @include      /^https://[^/]+\.stackexchange\.com/users//
// @exclude      *://api.stackexchange.com/*
// @exclude      *://data.stackexchange.com/*
// @exclude      *://elections.stackexchange.com/*
// @exclude      *://openid.stackexchange.com/*
// @exclude      *://blog.*.com/*
// @exclude      *://chat.*.com/*
// @exclude      *://contests.*.com/*
//
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const host = document.location.host;
    const path = document.location.pathname;
    const search = document.location.search;
    if (!search) {
        const redirect = document.createElement("meta");
        redirect.setAttribute("http-equiv", "refresh");
        redirect.setAttribute("content", `0; URL=https://${host}/${path}?tab=topactivity`);
        document.querySelector("head")?.append(redirect);
    }
})();
5
  • 1
    I did have a few issues with being continuously redirected while making it, so.. be ready on the close tab "button", just in case :)
    – Scratte
    Commented Sep 30, 2021 at 15:36
  • 1
    Nop, each and every bug solved with Script.
    – 4b0
    Commented Sep 30, 2021 at 16:05
  • 1
    @Shree I agree. But life is too short to wait for 6-8..
    – Scratte
    Commented Sep 30, 2021 at 16:07
  • Wouldn't it be "cleaner" to change all the anchors in the page? Something like document.querySelectorAll('a[href*="/users/"]').forEach(anchor => { const searchParams = new URLSearchParams(anchor.search); if (!searchParams.has("tab")) { searchParams.append("tab", "topactivity"); } anchor.search = searchParams; });. Seems like this would make less requests (but it would probably require some more work to avoid links to "anotherdomain/users/")
    – Kaiido
    Commented Oct 1, 2021 at 5:59
  • @Kaiido That's a good idea :) The directives would need a little adjustments too :)
    – Scratte
    Commented Oct 1, 2021 at 7:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .