Skip to main content
added 865 characters in body
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64
  1. @match is much less resource intensive than regex includes.
  2. Not all platforms support regex includes.
  3. Run at doc start so that don't have to wait for most of the page to load before redirecting.
  4. Use location.replace so that browser history is not filled with junk pages and back button works as expected.
  5. All SE sites are matched. The redirect appears to do no harm on sites that don't have the new profile pages yet.
  6. Runs on Stack Overflow for Teams.
// ==UserScript==
// @name        Stack Exchange, 'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @match       *://*.stackoverflow.com/c/*/users/*
// @exclude     *://*/review
// @exclude     *://api.stackexchange.com/*
// @exclude     *://blog.*.com/*
// @exclude     *://chat.*.com/*
// @exclude     *://data.stackexchange.com/*
// @exclude     *://elections.stackexchange.com/*
// @exclude     *://openid.stackexchange.com/*
// @exclude     *://stackexchange.com/*
// @grant       none
// @run-at      document-start
// @version     12.30
// @history     2.0 Added support for Stack Overflow teams
// @author      ProgramFOX and Brock Adams
// @homepage    https://stackapps.com/q/6267/7653
// ==/UserScript==
/* eslint-disable no-multi-spaces */

if (    ! location.search   &&
        ! location.hash     &&
        ! /^chat\./.test (location.host)    &&
        ! /\/users\/edit\/|\/login\blogin\b|\/iflag-summary/.test (location.pathname)  
) {
    location.replace (location.href + "?tab=topactivity");
}
  1. @match is much less resource intensive than regex includes.
  2. Not all platforms support regex includes.
  3. Run at doc start so that don't have to wait for most of the page to load before redirecting.
  4. Use location.replace so that browser history is not filled with junk pages and back button works as expected.
  5. All SE sites are matched. The redirect appears to do no harm on sites that don't have the new profile pages yet.
// ==UserScript==
// @name        Stack Exchange, 'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @grant       none
// @run-at      document-start
// @version     1.3
// ==/UserScript==

if (! location.search  &&  ! location.hash  &&  ! /\/users\/edit\/|\/login\b/i.test (location.pathname) ) {
    location.replace (location.href + "?tab=topactivity");
}
  1. @match is much less resource intensive than regex includes.
  2. Not all platforms support regex includes.
  3. Run at doc start so that don't have to wait for most of the page to load before redirecting.
  4. Use location.replace so that browser history is not filled with junk pages and back button works as expected.
  5. All SE sites are matched. The redirect appears to do no harm on sites that don't have the new profile pages yet.
  6. Runs on Stack Overflow for Teams.
// ==UserScript==
// @name        Stack Exchange, 'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @match       *://*.stackoverflow.com/c/*/users/*
// @exclude     *://*/review
// @exclude     *://api.stackexchange.com/*
// @exclude     *://blog.*.com/*
// @exclude     *://chat.*.com/*
// @exclude     *://data.stackexchange.com/*
// @exclude     *://elections.stackexchange.com/*
// @exclude     *://openid.stackexchange.com/*
// @exclude     *://stackexchange.com/*
// @grant       none
// @run-at      document-start
// @version     2.0
// @history     2.0 Added support for Stack Overflow teams
// @author      ProgramFOX and Brock Adams
// @homepage    https://stackapps.com/q/6267/7653
// ==/UserScript==
/* eslint-disable no-multi-spaces */

if (    ! location.search   &&
        ! location.hash     &&
        ! /^chat\./.test (location.host)    &&
        ! /\/users\/edit\/|\/login\b|\/flag-summary/.test (location.pathname) 
) {
    location.replace (location.href + "?tab=topactivity");
}
Script interfered with some logins and registrations. Fixed.
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64

The following performs better:

  1. @match is much less resource intensive than regex includes.
  2. Not all platforms support regex includes.
  3. Run at doc start so that don't have to wait for most of the page to load before redirecting.
  4. Use location.replace so that browser history is not filled with junk pages and back button works as expected.
  5. All SE sites are matched. The redirect appears to do no harm on sites that don't have the new profile pages yet.
// ==UserScript==
// @name        Stack Exchange, 'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @grant       none
// @run-at      document-start
// @version     1.3
// ==/UserScript==

if (! location.search  &&  ! location.hash  &&  ! /\/users\/edit\/|\/login\b/i.test (location.pathname) ) {
    location.replace (location.href + "?tab=topactivity");
}

The following performs better:

  1. @match is much less resource intensive than regex includes.
  2. Not all platforms support regex includes.
  3. Run at doc start so that don't have to wait for most of the page to load before redirecting.
  4. Use location.replace so that browser history is not filled with junk pages and back button works as expected.
  5. All SE sites are matched. The redirect appears to do no harm on sites that don't have the new profile pages yet.
// ==UserScript==
// @name        'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @grant       none
// @run-at      document-start
// ==/UserScript==

if (! location.search  &&  ! location.hash  &&  ! /\/users\/edit\//i.test (location.pathname) ) {
    location.replace (location.href + "?tab=topactivity");
}

The following performs better:

  1. @match is much less resource intensive than regex includes.
  2. Not all platforms support regex includes.
  3. Run at doc start so that don't have to wait for most of the page to load before redirecting.
  4. Use location.replace so that browser history is not filled with junk pages and back button works as expected.
  5. All SE sites are matched. The redirect appears to do no harm on sites that don't have the new profile pages yet.
// ==UserScript==
// @name        Stack Exchange, 'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @grant       none
// @run-at      document-start
// @version     1.3
// ==/UserScript==

if (! location.search  &&  ! location.hash  &&  ! /\/users\/edit\/|\/login\b/i.test (location.pathname) ) {
    location.replace (location.href + "?tab=topactivity");
}
onstartups no longer needs to be supported.
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64

(Not yet fully tested, but should be okay across all sites)

// ==UserScript==
// @name        'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.onstartups.com/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @grant       none
// @run-at      document-start
// ==/UserScript==

if (! location.search  &&  ! location.hash  &&  ! /\/users\/edit\//i.test (location.pathname) ) {
    location.replace (location.href + "?tab=topactivity");
}
// ==UserScript==
// @name        'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @grant       none
// @run-at      document-start
// ==/UserScript==

if (! location.search  &&  ! location.hash  &&  ! /\/users\/edit\//i.test (location.pathname) ) {
    location.replace (location.href + "?tab=topactivity");
}

(Not yet fully tested, but should be okay across all sites)

// ==UserScript==
// @name        'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.onstartups.com/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @grant       none
// @run-at      document-start
// ==/UserScript==

if (! location.search  &&  ! location.hash  &&  ! /\/users\/edit\//i.test (location.pathname) ) {
    location.replace (location.href + "?tab=topactivity");
}
// ==UserScript==
// @name        'Activity' tab as default
// @description A userscript that automatically shows the Activity tab as default on profile pages
// @match       *://*.askubuntu.com/users/*
// @match       *://*.mathoverflow.net/users/*
// @match       *://*.serverfault.com/users/*
// @match       *://*.stackapps.com/users/*
// @match       *://*.stackexchange.com/users/*
// @match       *://*.stackoverflow.com/users/*
// @match       *://*.superuser.com/users/*
// @grant       none
// @run-at      document-start
// ==/UserScript==

if (! location.search  &&  ! location.hash  &&  ! /\/users\/edit\//i.test (location.pathname) ) {
    location.replace (location.href + "?tab=topactivity");
}
added 52 characters in body
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64
Loading
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64
Loading